dsh-capability-panel 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +4 -4
- package/README.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh.md +1 -0
- package/lib/client.js +230 -39
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +517 -233
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["isRecord","tools: McpToolEntry[]","out: Record<string, number>","skills: SkillEntry[]","mcp: McpServerEntry[]","systemTools: ToolEntry[]","degraded: string[] | undefined","INITIAL_STATE: InspectorState","store","ROUTE","epoch","mutationQueue: Promise<void>","requestPayload","body: unknown","patch: Partial<InspectorState> | undefined","skills: LabeledSkill[]","zh: Record<string, string>","en: Record<string, string>","React","React","index","React","formatErrorMessage","React","result","stateAttributesMapping","React","_formatErrorMessage","React","React","getComputedStyle","React","_formatErrorMessage","React","disabled","ownerWindow","React","disabled","React","_formatErrorMessage","stateAttributesMapping","React","_formatErrorMessage","React","React","React","React","React","SwitchRoot","disabled","React","element","REASONS.none","SwitchThumb","React","Switch.Root","Switch.Thumb","EMPTY","index","React","React","REASONS.triggerPress","disabled","React","_formatErrorMessage","TransitionStatusDataAttributes","CollapsiblePanelDataAttributes","CollapsibleTriggerDataAttributes","triggerOpenStateMapping","baseMapping","CollapsibleRoot","React","stateAttributesMapping","triggerOpenStateMapping","CollapsibleTrigger","React","getDimensions","REASONS.none","ownerWindow","CollapsiblePanelCssVars","CollapsiblePanel","platform","platform.os.android","platform.env.jsdom","index","getComputedStyle","getComputedStyle","index","FieldControl","disabled","React","REASONS.none","Input","Field.Control","React","React","register","index","React","_formatErrorMessage","TabsRoot","React","REASONS.missing","REASONS.initial","REASONS.disabled","React","index","register","index","React","disabled","React","_formatErrorMessage","TabsTab","React","disabled","index","REASONS.none","React","is","objectIs","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","getSnapshot","subscribe","useSyncExternalStore$1","shim","TabsPanel","React","index","EMPTY_ARRAY","React","index","React","React","TabsList","React","React","Collapsible.Root","Collapsible.Trigger","Collapsible.Panel","tools: PresetToolRow[]","skills: PresetSkillRow[]","presets: PresetToolEntry[]","mcp: PresetMcpServer[]","INITIAL: PresetToolState","queue: Promise<void>","max","order: string[]","React","toggle","state","groups: React.ReactElement[]","Collapsible.Root","Collapsible.Trigger","Collapsible.Panel","Tabs.Root","Tabs.List","Tabs.Tab","FocusGuard","React","platform.screenReader.voiceOver","platform.engine.webkit","attr","React","FloatingPortal","REASONS.focusOut","index","React","ownerWindow","store","React","disabled","REASONS.focusOut","REASONS.triggerHover","REASONS.outsidePress","platform.engine.webkit","REASONS.triggerPress","store","React","toggle","isClickLikeOpenEvent","store","outsidePress","React","REASONS.triggerPress","escapeKey","REASONS.escapeKey","platform.engine.webkit","getComputedStyle","isRTL","REASONS.outsidePress","unsubscribe","detectOverflow","platform","computePosition","reset","flip","placements","sides","side","placement","overflow","offset","shift","limitShift","size","apply","refresh","update","offset","offset$1","shift","shift$1","flip","flip$1","size","size$1","limitShift","limitShift$1","useLayoutEffect","noop","React","platform","update","data","useSyncExternalStore","getSnapshot","subscribe","store","React","didChange","index","selectors","store","React","selectors","React","store","store","React","REASONS.none","React","store","React","usePosition","store","store","isClickLikeOpenEvent","isClickLikeOpenEventShared","close","REASONS.triggerHover","isInsideEnabledTrigger","store","React","isClickLikeOpenEvent","isClickLikeOpenEventShared","REASONS.triggerHover","isInsideEnabledTrigger","close","React","_formatErrorMessage","REASONS.triggerHover","REASONS.triggerPress","REASONS.escapeKey","REASONS.closePress","REASONS.focusOut","store","REASONS.imperativeAction","CommonPopupDataAttributes","React","REASONS.focusOut","store","React","platform.os.ios","React","PopoverTrigger","store","_formatErrorMessage","React","disabled","REASONS.triggerPress","stateAttributesMapping","React","_formatErrorMessage","PopoverPortal","React","_formatErrorMessage","platform","min","max","offset","React","shift","floatingShift","ownerWindow","x","y","renderedPlacement","middlewareData","update","InternalBackdrop","ownerWindow","platform.engine.webkit","platform.os.ios","React","PopoverPositioner","store","React","REASONS.triggerHover","React","_formatErrorMessage","React","register","PopoverPopup","store","disabled","REASONS.triggerHover","STATE_ORDER: Record<SkillLoadState, number>","react","React","IconContextInjectionOutline16","IconSearchOutline16","IconSendOutline14","ellipsizeMiddle","max","order: string[]","chevronIcon","IconChevronRightOutline14","disclosureRow","Collapsible.Root","Collapsible.Trigger","Collapsible.Panel","Tabs.Root","Tabs.List","Tabs.Tab","Tabs.Panel","Popover.Root","Tooltip","Popover.Trigger","Popover.Portal","Popover.Positioner","Popover.Popup"],"sources":["../src/wire.ts","../src/client/store.ts","../src/client/filter-core.ts","../src/client/filter.ts","../src/client/disclosure.ts","../src/client/locale.ts","../src/client/styles.ts","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useControlled.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useRefWithInit.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useMergedRefs.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/visuallyHidden.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/empty.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/formatErrorMessage.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/reactVersion.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/getReactElementRef.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/mergeObjects.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveClassName.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveStyle.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/merge-props/mergeProps.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useRenderElement.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/safeReact.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useId.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useBaseUiId.mjs","../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useStableCallback.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/owner.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/use-button/useButton.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-constants/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/form-context/FormContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/reason-parts.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useValueChanged.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/root/SwitchRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs","../src/client/switch.ts","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useOnMount.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useAnimationFrame.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useTransitionStatus.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/addEventListener.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useValueAsRef.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveRef.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useAnimationsFinished.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/shared.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/os.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/engine.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/screen-reader.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/env.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/shadowDom.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/element.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/event.mjs","../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useTimeout.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/field/control/FieldControl.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/input/Input.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/TabsRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/list/TabsListContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/tab/TabsTab.mjs","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/shim/index.js","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/inertValue.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/isElementDisabled.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/composite.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/list/TabsList.mjs","../src/client/disclosure-row.ts","../src/client/preset-filter.ts","../src/preset-wire.ts","../src/client/preset-store.ts","../src/client/preset-section.ts","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/mergeCleanups.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/FocusGuard.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingTreeStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs","../node_modules/.pnpm/@floating-ui+core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../node_modules/.pnpm/@floating-ui+react-dom@2.1.9_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/shim/with-selector.js","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/fastHooks.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/useStore.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/Store.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/ReactStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/store.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/root/PopoverRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/store/PopoverStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/root/PopoverRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popupStateMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/utils/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/useTriggerFocusGuards.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useEnhancedClickHandler.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useOpenInteractionType.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/trigger/PopoverTrigger.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/portal/PopoverPortalContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/portal/PopoverPortal.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/positioner/PopoverPositionerContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/hideMiddleware.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useAnchorPositioning.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/InternalBackdrop.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/usePositioner.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useScrollLock.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/positioner/PopoverPositioner.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/toolbar/root/ToolbarRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/closePart.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/popup/PopoverPopup.mjs","../src/client/index.ts"],"sourcesContent":["/**\n * Runtime guards for the wire contract.\n *\n * `contract.ts` stays types-only; this module is its runtime half. The host\n * validates every service boundary read (failures land in `degraded`), so the\n * client must not bare-cast `response.json()` either — a host/client version\n * skew (client hot-reloads, host needs a restart) is exactly when shapes\n * diverge, and a rejected payload must read as an error, not as \"no skills\".\n */\nimport type { InspectorPayload, McpServerEntry, McpToolEntry, SkillEntry, ToolEntry } from './contract.js';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\nconst optString = (value: unknown): string | undefined => (typeof value === 'string' ? value : undefined);\n\nfunction parseSkillEntry(value: unknown): SkillEntry | null {\n if (!isRecord(value) || typeof value['name'] !== 'string') return null;\n const state = value['state'];\n if (state !== 'loaded' && state !== 'pruned' && state !== 'evicted' && state !== 'unloaded') return null;\n if (typeof value['enabled'] !== 'boolean' || typeof value['loadCount'] !== 'number') return null;\n if (typeof value['source'] !== 'string' || typeof value['provider'] !== 'string') return null;\n const description = optString(value['description']);\n const path = optString(value['path']);\n const group = optString(value['group']);\n return {\n name: value['name'],\n state,\n enabled: value['enabled'],\n loadCount: value['loadCount'],\n source: value['source'],\n provider: value['provider'],\n ...(description === undefined ? {} : { description }),\n ...(path === undefined ? {} : { path }),\n ...(group === undefined ? {} : { group }),\n };\n}\n\nfunction parseToolEntry(value: unknown): ToolEntry | null {\n if (!isRecord(value) || typeof value['name'] !== 'string' || typeof value['label'] !== 'string') return null;\n if (typeof value['enabled'] !== 'boolean') return null;\n const description = optString(value['description']);\n return {\n name: value['name'],\n label: value['label'],\n enabled: value['enabled'],\n ...(description === undefined ? {} : { description }),\n ...(value['reserved'] === true ? { reserved: true } : {}),\n };\n}\n\nfunction parseMcpToolEntry(value: unknown): McpToolEntry | null {\n return parseToolEntry(value);\n}\n\nfunction parseMcpServerEntry(value: unknown): McpServerEntry | null {\n if (!isRecord(value) || typeof value['server'] !== 'string' || typeof value['enabled'] !== 'boolean') return null;\n if (!Array.isArray(value['tools'])) return null;\n const tools: McpToolEntry[] = [];\n for (const tool of value['tools']) {\n const parsed = parseMcpToolEntry(tool);\n if (parsed === null) return null;\n tools.push(parsed);\n }\n const source = optString(value['source']);\n const path = optString(value['path']);\n return { server: value['server'], enabled: value['enabled'], tools, ...(source === undefined ? {} : { source }), ...(path === undefined ? {} : { path }) };\n}\n\nfunction parseBlocked(value: unknown): Record<string, number> | null {\n if (!isRecord(value)) return null;\n const out: Record<string, number> = {};\n for (const [key, count] of Object.entries(value)) {\n if (typeof count !== 'number') return null;\n out[key] = count;\n }\n return out;\n}\n\n/** Parse one wire payload; null means the shape is not ours (version skew). */\nexport function parseInspectorPayload(value: unknown): InspectorPayload | null {\n if (!isRecord(value)) return null;\n const sessionId = value['sessionId'];\n if (sessionId !== null && typeof sessionId !== 'string') return null;\n if (!Array.isArray(value['skills']) || !Array.isArray(value['mcp']) || !Array.isArray(value['systemTools'])) {\n return null;\n }\n const skills: SkillEntry[] = [];\n for (const skill of value['skills']) {\n const parsed = parseSkillEntry(skill);\n if (parsed === null) return null;\n skills.push(parsed);\n }\n const mcp: McpServerEntry[] = [];\n for (const server of value['mcp']) {\n const parsed = parseMcpServerEntry(server);\n if (parsed === null) return null;\n mcp.push(parsed);\n }\n const systemTools: ToolEntry[] = [];\n for (const tool of value['systemTools']) {\n const parsed = parseToolEntry(tool);\n if (parsed === null) return null;\n systemTools.push(parsed);\n }\n const blocked = parseBlocked(value['blocked']);\n if (blocked === null) return null;\n const degradedRaw = value['degraded'];\n let degraded: string[] | undefined;\n if (degradedRaw !== undefined) {\n if (!Array.isArray(degradedRaw) || degradedRaw.some((note) => typeof note !== 'string')) return null;\n degraded = degradedRaw as string[];\n }\n return {\n sessionId,\n skills,\n mcp,\n systemTools,\n blocked,\n ...(degraded === undefined ? {} : { degraded }),\n };\n}\n","import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';\nimport type { InspectorPayload } from '../contract.js';\nimport { parseInspectorPayload } from '../wire.js';\n\nexport interface InspectorState {\n readonly open: boolean;\n readonly loading: boolean;\n readonly payload: InspectorPayload | null;\n /** Transport-level failure, distinct from `payload.degraded` (partial reads). */\n readonly error: string | null;\n}\n\nconst INITIAL_STATE: InspectorState = { open: false, loading: false, payload: null, error: null };\nconst store = createSnapshotStore<InspectorState>(INITIAL_STATE);\n\nexport const subscribe = (listener: () => void): (() => void) => store.subscribe(listener);\n/** Reference-stable while nothing changed, as useSyncExternalStore requires. */\nexport const getSnapshot = (): InspectorState => store.getSnapshot();\n\nexport function toggle(): void {\n const snapshot = store.getSnapshot();\n store.set({ ...snapshot, open: !snapshot.open });\n}\n\nexport function close(): void {\n const snapshot = store.getSnapshot();\n if (snapshot.open) store.set({ ...snapshot, open: false });\n}\n\nconst ROUTE = '/api/capability-panel';\n\n/**\n * Reads and writes have different ordering domains. A newer refresh supersedes\n * an older refresh, but it cannot invalidate a user's mutation response.\n * `mutationVersion` changes at both ends of a write, so a GET overlapping a\n * mutation cannot commit a possibly pre-write snapshot. `epoch` invalidates\n * every answer from a dead connection.\n */\nlet epoch = 0;\nlet refreshSeq = 0;\nlet mutationVersion = 0;\nlet activeRequests = 0;\nlet mutationQueue: Promise<void> = Promise.resolve();\n\nfunction beginRequest(): number {\n activeRequests += 1;\n const snapshot = store.getSnapshot();\n store.set({ ...snapshot, loading: true, error: null });\n return epoch;\n}\n\nfunction finishRequest(requestEpoch: number, patch?: Partial<InspectorState>): void {\n if (requestEpoch !== epoch) return;\n activeRequests -= 1;\n if (patch === undefined && activeRequests > 0) return;\n store.set({ ...store.getSnapshot(), ...patch, loading: activeRequests > 0 });\n}\n\nasync function requestPayload(sessionId: string | null, init?: RequestInit): Promise<InspectorPayload> {\n const query = sessionId === null ? '' : `?session=${encodeURIComponent(sessionId)}`;\n const response = await fetch(`${ROUTE}${query}`, { credentials: 'same-origin', ...init });\n if (!response.ok) {\n let detail = '';\n try {\n const body: unknown = await response.json();\n if (body !== null && typeof body === 'object' && typeof (body as { error?: unknown }).error === 'string') {\n detail = `: ${(body as { error: string }).error}`;\n }\n } catch {\n // A non-JSON error still has a useful HTTP status.\n }\n throw new Error(`HTTP ${response.status}${detail}`);\n }\n const payload = parseInspectorPayload(await response.json());\n if (payload === null) throw new Error('unexpected payload shape (host/client version skew?)');\n return payload;\n}\n\nexport async function refresh(sessionId: string | null): Promise<void> {\n const requestEpoch = beginRequest();\n const mine = ++refreshSeq;\n const mutationAtStart = mutationVersion;\n let patch: Partial<InspectorState> | undefined;\n try {\n const payload = await requestPayload(sessionId);\n if (requestEpoch === epoch && mine === refreshSeq && mutationAtStart === mutationVersion) {\n patch = { payload, error: null };\n }\n } catch (error) {\n if (requestEpoch === epoch && mine === refreshSeq && mutationAtStart === mutationVersion) {\n // Keep the last good payload visible: stale data plus an explicit error is\n // safer than an empty panel that falsely reads as \"no capabilities\".\n patch = { error: error instanceof Error ? error.message : String(error) };\n }\n } finally {\n finishRequest(requestEpoch, patch);\n }\n}\n\nexport function setCapability(\n sessionId: string,\n kind: 'skill' | 'mcp-server' | 'mcp-tool' | 'system-tool',\n name: string,\n enabled: boolean,\n): Promise<void> {\n const requestEpoch = beginRequest();\n mutationVersion += 1;\n const run = async (): Promise<void> => {\n let patch: Partial<InspectorState> | undefined;\n try {\n const payload = await requestPayload(sessionId, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ kind, name, enabled }),\n });\n if (requestEpoch === epoch) patch = { payload, error: null };\n } catch (error) {\n if (requestEpoch === epoch) patch = { error: error instanceof Error ? error.message : String(error) };\n } finally {\n if (requestEpoch === epoch) mutationVersion += 1;\n finishRequest(requestEpoch, patch);\n }\n };\n // The queue tail is normalized below, so it is always fulfilled here.\n const result = mutationQueue.then(run);\n // run absorbs transport failures into the store, so the queue stays fulfilled.\n mutationQueue = result;\n return result;\n}\n\nexport function reset(): void {\n epoch += 1;\n refreshSeq += 1;\n mutationVersion += 1;\n activeRequests = 0;\n mutationQueue = Promise.resolve();\n store.set(INITIAL_STATE);\n}\n","/**\n * Panel text filter as a pure function over a capability set, so the matching\n * rules are unit-testable without a DOM and each component stays a projection.\n *\n * Matching rules (case-insensitive substring, query trimmed):\n * - skill: name, description, or `stateLabel` (the localized load-state pill\n * text the row shows — searching the visible \"已截断/truncated\" finds the\n * skills wearing it);\n * - MCP server: server name keeps ALL of its tools (the match is the server's\n * identity); otherwise only the matching tools survive and a server with no\n * surviving tools drops out;\n * - system tool: label, full name, or description.\n *\n * Both panels share this one implementation rather than a copy each. They are\n * required to behave identically under the same query -- two scopes of one\n * feature -- and a copy maintained by hand is how that requirement quietly\n * stops being true.\n *\n * Each caller keeps its own payload types: the generics below name only the\n * fields matching reads, so a skill carrying `state` and one carrying\n * `project` both satisfy them and neither shape leaks into the other panel.\n */\n\n/** The fields a skill row is matched on. */\nexport interface MatchableSkill {\n readonly name: string;\n readonly description?: string;\n /**\n * Localized state pill text, supplied by the caller that owns the locale.\n * Optional so the settings panel (whose rows have no state) stays valid.\n */\n readonly stateLabel?: string;\n /** Localized source label, for matching the origin chip text. */\n readonly sourceLabel?: string;\n}\n\n/** The fields a tool row is matched on, for system tools and MCP tools alike. */\nexport interface MatchableTool {\n readonly name: string;\n readonly label: string;\n readonly description?: string;\n}\n\n/** An MCP server and the tools nested under it. */\nexport interface MatchableServer<Tool extends MatchableTool> {\n readonly server: string;\n readonly tools: readonly Tool[];\n /** Server source label, for matching the origin chip text. */\n readonly source?: string;\n}\n\nexport interface Capabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n> {\n readonly skills: readonly Skill[];\n readonly mcp: readonly Server[];\n readonly systemTools: readonly Tool[];\n}\n\nexport interface FilteredCapabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n> {\n readonly skills: readonly Skill[];\n readonly mcp: readonly Server[];\n readonly systemTools: readonly Tool[];\n /** Visible top-level rows (skill + server + system tool), for the summary. */\n readonly total: number;\n}\n\nconst hit = (query: string, fields: readonly (string | undefined)[]): boolean =>\n fields.some((field) => field !== undefined && field.toLowerCase().includes(query));\n\nexport function filterCapabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n>(source: Capabilities<Skill, Tool, Server>, rawQuery: string): FilteredCapabilities<Skill, Tool, Server> {\n const query = rawQuery.trim().toLowerCase();\n if (query === '') {\n return {\n skills: source.skills,\n mcp: source.mcp,\n systemTools: source.systemTools,\n total: source.skills.length + source.mcp.length + source.systemTools.length,\n };\n }\n const skills = source.skills.filter((skill) => hit(query, [skill.name, skill.description, skill.stateLabel, skill.sourceLabel]));\n const mcp = source.mcp.flatMap((server) => {\n if (hit(query, [server.server, server.source])) return [server];\n const tools = server.tools.filter((tool) => hit(query, [tool.label, tool.name, tool.description]));\n return tools.length > 0 ? [{ ...server, tools }] : [];\n });\n const systemTools = source.systemTools.filter((tool) =>\n hit(query, [tool.label, tool.name, tool.description]),\n );\n return { skills, mcp, systemTools, total: skills.length + mcp.length + systemTools.length };\n}\n","/**\n * The composer panel's text filter. The rules live in `filter-core.ts` and are\n * shared with the settings panel; this module fixes them to the session wire\n * types and adds the one field only this panel has: the localized load-state\n * pill, so a query can match what the row visibly says (已截断/truncated).\n */\nimport { filterCapabilities } from './filter-core.js';\nimport type { FilteredCapabilities } from './filter-core.js';\nimport type { InspectorPayload, McpServerEntry, SkillEntry, ToolEntry } from '../contract.js';\n\ntype LabeledSkill = SkillEntry & { readonly stateLabel?: string; readonly sourceLabel?: string };\n\nexport type FilteredPayload = FilteredCapabilities<LabeledSkill, ToolEntry, McpServerEntry>;\n\nexport function filterPayload(\n payload: InspectorPayload,\n rawQuery: string,\n // Default matches the raw state key, so 'pruned' finds pruned rows even\n // before a locale is wired in.\n stateLabel: (skill: SkillEntry) => string = (skill) => skill.state,\n sourceLabel: (skill: SkillEntry) => string = (skill) => skill.source,\n): FilteredPayload {\n // Blank query returns the payload's own rows untouched — the panel's\n // rendering relies on that reference identity to skip work.\n if (rawQuery.trim() === '') return filterCapabilities(payload, rawQuery);\n const skills: LabeledSkill[] = payload.skills.map((skill) => ({ ...skill, stateLabel: stateLabel(skill), sourceLabel: sourceLabel(skill) }));\n return filterCapabilities({ ...payload, skills }, rawQuery);\n}\n","export interface DisclosureState {\n readonly open: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Resolve one controlled disclosure's visible and interactive state.\n * Filtering deliberately preserves the user's stored preference while forcing\n * matching detail open; the disabled trigger prevents a no-feedback toggle.\n * Labels are the caller's job — they go through the locale translate function.\n */\nexport function resolveDisclosure(expanded: boolean, filtering: boolean): DisclosureState {\n if (filtering) {\n return { open: true, disabled: true };\n }\n return { open: expanded, disabled: false };\n}\n\n/** Shared geometry and hover classes used by every capability header. */\nexport const ROW_ROOT_CLASS = '';\nexport const MCP_TOOL_ROOT_CLASS = 'ci-toolrow';\nexport const ROW_HEADER_CLASS = 'ci-row-head';\n","/**\n * Panel copy, bilingual. Chinese is the authoring language; English is the\n * fallback the host's locale runtime consults after the active locale misses\n * a key (and the locale a browser naming neither shipped language lands on).\n *\n * The dictionaries register into the host's locale service (`ctx.locale`)\n * under this plugin's own namespace, so the panel follows the same language\n * switch as the rest of the UI. Templates interpolate `{name}` placeholders.\n *\n * tests/client/locale.spec.ts pins the two dictionaries to identical key sets\n * and checks every key the component looks up exists in both.\n */\n\nexport const LOCALE_NS = 'capability-panel';\n\nexport const zh: Record<string, string> = {\n 'state.loaded': '已加载',\n 'state.pruned': '已截断',\n 'state.evicted': '已挤出',\n 'state.unloaded': '未加载',\n 'blocked.count': '拦截 ×{count}',\n 'action.enable': '开启 {name}',\n 'action.disable': '关闭 {name}',\n 'action.insert': '把 /{name} 填入输入框',\n 'server.tools': '{count} 工具',\n 'server.tool.one': '1 个工具',\n 'status.loading': '读取中…',\n 'status.error': '读取失败:{error}(可尝试刷新页面;宿主改动需重启 dsh 后生效)',\n 'empty.match': '无匹配项',\n 'empty.skills': '无可用技能',\n 'empty.mcp': '无 MCP 服务器',\n 'empty.system': '无系统工具',\n 'group.skills': '技能 ({shown}/{total})',\n 'group.mcp': 'MCP ({shown}/{total})',\n 'group.system': '系统工具 ({shown}/{total})',\n 'tab.all': '全部',\n 'tab.skills': '技能',\n 'tab.mcp': 'MCP',\n 'tab.system': '工具',\n 'tab.system.aria': '系统工具 {count}',\n 'tabs.aria': '能力分区',\n 'trigger.tooltip': '会话上下文:技能、MCP 与工具',\n 'panel.aria': '会话上下文',\n 'filter.placeholder': '筛选名称或描述…',\n 'filter.aria': '筛选技能与工具',\n 'filter.clear': '清空筛选',\n 'filter.count': '匹配 {shown} / {total} 项',\n 'disclosure.expand': '展开 {subject} 的{detail}',\n 'disclosure.collapse': '收起 {subject} 的{detail}',\n 'disclosure.pinned': '{subject} 的{detail}(筛选时保持展开)',\n 'detail.description': '描述',\n 'detail.tools': '工具',\n 'preset.nav': '能力面板',\n 'preset.title': '能力面板',\n 'preset.intro': '设置每个 Agent preset 的默认能力集合,之后新建或恢复的会话会继承它。输入框里的「会话上下文」只改当前会话,并随该会话在重启后恢复。',\n 'preset.projectSkill': '当前项目',\n 'preset.kindAria': '按类别筛选',\n 'preset.readonly': '当前设置存储不可写;你可以查看工具,但无法保存微调。',\n 'preset.choose': 'Agent preset',\n 'preset.empty': '没有可用的 Agent preset。',\n 'preset.noTools': '这个 preset 没有可用能力。',\n 'preset.reserved': '{name} 是保留的传输通道,不能关闭。',\n 'preset.broken': '这个 preset 无法组装会话:{reason}。修好它之后才能列出工具。',\n 'degraded.item': '⚠ 部分读取失败:{note}',\n 'source.project-dsh': '项目 .dsh',\n 'source.project-agents': '项目 agent',\n 'source.runtime': '运行时',\n 'source.user-dsh': '用户 .dsh',\n 'source.user-agents': '用户 agent',\n 'source.custom': '自定义',\n 'source.bundled': '内置',\n 'source.host': '全局',\n 'source.preset': '预设',\n 'source.openFolder': '在文件管理器中打开 {source}',\n};\n\nexport const en: Record<string, string> = {\n 'state.loaded': 'loaded',\n 'state.pruned': 'truncated',\n 'state.evicted': 'evicted',\n 'state.unloaded': 'not loaded',\n 'blocked.count': 'blocked ×{count}',\n 'action.enable': 'Enable {name}',\n 'action.disable': 'Disable {name}',\n 'action.insert': 'Insert /{name} into the composer',\n 'server.tools': '{count} tools',\n 'server.tool.one': '1 tool',\n 'status.loading': 'Loading…',\n 'status.error': 'Failed to load: {error} (try refreshing the page; host changes take effect after a dsh restart)',\n 'empty.match': 'No matches',\n 'empty.skills': 'No skills available',\n 'empty.mcp': 'No MCP servers',\n 'empty.system': 'No system tools',\n 'group.skills': 'Skills ({shown}/{total})',\n 'group.mcp': 'MCP ({shown}/{total})',\n 'group.system': 'System tools ({shown}/{total})',\n 'tab.all': 'All',\n 'tab.skills': 'Skills',\n 'tab.mcp': 'MCP',\n 'tab.system': 'Tools',\n 'tab.system.aria': 'System tools, {count}',\n 'tabs.aria': 'Capability sections',\n 'trigger.tooltip': 'Session context: skills, MCP & tools',\n 'panel.aria': 'Session context',\n 'filter.placeholder': 'Filter by name or description…',\n 'filter.aria': 'Filter skills and tools',\n 'filter.clear': 'Clear filter',\n 'filter.count': '{shown} / {total} matched',\n 'disclosure.expand': 'Expand {detail} for {subject}',\n 'disclosure.collapse': 'Collapse {detail} for {subject}',\n 'disclosure.pinned': '{detail} for {subject} (kept open while filtering)',\n 'detail.description': 'description',\n 'detail.tools': 'tools',\n 'preset.nav': 'Capability Panel',\n 'preset.title': 'Capability Panel',\n 'preset.intro': 'Choose the default capabilities each agent preset starts from; sessions created or resumed afterward inherit it. The composer\\'s Session context changes only the current session, and stays with it across restarts.',\n 'preset.projectSkill': 'this project',\n 'preset.kindAria': 'Filter by category',\n 'preset.readonly': 'Settings storage is read-only. You can inspect tools, but changes cannot be saved.',\n 'preset.choose': 'Agent preset',\n 'preset.empty': 'No agent presets are available.',\n 'preset.noTools': 'This preset exposes no capabilities.',\n 'preset.reserved': '{name} is a reserved transport and cannot be disabled.',\n 'preset.broken': 'This preset cannot compose a session: {reason}. Fix it before its tools can be listed.',\n 'degraded.item': '⚠ Partial read failed: {note}',\n 'source.project-dsh': 'project .dsh',\n 'source.project-agents': 'project agent',\n 'source.runtime': 'runtime',\n 'source.user-dsh': 'user .dsh',\n 'source.user-agents': 'user agent',\n 'source.custom': 'custom',\n 'source.bundled': 'bundled',\n 'source.host': 'global',\n 'source.preset': 'preset',\n 'source.openFolder': 'Open {source} in file manager',\n};\n\n/**\n * The slice of the host locale service this plugin uses. The full runtime\n * (dsh-client-locale) resolves the active locale per read and falls back to\n * `en` on a missing key, so a translate function is all the panel needs.\n */\nexport interface LocaleService {\n register(ns: string, locale: string, dict: Record<string, string>): () => void;\n bind(ns: string): (key: string, params?: Record<string, unknown>) => string;\n subscribe(fn: () => void): () => void;\n getSnapshot(): { readonly active: string; readonly revision: number };\n}\n\nexport type Translate = (key: string, params?: Record<string, unknown>) => string;\n\n/**\n * Register both dictionaries as one effect: the single-locale form is the\n * documented entry for namespaces outside the host's compile-time merge\n * table, and the returned disposers release both on unload.\n */\nexport function registerLocale(locale: LocaleService): () => void {\n const disposeZh = locale.register(LOCALE_NS, 'zh', zh);\n const disposeEn = locale.register(LOCALE_NS, 'en', en);\n return () => {\n disposeZh();\n disposeEn();\n };\n}\n","export const TOK = {\n textPrimary: 'var(--dsw-alias-label-primary, #0f1115)',\n textSecondary: 'var(--dsw-alias-label-secondary, #61666b)',\n textTertiary: 'var(--dsw-alias-label-tertiary, #81858c)',\n border: 'var(--dsw-alias-border-l1, rgba(0,0,0,.04))',\n /** Hairline rules that must stay visible (the host menu footer divider's token). */\n borderStrong: 'var(--dsw-alias-border-l2, rgba(0,0,0,.1))',\n switchOn: 'var(--dsw-alias-state-business-primary, #4176e6)',\n switchOff: 'var(--dsw-alias-border-l2, rgba(0,0,0,.1))',\n switchThumb: 'var(--dsw-alias-bg-layer-1, #ffffff)',\n switchEase: 'var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1))',\n menuBg: 'var(--dsw-specific-menu, #ffffff)',\n menuBorder: 'var(--dsw-alias-border-inverted, rgba(0,0,0,.1))',\n menuShadow: 'var(--dsw-shadow-lv3, 0 12px 32px rgba(0,0,0,.22))',\n bgBase: 'var(--dsw-alias-bg-base, #ffffff)',\n fontFamily:\n 'var(--dsw-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", \"Helvetica Neue\", Helvetica, Arial, sans-serif)',\n success: 'var(--dsw-alias-state-success-primary, #22c55e)',\n warn: 'var(--dsw-alias-state-warn-primary, #f59e0b)',\n error: 'var(--dsw-alias-state-error-primary, #ec1313)',\n /** Informational accent (e.g. a pruned-but-visible skill), decoupled from\n * the Switch track token so restyling one does not recolor the other. */\n info: 'var(--dsw-alias-state-business-primary, #4176e6)',\n} as const;\n\nexport const PANEL_CSS = [\n '.ci-trigger:focus-visible,.ci-switch:focus-visible,.ci-iconbtn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:999px}',\n '.ci-disclosure-trigger:focus-visible,.ci-server-trigger:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:4px}',\n '.ci-tab:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:6px}',\n '.ci-trigger:hover,.ci-iconbtn:hover,.ci-server-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06))}',\n '.ci-switch:hover:not(:disabled){filter:brightness(1.12)}',\n '.ci-row-head{display:flex;align-items:center;gap:8px;padding:6px 8px;margin:0 -8px;border-radius:8px}',\n '.ci-row-head:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06))}',\n '.ci-row-head .ci-send{opacity:0;transition:opacity .12s}',\n '.ci-row-head:hover .ci-send,.ci-row-head:focus-within .ci-send{opacity:1}',\n '.ci-filter:focus{border-color:var(--dsw-alias-state-business-primary,#4176e6)}',\n '.ci-filter:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:0}',\n '.ci-filter::placeholder{color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-panel{transform-origin:var(--transform-origin);transition:opacity .14s var(--ds-ease-in-out,ease),transform .14s var(--ds-ease-in-out,ease)}',\n '.ci-panel[data-starting-style],.ci-panel[data-ending-style]{opacity:0;transform:scale(.96) translateY(4px)}',\n '.ci-collapse{height:var(--collapsible-panel-height);transition:height .14s var(--ds-ease-in-out,ease);overflow:hidden}',\n '.ci-collapse[data-starting-style],.ci-collapse[data-ending-style]{height:0}',\n '.ci-toolrow{content-visibility:auto;contain-intrinsic-size:auto 30px}',\n '.ci-disclosure-trigger{min-width:0;display:flex;align-items:center;gap:6px;flex:1 1 auto;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}',\n '.ci-disclosure-trigger:disabled,.ci-server-trigger:disabled{cursor:default}',\n '.ci-disclosure-trigger:hover .ci-name{color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-description{padding:3px 0 0 24px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858c);word-break:break-word}',\n '.ci-chevron{display:grid;place-items:center;width:18px;height:18px;flex:none;color:var(--dsw-alias-label-tertiary,#81858c);border-radius:4px}',\n '.ci-chevron svg{transition:transform .12s var(--ds-ease-in-out,ease)}',\n '.ci-server-trigger[aria-expanded=\"true\"] .ci-chevron svg,.ci-disclosure-trigger[aria-expanded=\"true\"] .ci-chevron svg{transform:rotate(90deg)}',\n '.ci-tabs{display:flex;gap:2px;padding:2px;border-radius:8px;background:var(--dsw-alias-bg-base,#ffffff);border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.04))}',\n '.ci-tab{flex:1;height:24px;border:none;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#61666b);font:inherit;font-size:12px;line-height:1;cursor:pointer;font-variant-numeric:tabular-nums;padding:0 4px}',\n '.ci-tab:hover{color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-tab[data-active]{background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#0f1115);box-shadow:0 1px 2px rgba(0,0,0,.08)}',\n '.ci-preset-section{max-width:720px;color:var(--dsw-alias-label-secondary,#61666b)}',\n '.ci-settings-title{margin:0 0 6px;color:var(--dsw-alias-label-primary,#0f1115);font-size:18px;line-height:26px}',\n '.ci-settings-intro,.ci-settings-description,.ci-settings-note{margin:0 0 16px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-settings-note{padding:10px 12px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));border-radius:8px}',\n '.ci-preset-toolbar{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin:10px 0}',\n '.ci-preset-filter{flex:1 1 220px;min-width:180px;height:34px;box-sizing:border-box;padding:0 10px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));border-radius:8px;background-color:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#0f1115);font:inherit;font-weight:400}',\n '.ci-preset-part{margin:18px 0 0}',\n '.ci-preset-part:first-of-type{margin-top:10px}',\n // Section titles read as real headings (primary, 14px semibold) so they\n // stand clearly above the subtle ruled source dividers beneath them.\n '.ci-preset-part-title{margin:0;font-size:14px;font-weight:600;line-height:22px;color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-preset-badge{display:inline-block;margin-left:6px;padding:1px 6px;line-height:1.5;border-radius:999px;font-size:11px;font-weight:500;vertical-align:middle;background-color:var(--dsw-alias-bg-fill-2,rgba(0,0,0,.05));color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-preset-group{padding:0}',\n '.ci-preset-server-trigger{display:flex;align-items:center;gap:8px;flex:1;min-width:0;background:none;border:none;padding:0;text-align:left;font:inherit;color:inherit;cursor:pointer}',\n '.ci-preset-server-trigger:disabled{cursor:default}',\n '.ci-preset-group .ci-preset-tool-list{margin:0;padding-left:26px}',\n '.ci-preset-picker-label{display:grid;gap:6px;color:var(--dsw-alias-label-primary,#0f1115);font-weight:600}',\n '.ci-preset-picker{height:34px;padding:0 10px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));border-radius:8px;background-color:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#0f1115);font:inherit;font-weight:400}',\n '.ci-preset-picker:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px}',\n '.ci-settings-subtitle{margin:0 0 6px;color:var(--dsw-alias-label-primary,#0f1115);font-size:14px;line-height:22px}',\n // Settings rows speak the composer panel's row language: compact padding,\n // a rounded hover background (`.ci-row-head` supplies both), and NO\n // hairline per row — groups separate through the source dividers alone.\n '.ci-preset-tool-list{list-style:none;margin:0;padding:0}',\n '.ci-preset-tool-row{display:flex;align-items:center;gap:16px}',\n '.ci-preset-tool-copy{display:grid;min-width:0;flex:1}',\n '.ci-preset-tool-name{color:var(--dsw-alias-label-primary,#0f1115);font-weight:600;overflow-wrap:anywhere}',\n '.ci-preset-tool-description{color:var(--dsw-alias-label-tertiary,#81858c);line-height:18px;overflow-wrap:anywhere}',\n '.ci-preset-item{list-style:none}',\n '.ci-preset-disclosure{display:block}',\n // Matches the chevron column so a row without a description still lines up\n // with the rows that have one.\n '.ci-preset-spacer{width:18px;flex:none}',\n '.ci-preset-detail{padding:0 0 10px 24px;color:var(--dsw-alias-label-tertiary,#81858c);line-height:18px;overflow-wrap:anywhere}',\n '.ci-preset-kinds{margin:0 0 4px}',\n '.ci-preset-kinds .ci-tabs{display:inline-flex}',\n '.ci-preset-kinds .ci-tab{flex:0 0 auto;padding:0 12px}',\n // Folder icon on source section headers: invisible until hover.\n '.ci-source-header:hover .ci-folder-icon{opacity:1 !important}',\n // Source divider rows inside a settings list: labels, not data rows.\n '.ci-source-divider{list-style:none}',\n '@media (prefers-reduced-motion: reduce){.ci-thumb,.ci-panel,.ci-collapse,.ci-chevron svg{transition:none !important}}',\n].join('\\n');\n","'use client';\n\n// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes, dependency arrays are intentionally ignored\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { error } from \"./error.mjs\";\nexport function useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = React.useRef(controlled !== undefined);\n const [valueState, setValue] = React.useState(defaultProp);\n const value = isControlled ? controlled : valueState;\n if (process.env.NODE_ENV !== 'production') {\n React.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n error([`A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = React.useRef(defaultProp);\n React.useEffect(() => {\n if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {\n error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [defaultProp]);\n }\n const setValueIfUncontrolled = React.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\nfunction serializeToDevModeString(input) {\n let nextId = 0;\n const seen = new WeakMap();\n try {\n const result = JSON.stringify(input, function replacer(key, value) {\n if (key === '_owner' && this != null && typeof this === 'object' && '$$typeof' in this) {\n return undefined;\n }\n if (typeof value === 'bigint') {\n return `__bigint__:${value}`;\n }\n if (value !== null && typeof value === 'object') {\n const id = seen.get(value);\n if (id !== undefined) {\n return `__object__:${id}`;\n }\n seen.set(value, nextId);\n nextId += 1;\n }\n return value;\n });\n return result ?? `__top__:${typeof input}`;\n } catch {\n return '__unserializable__';\n }\n}","'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}","import { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n // Legacy ref with no attach-time cleanup: detach by calling it with `null`.\n // It returns nothing; React 19 cleanups are handled in the branch above.\n void ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nconst noop = () => {};\nexport const useIsoLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : noop;","const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};","export function NOOP() {}\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});","/**\n * Creates a formatErrorMessage function with a custom URL and prefix.\n * @param baseUrl - The base URL for the error page (e.g., 'https://base-ui.com/production-error')\n * @param prefix - The prefix for the error message (e.g., 'Base UI')\n * @returns A function that formats error messages with the given URL and prefix\n */\nexport function createFormatErrorMessage(baseUrl, prefix) {\n return function formatErrorMessage(code, ...args) {\n const url = new URL(baseUrl);\n url.searchParams.set('code', code.toString());\n args.forEach(arg => url.searchParams.append('args[]', arg));\n return `${prefix} error #${code}; visit ${url} for the full message.`;\n };\n}\n\n/**\n * WARNING: Don't import this directly. It's imported by the code generated by\n * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`\n * constructors to ensure the plugin works as expected. Supported patterns include:\n * throw new Error('My message');\n * throw new Error(`My message: ${foo}`);\n * throw new Error(`My message: ${foo}` + 'another string');\n * ...\n */\nconst formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');\nexport default formatErrorMessage;","import * as React from 'react';\nconst majorVersion = parseInt(React.version, 10);\nexport function isReactVersionAtLeast(reactVersionToCheck) {\n return majorVersion >= reactVersionToCheck;\n}","import * as React from 'react';\nimport { isReactVersionAtLeast } from \"./reactVersion.mjs\";\n\n/**\n * Extracts the `ref` from a React element, handling different React versions.\n */\nexport function getReactElementRef(element) {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n return null;\n }\n const reactElement = element;\n const propsWithRef = reactElement.props;\n return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;\n}","export function mergeObjects(a, b) {\n if (a && !b) {\n return a;\n }\n if (!a && b) {\n return b;\n }\n if (a || b) {\n return {\n ...a,\n ...b\n };\n }\n return undefined;\n}","export function getStateAttributesProps(state, customMapping) {\n const props = {};\n\n /* eslint-disable-next-line guard-for-in */\n for (const key in state) {\n const value = state[key];\n if (customMapping?.hasOwnProperty(key)) {\n const customProps = customMapping[key](value);\n if (customProps != null) {\n Object.assign(props, customProps);\n }\n continue;\n }\n if (value === true) {\n props[`data-${key.toLowerCase()}`] = '';\n } else if (value) {\n props[`data-${key.toLowerCase()}`] = value.toString();\n }\n }\n return props;\n}","/**\n * If the provided className is a string, it will be returned as is.\n * Otherwise, the function will call the className function with the state as the first argument.\n *\n * @param className\n * @param state\n */\nexport function resolveClassName(className, state) {\n return typeof className === 'function' ? className(state) : className;\n}","/**\n * If the provided style is an object, it will be returned as is.\n * Otherwise, the function will call the style function with the state as the first argument.\n *\n * @param style\n * @param state\n */\nexport function resolveStyle(style, state) {\n return typeof style === 'function' ? style(state) : style;\n}","import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useMergedRefs, useMergedRefsN } from '@base-ui/utils/useMergedRefs';\nimport { getReactElementRef } from '@base-ui/utils/getReactElementRef';\nimport { mergeObjects } from '@base-ui/utils/mergeObjects';\nimport { warn } from '@base-ui/utils/warn';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getStateAttributesProps } from \"./getStateAttributesProps.mjs\";\nimport { resolveClassName } from \"../utils/resolveClassName.mjs\";\nimport { resolveStyle } from \"../utils/resolveStyle.mjs\";\nimport { mergeProps, mergePropsN, mergeClassNames } from \"../merge-props/index.mjs\";\nimport { createElement as _createElement } from \"react\";\n/**\n * Renders a Base UI element.\n *\n * @param element The default HTML element to render. Can be overridden by the `render` prop.\n * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored.\n * @param params Additional parameters for rendering the element.\n */\nexport function useRenderElement(element, componentProps, params = {}) {\n const renderProp = componentProps.render;\n const outProps = useRenderElementProps(componentProps, params);\n if (params.enabled === false) {\n return null;\n }\n const state = params.state ?? EMPTY_OBJECT;\n return evaluateRenderProp(element, renderProp, outProps, state);\n}\n\n/**\n * Computes render element final props.\n */\nfunction useRenderElementProps(componentProps, params = {}) {\n const {\n className: classNameProp,\n style: styleProp,\n render: renderProp\n } = componentProps;\n const {\n state = EMPTY_OBJECT,\n ref,\n props,\n stateAttributesMapping,\n enabled = true\n } = params;\n const className = enabled ? resolveClassName(classNameProp, state) : undefined;\n const style = enabled ? resolveStyle(styleProp, state) : undefined;\n const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;\n const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;\n\n // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.\n // This prevents potential TypeError when setting ref, className, or style properties,\n // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.\n const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;\n\n // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,\n // switching between them at runtime is safe. If this assertion fails, React will\n // throw at runtime anyway.\n // This also skips the `useMergedRefs` call on the server, which is fine because\n // refs are not used on the server side.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (typeof document !== 'undefined') {\n if (!enabled) {\n // Called only to keep the hook order stable when disabled; the merged ref is unused.\n void useMergedRefs(null, null);\n } else if (Array.isArray(ref)) {\n outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);\n } else {\n outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);\n }\n }\n if (!enabled) {\n return EMPTY_OBJECT;\n }\n if (className !== undefined) {\n outProps.className = mergeClassNames(outProps.className, className);\n }\n if (style !== undefined) {\n outProps.style = mergeObjects(outProps.style, style);\n }\n return outProps;\n}\nfunction resolveRenderFunctionProps(props) {\n if (Array.isArray(props)) {\n return mergePropsN(props);\n }\n return mergeProps(undefined, props);\n}\n\n// The symbol React uses internally for lazy components\n// https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31\n//\n// TODO delete once https://github.com/react/react/issues/32392 is fixed\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\nconst COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;\nconst LOWERCASE_CHARACTER_PATTERN = /[a-z]/;\nfunction evaluateRenderProp(element, render, props, state) {\n if (render) {\n if (typeof render === 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warnIfRenderPropLooksLikeComponent(render);\n }\n return render(props, state);\n }\n const mergedProps = mergeProps(props, render.props);\n mergedProps.ref = props.ref;\n let newElement = render;\n // Workaround for https://github.com/react/react/issues/32392\n // This works because the toArray() logic unwrap lazy element type in\n // https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/react/src/ReactChildren.js#L186\n if (newElement?.$$typeof === REACT_LAZY_TYPE) {\n const children = React.Children.toArray(render);\n newElement = children[0];\n }\n\n // There is a high number of indirections, the error message thrown by React.cloneElement() is\n // hard to use for developers, this logic provides a better context.\n //\n // Our general guideline is to never change the control flow depending on the environment.\n // However, React.cloneElement() throws if React.isValidElement() is false,\n // so we can throw before with custom message.\n if (process.env.NODE_ENV !== 'production') {\n if (! /*#__PURE__*/React.isValidElement(newElement)) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(['Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.', 'A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.', 'https://base-ui.com/r/invalid-render-prop'].join('\\n'));\n }\n }\n return /*#__PURE__*/React.cloneElement(newElement, mergedProps);\n }\n if (element) {\n if (typeof element === 'string') {\n return renderTag(element, props);\n }\n }\n // Unreachable, but the typings on `useRenderElement` need to be reworked\n // to annotate it correctly.\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: Render element or function are not defined.' : _formatErrorMessage(8));\n}\nfunction warnIfRenderPropLooksLikeComponent(renderFn) {\n const functionName = renderFn.name;\n if (functionName.length === 0) {\n return;\n }\n if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {\n return;\n }\n if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {\n return;\n }\n warn(`The \\`render\\` prop received a function named \\`${functionName}\\` that starts with an uppercase letter.`, 'This usually means a React component was passed directly as `render={Component}`.', 'Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.', 'If this is an intentional render callback, rename it to start with a lowercase letter.', 'Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.', 'https://base-ui.com/r/invalid-render-prop');\n}\nfunction renderTag(Tag, props) {\n if (Tag === 'button') {\n return /*#__PURE__*/_createElement(\"button\", {\n type: \"button\",\n ...props,\n key: props.key\n });\n }\n if (Tag === 'img') {\n return /*#__PURE__*/_createElement(\"img\", {\n alt: \"\",\n ...props,\n key: props.key\n });\n }\n return /*#__PURE__*/React.createElement(Tag, props);\n}","import * as React from 'react';\n\n/**\n * A clone of the React namespace for reading APIs that may be missing in older\n * supported React versions. Bundlers can rewrite direct `React.someNewApi`\n * reads into named imports, which breaks React 17. Reading from this cloned\n * object keeps those lookups optional.\n *\n * @see https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\n */\nexport const SafeReact = {\n ...React\n};","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from \"./safeReact.mjs\";\nlet globalId = 0;\n\n// TODO React 17: Remove `useGlobalId` once React 17 support is removed\nfunction useGlobalId(idOverride, prefix = 'mui') {\n const [defaultId, setDefaultId] = React.useState(idOverride);\n const id = idOverride || defaultId;\n React.useEffect(() => {\n if (defaultId == null) {\n // Fallback to this default id when possible.\n // Use the incrementing value for client-side rendering only.\n // We can't use it server-side.\n // If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem\n globalId += 1;\n setDefaultId(`${prefix}-${globalId}`);\n }\n }, [defaultId, prefix]);\n return id;\n}\nconst maybeReactUseId = SafeReact.useId;\n\n/**\n *\n * @example <div id={useId()} />\n * @param idOverride\n * @returns {string}\n */\nexport function useId(idOverride, prefix) {\n // React.useId() is only available from React 17.0.0.\n if (maybeReactUseId !== undefined) {\n const reactId = maybeReactUseId();\n return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);\n }\n\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.\n return useGlobalId(idOverride, prefix);\n}","'use client';\n\nimport { useId } from '@base-ui/utils/useId';\n\n/**\n * Wraps `useId` and prefixes generated `id`s with `base-ui-`\n * @param {string | undefined} idOverride overrides the generated id when provided\n * @returns {string | undefined}\n */\nexport function useBaseUiId(idOverride) {\n return useId(idOverride, 'base-ui');\n}","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';\n}\nfunction isTableElement(element) {\n return /^(table|td|th)$/.test(getNodeName(element));\n}\nfunction isTopLayer(element) {\n try {\n if (element.matches(':popover-open')) {\n return true;\n }\n } catch (_e) {\n // no-op\n }\n try {\n return element.matches(':modal');\n } catch (_e) {\n return false;\n }\n}\nconst willChangeRe = /transform|translate|scale|rotate|perspective|filter/;\nconst containRe = /paint|layout|strict|content/;\nconst isNotNone = value => !!value && value !== 'none';\nlet isWebKitValue;\nfunction isContainingBlock(elementOrCss) {\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (isWebKitValue == null) {\n isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');\n }\n return isWebKitValue;\n}\nfunction isLastTraversableNode(node) {\n return /^(html|body|#document)$/.test(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return (node.ownerDocument || node).body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n } else {\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n }\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","'use client';\n\nimport { SafeReact } from \"./safeReact.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst useInsertionEffect = SafeReact.useInsertionEffect;\nconst useSafeInsertionEffect =\n// React 17 doesn't have useInsertionEffect.\nuseInsertionEffect &&\n// Preact replaces useInsertionEffect with useLayoutEffect and fires too late.\nuseInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : fn => fn();\n/**\n * Stabilizes the function passed so it's always the same between renders.\n *\n * The function becomes non-reactive to any values it captures.\n * It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.\n *\n * The function must only be called inside effects and event handlers, never during render (which throws an error).\n *\n * This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.\n */\nexport function useStableCallback(callback) {\n const stable = useRefWithInit(createStableCallback).current;\n stable.next = callback;\n useSafeInsertionEffect(stable.effect);\n return stable.trampoline;\n}\nfunction createStableCallback() {\n const stable = {\n next: undefined,\n callback: assertNotCalled,\n trampoline: (...args) => stable.callback?.(...args),\n effect: () => {\n stable.callback = stable.next;\n }\n };\n return stable;\n}\nfunction assertNotCalled() {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw /* minify-error-disabled */new Error('Base UI: Cannot call an event handler while rendering.');\n }\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CompositeRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CompositeRootContext.displayName = \"CompositeRootContext\";\nexport function useCompositeRootContext(optional = false) {\n const context = React.useContext(CompositeRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : _formatErrorMessage(16));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nexport function useFocusableWhenDisabled(parameters) {\n const {\n focusableWhenDisabled,\n disabled,\n composite = false,\n tabIndex: tabIndexProp = 0,\n isNativeButton\n } = parameters;\n const isFocusableComposite = composite && focusableWhenDisabled !== false;\n const isNonFocusableComposite = composite && focusableWhenDisabled === false;\n\n // we can't explicitly assign `undefined` to any of these props because it\n // would otherwise prevent subsequently merged props from setting them\n const props = React.useMemo(() => {\n const additionalProps = {\n // allow Tabbing away from focusableWhenDisabled elements\n onKeyDown(event) {\n if (disabled && focusableWhenDisabled && event.key !== 'Tab') {\n event.preventDefault();\n }\n }\n };\n if (!composite) {\n additionalProps.tabIndex = tabIndexProp;\n if (!isNativeButton && disabled) {\n additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;\n }\n }\n if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {\n additionalProps['aria-disabled'] = disabled;\n }\n if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {\n additionalProps.disabled = disabled;\n }\n return additionalProps;\n }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);\n return {\n props\n };\n}","export { getWindow as ownerWindow } from '@floating-ui/utils/dom';\nexport function ownerDocument(node) {\n return node?.ownerDocument || document;\n}","import { ownerWindow } from '@base-ui/utils/owner';\n/**\n * Dispatches a constructed click on the target so it carries the source event's\n * modifier state, which `click()` always reports as unpressed. Like `click()`,\n * the untrusted click still runs native activation behavior (form submission,\n * link navigation).\n * `detail` defaults to 0 (the native convention for keyboard-generated clicks);\n * pass `detail: 1` when the click represents a mouse gesture so consumers keying\n * off `detail === 0` don't classify it as a keyboard activation.\n */\nexport function dispatchClickWithModifiers(target, sourceEvent, {\n detail = 0\n} = {}) {\n target.dispatchEvent(new (ownerWindow(target).PointerEvent)('click', {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n shiftKey: sourceEvent.shiftKey,\n ctrlKey: sourceEvent.ctrlKey,\n altKey: sourceEvent.altKey,\n metaKey: sourceEvent.metaKey\n }));\n}","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { error } from '@base-ui/utils/error';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { makeEventPreventable, mergeProps } from \"../../merge-props/index.mjs\";\nimport { useCompositeRootContext } from \"../composite/root/CompositeRootContext.mjs\";\nimport { useFocusableWhenDisabled } from \"../../utils/useFocusableWhenDisabled.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nexport function useButton(parameters = {}) {\n const {\n disabled = false,\n focusableWhenDisabled,\n tabIndex = 0,\n native: isNativeButton = true,\n composite: compositeProp\n } = parameters;\n const elementRef = React.useRef(null);\n const compositeRootContext = useCompositeRootContext(true);\n const isCompositeItem = compositeProp ?? compositeRootContext !== undefined;\n const {\n props: focusableWhenDisabledProps\n } = useFocusableWhenDisabled({\n focusableWhenDisabled,\n disabled,\n composite: isCompositeItem,\n tabIndex,\n isNativeButton\n });\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n const isButtonTag = isButtonElement(elementRef.current);\n if (isNativeButton) {\n if (!isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a native <button> because the ' + '`nativeButton` prop is true. Rendering a non-<button> removes native button ' + 'semantics, which can impact forms and accessibility. Use a real <button> in the ' + '`render` prop, or set `nativeButton` to `false`.';\n error(`${message}${ownerStackMessage}`);\n }\n } else if (isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a non-<button> because the `nativeButton` ' + 'prop is false. Rendering a <button> keeps native behavior while Base UI applies ' + 'non-native attributes and handlers, which can add unintended extra attributes (such ' + 'as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set ' + '`nativeButton` to `true`.';\n error(`${message}${ownerStackMessage}`);\n }\n }, [isNativeButton]);\n }\n\n // handles a disabled composite button rendering another button, e.g.\n // <Toolbar.Button disabled render={<Menu.Trigger />} />\n // the `disabled` prop needs to pass through 2 `useButton`s then finally\n // delete the `disabled` attribute from DOM\n const updateDisabled = React.useCallback(() => {\n const element = elementRef.current;\n if (!isButtonElement(element)) {\n return;\n }\n if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === undefined && element.disabled) {\n element.disabled = false;\n }\n }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);\n useIsoLayoutEffect(updateDisabled, [updateDisabled]);\n const getButtonProps = React.useCallback((externalProps = {}) => {\n const {\n onClick: externalOnClick,\n onMouseDown: externalOnMouseDown,\n onKeyUp: externalOnKeyUp,\n onKeyDown: externalOnKeyDown,\n onPointerDown: externalOnPointerDown,\n ...otherExternalProps\n } = externalProps;\n return mergeProps({\n onClick(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnClick?.(event);\n },\n onMouseDown(event) {\n if (!disabled) {\n externalOnMouseDown?.(event);\n }\n },\n onKeyDown(event) {\n if (disabled) {\n return;\n }\n makeEventPreventable(event);\n externalOnKeyDown?.(event);\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const isCurrentTarget = event.target === event.currentTarget;\n const currentTarget = event.currentTarget;\n const isButton = isButtonElement(currentTarget);\n const isLink = !isNativeButton && isValidLinkElement(currentTarget);\n const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);\n const isEnterKey = event.key === 'Enter';\n const isSpaceKey = event.key === ' ';\n const role = currentTarget.getAttribute('role');\n const isTextNavigationRole = role?.startsWith('menuitem') || role === 'option' || role === 'gridcell';\n if (isCurrentTarget && isCompositeItem && isSpaceKey) {\n if (event.defaultPrevented && isTextNavigationRole) {\n return;\n }\n event.preventDefault();\n\n // Only a native-mode item that isn't a real <button> is excluded.\n if (!isNativeButton || isButton) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n return;\n }\n\n // Keyboard accessibility for native and non-native elements.\n if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {\n // Space activates links on keyup (`role=\"button\"` semantics, matching the\n // composite path); prevent the page scroll Space would otherwise trigger.\n // Enter is left to the browser's native link activation.\n if (isCurrentTarget && isLink && isSpaceKey) {\n event.preventDefault();\n }\n return;\n }\n\n // Match native buttons: preventing the keydown's default cancels activation.\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n if (isEnterKey) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n },\n onKeyUp(event) {\n if (disabled) {\n return;\n }\n\n // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed\n // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0\n makeEventPreventable(event);\n externalOnKeyUp?.(event);\n if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === ' ') {\n event.preventDefault();\n return;\n }\n if (event.baseUIHandlerPrevented) {\n return;\n }\n\n // Keyboard accessibility for non interactive elements.\n // Match native buttons: preventing the keyup's default cancels Space activation.\n // Limitation: unlike a native <button>, a prevented *keydown* cannot cancel the\n // activation — no state is kept between keydown and keyup, so we can't tell\n // whether the keydown was prevented or even happened on this element.\n if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === ' ') {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(event.currentTarget, event);\n }\n },\n onPointerDown(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnPointerDown?.(event);\n }\n }, isNativeButton ? {\n type: 'button'\n } : {\n role: 'button'\n }, focusableWhenDisabledProps, otherExternalProps);\n }, [disabled, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);\n const buttonRef = useStableCallback(element => {\n elementRef.current = element;\n updateDisabled();\n });\n return {\n getButtonProps,\n buttonRef\n };\n}\nfunction isButtonElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'BUTTON';\n}\nfunction isValidLinkElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'A' && Boolean(elem.href);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SwitchRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SwitchRootContext.displayName = \"SwitchRootContext\";\nexport function useSwitchRootContext() {\n const context = React.useContext(SwitchRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>.' : _formatErrorMessage(63));\n }\n return context;\n}","export const DEFAULT_VALIDITY_STATE = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: null,\n valueMissing: false\n};\nexport const DEFAULT_FIELD_STATE_ATTRIBUTES = {\n valid: null,\n touched: false,\n dirty: false,\n filled: false,\n focused: false\n};\nexport const DEFAULT_FIELD_ROOT_STATE = {\n disabled: false,\n ...DEFAULT_FIELD_STATE_ATTRIBUTES\n};\nexport const fieldValidityMapping = {\n valid(value) {\n if (value === null) {\n return null;\n }\n if (value) {\n return {\n 'data-valid': ''\n };\n }\n return {\n 'data-invalid': ''\n };\n }\n};","import { fieldValidityMapping } from \"../internals/field-constants/constants.mjs\";\nexport const stateAttributesMapping = {\n ...fieldValidityMapping,\n checked(value) {\n if (value) {\n return {\n 'data-checked': ''\n };\n }\n return {\n 'data-unchecked': ''\n };\n }\n};","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { NOOP } from \"../noop.mjs\";\nimport { DEFAULT_FIELD_ROOT_STATE, DEFAULT_VALIDITY_STATE } from \"../field-constants/constants.mjs\";\nexport const DEFAULT_FIELD_ROOT_CONTEXT = {\n invalid: undefined,\n name: undefined,\n validityData: {\n state: DEFAULT_VALIDITY_STATE,\n errors: [],\n error: '',\n value: '',\n initialValue: null\n },\n setValidityData: NOOP,\n disabled: undefined,\n setTouched: NOOP,\n setDirty: NOOP,\n setFilled: NOOP,\n setFocused: NOOP,\n validationMode: 'onSubmit',\n shouldValidateOnChange: () => false,\n state: DEFAULT_FIELD_ROOT_STATE,\n registerFieldControl: NOOP,\n validation: {\n getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,\n inputRef: {\n current: null\n },\n registeredInputs: new Map(),\n registerInput: NOOP,\n getInputControl: () => null,\n commit: async () => {},\n change: NOOP\n }\n};\nexport const FieldRootContext = /*#__PURE__*/React.createContext(DEFAULT_FIELD_ROOT_CONTEXT);\nif (process.env.NODE_ENV !== \"production\") FieldRootContext.displayName = \"FieldRootContext\";\nexport function useFieldRootContext(optional = true) {\n const context = React.useContext(FieldRootContext);\n if (context.setValidityData === NOOP && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.' : _formatErrorMessage(28));\n }\n return context;\n}","'use client';\n\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useFieldRootContext } from \"../field-root-context/FieldRootContext.mjs\";\nexport function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {\n const {\n registerFieldControl\n } = useFieldRootContext();\n const sourceRef = useRefWithInit(() => Symbol());\n\n // Re-register without unregistering first: re-registration with the same id updates the\n // form's fields Map entry in place, while a delete + re-add would move the field to the\n // end of the Map every time its value changes.\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n if (!enabled) {\n registerFieldControl(source, undefined);\n return;\n }\n const registration = {\n controlRef,\n getValue: getFormValueOverride,\n id,\n name,\n value\n };\n registerFieldControl(source, registration);\n }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n return () => {\n registerFieldControl(source, undefined);\n };\n }, [registerFieldControl, sourceRef]);\n}","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\nexport const FormContext = /*#__PURE__*/React.createContext({\n elementRef: {\n current: null\n },\n formRef: {\n current: {\n fields: new Map()\n }\n },\n errors: {},\n clearErrors: NOOP,\n validationMode: 'onSubmit',\n submitAttemptedRef: {\n current: false\n }\n});\nif (process.env.NODE_ENV !== \"production\") FormContext.displayName = \"FormContext\";\nexport function useFormContext() {\n return React.useContext(FormContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\n/**\n * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\\\n * with an accessible name (label) and description.\n */\nexport const LabelableContext = /*#__PURE__*/React.createContext({\n controlId: undefined,\n registerControlId: NOOP,\n labelId: undefined,\n setLabelId: NOOP,\n messageIds: [],\n setMessageIds: NOOP,\n getDescriptionProps: externalProps => externalProps\n});\nif (process.env.NODE_ENV !== \"production\") LabelableContext.displayName = \"LabelableContext\";\nexport function useLabelableContext() {\n return React.useContext(LabelableContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../useBaseUiId.mjs\";\nexport function useAriaLabelledBy(explicitAriaLabelledBy, labelId, labelSourceRef, enableFallback = true, labelSourceId) {\n const [fallbackAriaLabelledBy, setFallbackAriaLabelledBy] = React.useState();\n const generatedLabelId = useBaseUiId(labelSourceId ? `${labelSourceId}-label` : undefined);\n const ariaLabelledBy = explicitAriaLabelledBy ?? labelId ?? fallbackAriaLabelledBy;\n\n // Fallback for <span> controls labelled by wrapping/sibling native <label>.\n // Run after every commit so DOM association changes (e.g. label mount/unmount)\n // are reflected even when props/state deps are unchanged.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(() => {\n const nextAriaLabelledBy = explicitAriaLabelledBy || labelId || !enableFallback ? undefined : getAriaLabelledBy(labelSourceRef.current, generatedLabelId);\n if (fallbackAriaLabelledBy !== nextAriaLabelledBy) {\n setFallbackAriaLabelledBy(nextAriaLabelledBy);\n }\n });\n return ariaLabelledBy;\n}\nfunction getAriaLabelledBy(labelSource, generatedLabelId) {\n const label = findAssociatedLabel(labelSource);\n if (!label) {\n return undefined;\n }\n if (!label.id && generatedLabelId) {\n label.id = generatedLabelId;\n }\n return label.id || undefined;\n}\nfunction findAssociatedLabel(labelSource) {\n if (!labelSource) {\n return undefined;\n }\n\n // Fast path before the expensive `.labels` read.\n const parent = labelSource.parentElement;\n if (parent && parent.tagName === 'LABEL') {\n return parent;\n }\n const controlId = labelSource.id;\n if (controlId) {\n const nextSibling = labelSource.nextElementSibling;\n if (nextSibling && nextSibling.htmlFor === controlId) {\n return nextSibling;\n }\n }\n const labels = labelSource.labels;\n return labels && labels[0];\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { NOOP } from \"../noop.mjs\";\nimport { useBaseUiId } from \"../useBaseUiId.mjs\";\nimport { useLabelableContext } from \"./LabelableContext.mjs\";\nexport function useLabelableId(params = {}) {\n const {\n id,\n implicit = false,\n controlRef\n } = params;\n const {\n controlId,\n registerControlId\n } = useLabelableContext();\n const defaultId = useBaseUiId(id);\n const controlIdForEffect = implicit ? controlId : undefined;\n const controlSourceRef = useRefWithInit(() => Symbol());\n const hasRegisteredRef = React.useRef(false);\n const hadExplicitIdRef = React.useRef(id != null);\n const unregisterControlId = useStableCallback(() => {\n if (!hasRegisteredRef.current || registerControlId === NOOP) {\n return;\n }\n hasRegisteredRef.current = false;\n registerControlId(controlSourceRef.current, undefined);\n });\n useIsoLayoutEffect(() => {\n if (registerControlId === NOOP) {\n return undefined;\n }\n let nextId;\n if (implicit) {\n const elem = controlRef?.current;\n if (isElement(elem) && elem.closest('label') != null) {\n nextId = id ?? null;\n } else {\n nextId = controlIdForEffect ?? defaultId;\n }\n } else if (id != null) {\n hadExplicitIdRef.current = true;\n nextId = id;\n } else if (hadExplicitIdRef.current) {\n nextId = defaultId;\n } else {\n unregisterControlId();\n return undefined;\n }\n if (nextId === undefined) {\n unregisterControlId();\n return undefined;\n }\n hasRegisteredRef.current = true;\n registerControlId(controlSourceRef.current, nextId);\n return undefined;\n }, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);\n React.useEffect(() => {\n return unregisterControlId;\n }, [unregisterControlId]);\n return controlId ?? defaultId;\n}","export const none = 'none';\nexport const triggerPress = 'trigger-press';\nexport const triggerHover = 'trigger-hover';\nexport const triggerFocus = 'trigger-focus';\nexport const outsidePress = 'outside-press';\nexport const itemPress = 'item-press';\nexport const closePress = 'close-press';\nexport const linkPress = 'link-press';\nexport const clearPress = 'clear-press';\nexport const chipRemovePress = 'chip-remove-press';\nexport const trackPress = 'track-press';\nexport const incrementPress = 'increment-press';\nexport const decrementPress = 'decrement-press';\nexport const inputChange = 'input-change';\nexport const inputClear = 'input-clear';\nexport const inputBlur = 'input-blur';\nexport const inputPaste = 'input-paste';\nexport const inputPress = 'input-press';\nexport const focusOut = 'focus-out';\nexport const escapeKey = 'escape-key';\nexport const closeWatcher = 'close-watcher';\nexport const listNavigation = 'list-navigation';\nexport const keyboard = 'keyboard';\nexport const pointer = 'pointer';\nexport const drag = 'drag';\nexport const wheel = 'wheel';\nexport const scrub = 'scrub';\nexport const cancelOpen = 'cancel-open';\nexport const siblingOpen = 'sibling-open';\nexport const disabled = 'disabled';\nexport const missing = 'missing';\nexport const initial = 'initial';\nexport const imperativeAction = 'imperative-action';\nexport const swipe = 'swipe';\nexport const windowResize = 'window-resize';","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { REASONS } from \"./reasons.mjs\";\n\n/**\n * Maps a change `reason` string to the corresponding native event type.\n */\n\n/**\n * Details of custom change events emitted by Base UI components.\n */\n\n/**\n * Details of custom generic events emitted by Base UI components.\n */\n\n/**\n * Creates a Base UI event details object with the given reason and utilities\n * for preventing Base UI's internal event handling.\n */\nexport function createChangeEventDetails(reason, event, trigger, customProperties) {\n let canceled = false;\n let allowPropagation = false;\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n cancel() {\n canceled = true;\n },\n allowPropagation() {\n allowPropagation = true;\n },\n get isCanceled() {\n return canceled;\n },\n get isPropagationAllowed() {\n return allowPropagation;\n },\n trigger,\n ...custom\n };\n return details;\n}\nexport function createGenericEventDetails(reason, event, customProperties) {\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n ...custom\n };\n return details;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport function useValueChanged(value, onChange) {\n const valueRef = React.useRef(value);\n const onChangeCallback = useStableCallback(onChange);\n useIsoLayoutEffect(() => {\n if (valueRef.current !== value) {\n onChangeCallback(valueRef.current);\n }\n valueRef.current = value;\n }, [value, onChangeCallback]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { SwitchRootContext } from \"./SwitchRootContext.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\n\n/**\n * Represents the switch itself.\n * Renders a `<span>` element and a hidden `<input>` beside.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(componentProps, forwardedRef) {\n const {\n checked: checkedProp,\n className,\n defaultChecked,\n 'aria-labelledby': ariaLabelledByProp,\n form,\n id: idProp,\n inputRef: externalInputRef,\n name: nameProp,\n nativeButton = false,\n onCheckedChange,\n readOnly = false,\n required = false,\n disabled: disabledProp = false,\n render,\n uncheckedValue,\n value,\n style,\n ...elementProps\n } = componentProps;\n const {\n clearErrors\n } = useFormContext();\n const {\n state: fieldState,\n setTouched,\n setDirty,\n validityData,\n setFilled,\n setFocused,\n validationMode,\n disabled: fieldDisabled,\n name: fieldName,\n validation\n } = useFieldRootContext();\n const {\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const inputRef = React.useRef(null);\n const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);\n const switchRef = React.useRef(null);\n const id = useBaseUiId();\n const controlId = useLabelableId({\n id: idProp,\n implicit: false,\n controlRef: switchRef\n });\n const hiddenInputId = nativeButton ? undefined : controlId;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n useRegisterFieldControl(switchRef, id, checked, undefined, !disabled, nameProp);\n useIsoLayoutEffect(() => {\n if (inputRef.current) {\n setFilled(inputRef.current.checked);\n }\n }, [setFilled]);\n useValueChanged(checked, () => {\n clearErrors(name);\n setDirty(checked !== validityData.initialValue);\n setFilled(checked);\n validation.change(checked);\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId);\n const rootProps = {\n id: nativeButton ? controlId : id,\n role: 'switch',\n 'aria-checked': checked,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': ariaLabelledBy,\n onFocus() {\n if (!disabled) {\n setFocused(true);\n }\n },\n onBlur() {\n const element = inputRef.current;\n if (!element || disabled) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(element.checked);\n }\n },\n onClick(event) {\n if (readOnly || disabled) {\n return;\n }\n event.preventDefault();\n const input = inputRef.current;\n if (!input) {\n return;\n }\n dispatchClickWithModifiers(input, event);\n }\n };\n const inputProps = {\n ...validation.getValidationProps(disabled),\n checked,\n disabled,\n form,\n id: hiddenInputId,\n name,\n required,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n type: 'checkbox',\n 'aria-hidden': true,\n ref: handleInputRef,\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n if (readOnly) {\n event.preventDefault();\n return;\n }\n const nextChecked = event.currentTarget.checked;\n const eventDetails = createChangeEventDetails(REASONS.none, event.nativeEvent);\n onCheckedChange?.(nextChecked, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setCheckedState(nextChecked);\n },\n onClick(event) {\n // The click dispatched from the root's `onClick` is an implementation detail\n // and must not reach ancestors, which already receive the original click.\n event.stopPropagation();\n },\n onFocus() {\n switchRef.current?.focus();\n },\n // React <19 sets an empty value if `undefined` is passed explicitly\n // To avoid this, we only set the value if it's defined\n ...(value !== undefined ? {\n value\n } : EMPTY_OBJECT)\n };\n const state = React.useMemo(() => ({\n ...fieldState,\n checked,\n disabled,\n readOnly,\n required\n }), [fieldState, checked, disabled, readOnly, required]);\n const element = useRenderElement('span', componentProps, {\n state,\n ref: [forwardedRef, switchRef, buttonRef],\n props: [rootProps, elementProps, getButtonProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsxs(SwitchRootContext.Provider, {\n value: state,\n children: [element, !checked && name && uncheckedValue !== undefined && /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: uncheckedValue,\n disabled: disabled\n }), /*#__PURE__*/_jsx(\"input\", {\n ...inputProps,\n suppressHydrationWarning: true\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchRoot.displayName = \"SwitchRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useSwitchRootContext } from \"../root/SwitchRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\n\n/**\n * The movable part of the switch that indicates whether the switch is on or off.\n * Renders a `<span>`.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nexport const SwitchThumb = /*#__PURE__*/React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const state = useSwitchRootContext();\n return useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n stateAttributesMapping,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchThumb.displayName = \"SwitchThumb\";","import * as React from 'react';\nimport { Switch } from '@base-ui/react/switch';\nimport { TOK } from './styles.js';\n\nexport interface CapabilitySwitchOptions {\n readonly checked: boolean;\n readonly disabled: boolean;\n /** Dim the control while a write is in flight. */\n readonly busy: boolean;\n /** Accessible name; the caller translates it. */\n readonly label: string;\n readonly onCheckedChange: (checked: boolean) => void;\n}\n\n/**\n * The capability switch, in one place for both panels.\n *\n * The two panels each had their own copy, and the copies had already drifted:\n * the thumb was a circle in one and a pill in the other, with different\n * transition durations and shadows. Nobody noticed, which is the point --\n * \"how a control looks\" belongs to the design system, while \"what a row is\n * made of\" belongs to each panel, so only the latter is written twice.\n */\nexport function capabilitySwitch(options: CapabilitySwitchOptions): React.ReactElement {\n const inert = options.disabled || options.busy;\n return React.createElement(\n Switch.Root,\n {\n className: 'ci-switch',\n checked: options.checked,\n disabled: inert,\n 'aria-label': options.label,\n onCheckedChange: options.onCheckedChange,\n style: {\n position: 'relative',\n width: '32px',\n height: '18px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: options.checked ? TOK.switchOn : TOK.switchOff,\n cursor: inert ? 'not-allowed' : 'pointer',\n opacity: options.busy ? 0.65 : 1,\n flex: '0 0 auto',\n },\n },\n React.createElement(Switch.Thumb, {\n className: 'ci-thumb',\n style: {\n display: 'block',\n width: '14px',\n height: '14px',\n margin: '2px',\n borderRadius: '999px',\n background: TOK.switchThumb,\n boxShadow: '0 1px 2px rgba(0,0,0,.22)',\n transform: options.checked ? 'translateX(14px)' : 'translateX(0)',\n transition: `transform .12s ${TOK.switchEase}`,\n },\n }),\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY } from \"./empty.mjs\";\n\n/**\n * A React.useEffect equivalent that runs once, when the component is mounted.\n */\nexport function useOnMount(fn) {\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array\n /* eslint-disable react-hooks/exhaustive-deps */\n React.useEffect(fn, EMPTY_ARRAY);\n /* eslint-enable react-hooks/exhaustive-deps */\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\n/** Unlike `setTimeout`, rAF doesn't guarantee a positive integer return value, so we can't have\n * a monomorphic `uint` type with `0` meaning empty.\n * See warning note at:\n * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#return_value */\nconst EMPTY = null;\nlet LAST_RAF = globalThis.requestAnimationFrame;\nclass Scheduler {\n /* This implementation uses an array as a backing data-structure for frame callbacks.\n * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it\n * never calls the native `cancelAnimationFrame` if there are no frames left. This can\n * be much more efficient if there is a call pattern that alterns as\n * \"request-cancel-request-cancel-…\".\n * But in the case of \"request-request-…-cancel-cancel-…\", it leaves the final animation\n * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */\n\n callbacks = [];\n callbacksCount = 0;\n nextId = 1;\n startId = 1;\n isScheduled = false;\n tick = timestamp => {\n this.isScheduled = false;\n const currentCallbacks = this.callbacks;\n const currentCallbacksCount = this.callbacksCount;\n\n // Update these before iterating, callbacks could call `requestAnimationFrame` again.\n this.callbacks = [];\n this.callbacksCount = 0;\n this.startId = this.nextId;\n if (currentCallbacksCount > 0) {\n for (let i = 0; i < currentCallbacks.length; i += 1) {\n currentCallbacks[i]?.(timestamp);\n }\n }\n };\n request(fn) {\n const id = this.nextId;\n this.nextId += 1;\n this.callbacks.push(fn);\n this.callbacksCount += 1;\n\n /* In a test environment with fake timers, a fake `requestAnimationFrame` can be called\n * but there's no guarantee that the animation frame will actually run before the fake\n * timers are teared, which leaves `isScheduled` set, but won't run our `tick()`. */\n const didRAFChange = process.env.NODE_ENV !== 'production' && LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);\n if (!this.isScheduled || didRAFChange) {\n requestAnimationFrame(this.tick);\n this.isScheduled = true;\n }\n return id;\n }\n cancel(id) {\n const index = id - this.startId;\n if (index < 0 || index >= this.callbacks.length) {\n return;\n }\n this.callbacks[index] = null;\n this.callbacksCount -= 1;\n }\n}\nlet scheduler = new Scheduler();\n\n/**\n * Replaces the shared scheduler and drops all pending animation frame callbacks.\n *\n * For test environments only. The scheduler is process-global, so a callback scheduled in one test\n * but never run (e.g. requested under fake timers that were torn down before the frame fired) would\n * otherwise survive into a later test and run there against stale state. Call between tests to drop\n * such leftovers.\n */\nexport function resetAnimationFrameScheduler() {\n const previous = scheduler;\n scheduler = new Scheduler();\n // Continue the id sequence so `cancel()` calls from `AnimationFrame` instances created before the\n // reset cannot cancel callbacks scheduled after it.\n scheduler.nextId = previous.nextId;\n scheduler.startId = previous.nextId;\n // A frame requested before the reset may still be pending and holds the previous scheduler's\n // `tick`; empty its queue in place so that frame runs nothing when it eventually fires.\n previous.callbacks = [];\n previous.callbacksCount = 0;\n}\nexport class AnimationFrame {\n static create() {\n return new AnimationFrame();\n }\n static request(fn) {\n return scheduler.request(fn);\n }\n static cancel(id) {\n return scheduler.cancel(id);\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n request(fn) {\n this.cancel();\n this.currentId = scheduler.request(() => {\n this.currentId = EMPTY;\n fn();\n });\n }\n cancel = () => {\n if (this.currentId !== EMPTY) {\n scheduler.cancel(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.cancel;\n };\n}\n\n/**\n * A `requestAnimationFrame` with automatic cleanup and guard.\n */\nexport function useAnimationFrame() {\n const timeout = useRefWithInit(AnimationFrame.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\n/**\n * Provides a status string for CSS animations.\n * @param open - a boolean that determines if the element is open.\n * @param enableIdleState - a boolean that enables the `'idle'` state between `'starting'` and `'ending'`\n */\nexport function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {\n const [transitionStatus, setTransitionStatus] = React.useState(open && enableIdleState ? 'idle' : undefined);\n const [mounted, setMounted] = React.useState(open);\n if (open && !mounted) {\n setMounted(true);\n setTransitionStatus('starting');\n }\n if (!open && mounted && transitionStatus !== 'ending' && !deferEndingState) {\n setTransitionStatus('ending');\n }\n if (!open && !mounted && transitionStatus === 'ending') {\n setTransitionStatus(undefined);\n }\n useIsoLayoutEffect(() => {\n if (!open && mounted && transitionStatus !== 'ending' && deferEndingState) {\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('ending');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }\n return undefined;\n }, [open, mounted, transitionStatus, deferEndingState]);\n useIsoLayoutEffect(() => {\n if (!open || enableIdleState) {\n return undefined;\n }\n const frame = AnimationFrame.request(() => {\n // Avoid `flushSync` here due to Firefox.\n // See https://github.com/mui/base-ui/pull/3424\n setTransitionStatus(undefined);\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open]);\n useIsoLayoutEffect(() => {\n if (!open || !enableIdleState) {\n return undefined;\n }\n if (open && mounted && transitionStatus !== 'idle') {\n setTransitionStatus('starting');\n }\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('idle');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open, mounted, transitionStatus]);\n return {\n mounted,\n setMounted,\n transitionStatus\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nexport function useCollapsibleRoot(parameters) {\n const {\n open: openParam,\n defaultOpen,\n onOpenChange,\n disabled\n } = parameters;\n const [open, setOpen] = useControlled({\n controlled: openParam,\n default: defaultOpen,\n name: 'Collapsible',\n state: 'open'\n });\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open, true, true);\n const defaultPanelId = useBaseUiId();\n // `undefined` uses the initial generated fallback; `null` means the panel unmounted.\n const [registeredPanelId, setPanelIdState] = React.useState();\n const panelId = registeredPanelId === null ? undefined : registeredPanelId ?? defaultPanelId;\n const handleTrigger = useStableCallback(event => {\n const nextOpen = !open;\n const eventDetails = createChangeEventDetails(REASONS.triggerPress, event.nativeEvent);\n onOpenChange(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpen(nextOpen);\n });\n return React.useMemo(() => ({\n defaultPanelId,\n disabled,\n handleTrigger,\n mounted,\n open,\n panelId,\n setMounted,\n setOpen,\n setPanelIdState,\n transitionStatus\n }), [defaultPanelId, disabled, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CollapsibleRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CollapsibleRootContext.displayName = \"CollapsibleRootContext\";\nexport function useCollapsibleRootContext() {\n const context = React.useContext(CollapsibleRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.' : _formatErrorMessage(15));\n }\n return context;\n}","export let TransitionStatusDataAttributes = /*#__PURE__*/function (TransitionStatusDataAttributes) {\n /**\n * Present when the component begins animating in.\n */\n TransitionStatusDataAttributes[\"startingStyle\"] = \"data-starting-style\";\n /**\n * Present when the component is animating out.\n */\n TransitionStatusDataAttributes[\"endingStyle\"] = \"data-ending-style\";\n return TransitionStatusDataAttributes;\n}({});\nconst STARTING_HOOK = {\n 'data-starting-style': ''\n};\nconst ENDING_HOOK = {\n 'data-ending-style': ''\n};\nexport const transitionStatusMapping = {\n transitionStatus(value) {\n if (value === 'starting') {\n return STARTING_HOOK;\n }\n if (value === 'ending') {\n return ENDING_HOOK;\n }\n return null;\n }\n};","import { TransitionStatusDataAttributes } from \"../../internals/stateAttributesMapping.mjs\";\nexport let CollapsiblePanelDataAttributes = function (CollapsiblePanelDataAttributes) {\n /**\n * Present when the collapsible panel is open.\n */\n CollapsiblePanelDataAttributes[\"open\"] = \"data-open\";\n /**\n * Present when the collapsible panel is closed.\n */\n CollapsiblePanelDataAttributes[\"closed\"] = \"data-closed\";\n /**\n * Present when the panel begins animating in.\n */\n CollapsiblePanelDataAttributes[CollapsiblePanelDataAttributes[\"startingStyle\"] = TransitionStatusDataAttributes.startingStyle] = \"startingStyle\";\n /**\n * Present when the panel is animating out.\n */\n CollapsiblePanelDataAttributes[CollapsiblePanelDataAttributes[\"endingStyle\"] = TransitionStatusDataAttributes.endingStyle] = \"endingStyle\";\n return CollapsiblePanelDataAttributes;\n}({});","export let CollapsibleTriggerDataAttributes = /*#__PURE__*/function (CollapsibleTriggerDataAttributes) {\n /**\n * Present when the collapsible panel is open.\n */\n CollapsibleTriggerDataAttributes[\"panelOpen\"] = \"data-panel-open\";\n return CollapsibleTriggerDataAttributes;\n}({});","import { CollapsiblePanelDataAttributes } from \"../collapsible/panel/CollapsiblePanelDataAttributes.mjs\";\nimport { CollapsibleTriggerDataAttributes } from \"../collapsible/trigger/CollapsibleTriggerDataAttributes.mjs\";\nconst PANEL_OPEN_HOOK = {\n [CollapsiblePanelDataAttributes.open]: ''\n};\nconst PANEL_CLOSED_HOOK = {\n [CollapsiblePanelDataAttributes.closed]: ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return {\n [CollapsibleTriggerDataAttributes.panelOpen]: ''\n };\n }\n return null;\n }\n};\nexport const collapsibleOpenStateMapping = {\n open(value) {\n if (value) {\n return PANEL_OPEN_HOOK;\n }\n return PANEL_CLOSED_HOOK;\n }\n};","import { collapsibleOpenStateMapping as baseMapping } from \"../../utils/collapsibleOpenStateMapping.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nexport const collapsibleStateAttributesMapping = {\n ...baseMapping,\n ...transitionStatusMapping\n};","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCollapsibleRoot } from \"./useCollapsibleRoot.mjs\";\nimport { CollapsibleRootContext } from \"./CollapsibleRootContext.mjs\";\nimport { collapsibleStateAttributesMapping } from \"./stateAttributesMapping.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Groups all parts of the collapsible.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsibleRoot = /*#__PURE__*/React.forwardRef(function CollapsibleRoot(componentProps, forwardedRef) {\n const {\n render,\n className,\n defaultOpen = false,\n disabled = false,\n onOpenChange: onOpenChangeProp,\n open,\n style,\n ...elementProps\n } = componentProps;\n const onOpenChange = useStableCallback(onOpenChangeProp);\n const collapsible = useCollapsibleRoot({\n open,\n defaultOpen,\n onOpenChange,\n disabled\n });\n const state = React.useMemo(() => ({\n open: collapsible.open,\n disabled: collapsible.disabled,\n transitionStatus: collapsible.transitionStatus\n }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);\n const contextValue = React.useMemo(() => ({\n ...collapsible,\n onOpenChange,\n state\n }), [collapsible, onOpenChange, state]);\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: elementProps,\n stateAttributesMapping: collapsibleStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(CollapsibleRootContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") CollapsibleRoot.displayName = \"CollapsibleRoot\";","'use client';\n\nimport * as React from 'react';\nimport { triggerOpenStateMapping } from \"../../utils/collapsibleOpenStateMapping.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useCollapsibleRootContext } from \"../root/CollapsibleRootContext.mjs\";\nconst stateAttributesMapping = {\n ...triggerOpenStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A button that opens and closes the collapsible panel.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsibleTrigger = /*#__PURE__*/React.forwardRef(function CollapsibleTrigger(componentProps, forwardedRef) {\n const {\n panelId,\n open,\n handleTrigger,\n state,\n disabled: contextDisabled\n } = useCollapsibleRootContext();\n const {\n className,\n disabled = contextDisabled,\n render,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton\n });\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [{\n 'aria-controls': open ? panelId : undefined,\n 'aria-expanded': open,\n onClick: handleTrigger\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") CollapsibleTrigger.displayName = \"CollapsibleTrigger\";","/**\n * Adds an event listener and returns a cleanup function to remove it.\n */\n\nexport function addEventListener(target, type, listener, options) {\n target.addEventListener(type, listener, options);\n return () => {\n target.removeEventListener(type, listener, options);\n };\n}","'use client';\n\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Untracks the provided value by turning it into a ref to remove its reactivity.\n *\n * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.\n */\nexport function useValueAsRef(value) {\n const latest = useRefWithInit(createLatestRef, value).current;\n latest.next = value;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(latest.effect);\n return latest;\n}\nfunction createLatestRef(value) {\n const latest = {\n current: value,\n next: value,\n effect: () => {\n latest.current = latest.next;\n }\n };\n return latest;\n}","/**\n * If the provided argument is a ref object, returns its `current` value.\n * Otherwise, returns the argument itself.\n */\nexport function resolveRef(maybeRef) {\n if (maybeRef == null) {\n return maybeRef;\n }\n return 'current' in maybeRef ? maybeRef.current : maybeRef;\n}","'use client';\n\nimport * as ReactDOM from 'react-dom';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { resolveRef } from \"../utils/resolveRef.mjs\";\n\n/**\n * Executes a function once all animations have finished on the provided element.\n * If an animation is canceled, waits for any replacement animations before executing.\n * @param elementOrRef - The element to watch for animations.\n * @param waitForStartingStyleRemoved - Whether to wait for [data-starting-style] to be removed before checking for animations.\n * @returns A function that takes a callback to execute once all animations have finished, and an optional AbortSignal to abort the callback\n */\nexport function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false) {\n const frame = useAnimationFrame();\n return useStableCallback((fnToExecute,\n /**\n * An optional [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that\n * can be used to abort `fnToExecute` before all the animations have finished.\n * @default null\n */\n signal = null) => {\n frame.cancel();\n const element = resolveRef(elementOrRef);\n if (element == null) {\n return;\n }\n const resolvedElement = element;\n const done = () => {\n // Synchronously flush the unmounting of the component so that the browser doesn't\n // paint: https://github.com/mui/base-ui/issues/979\n ReactDOM.flushSync(fnToExecute);\n };\n if (typeof resolvedElement.getAnimations !== 'function' || globalThis.BASE_UI_ANIMATIONS_DISABLED) {\n fnToExecute();\n return;\n }\n function exec() {\n Promise.all(resolvedElement.getAnimations().map(animation => animation.finished)).then(() => {\n if (!signal?.aborted) {\n done();\n }\n }, () => {\n if (signal?.aborted) {\n return;\n }\n const currentAnimations = resolvedElement.getAnimations();\n if (currentAnimations.some(animation => animation.pending || animation.playState !== 'finished')) {\n // Sometimes animations can be aborted because a property they depend on changes while the animation plays.\n // In such cases, we need to re-check if any new animations have started.\n exec();\n return;\n }\n done();\n });\n }\n if (waitForStartingStyleRemoved) {\n const startingStyleAttribute = 'data-starting-style';\n\n // If `[data-starting-style]` isn't present, fall back to waiting one more frame\n // to give \"open\" animations a chance to be registered.\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n frame.request(exec);\n return;\n }\n\n // Wait for `[data-starting-style]` to have been removed.\n const attributeObserver = new MutationObserver(() => {\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n attributeObserver.disconnect();\n exec();\n }\n });\n attributeObserver.observe(resolvedElement, {\n attributes: true,\n attributeFilter: [startingStyleAttribute]\n });\n signal?.addEventListener('abort', () => attributeObserver.disconnect(), {\n once: true\n });\n return;\n }\n frame.request(exec);\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useAnimationsFinished } from \"./useAnimationsFinished.mjs\";\n\n/**\n * Calls the provided function when the CSS open/close animation or transition completes.\n */\nexport function useOpenChangeComplete(parameters) {\n const {\n enabled = true,\n open,\n ref,\n onComplete: onCompleteParam\n } = parameters;\n const onComplete = useStableCallback(onCompleteParam);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, open);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n const abortController = new AbortController();\n runOnceAnimationsFinish(onComplete, abortController.signal);\n return () => {\n abortController.abort();\n };\n }, [enabled, open, onComplete, runOnceAnimationsFinish]);\n}","'use client';\n\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { warn } from '@base-ui/utils/warn';\nimport { ownerWindow } from '@base-ui/utils/owner';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useAnimationsFinished } from \"../../internals/useAnimationsFinished.mjs\";\nimport { CollapsiblePanelDataAttributes } from \"./CollapsiblePanelDataAttributes.mjs\";\nconst EMPTY_DIMENSIONS = {\n height: undefined,\n width: undefined\n};\nexport function useCollapsiblePanel(parameters) {\n const {\n externalRef,\n hiddenUntilFound,\n id: idParam,\n keepMounted,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setOpen,\n transitionStatus\n } = parameters;\n const panelRef = React.useRef(null);\n const animationTypeRef = React.useRef(null);\n const [dimensions, setDimensionsUnwrapped] = React.useState(EMPTY_DIMENSIONS);\n const lastMeasuredDimensionsRef = React.useRef(EMPTY_DIMENSIONS);\n // `beforematch` should reveal the matched content immediately, so the next\n // open cycle skips author-defined motion once and then returns to normal.\n const shouldSkipNextOpenRef = React.useRef(false);\n // Keyframe mount animations on initially open panels cause a visible layout\n // shift during the server-rendered first paint, so suppress that first open\n // lifecycle until the panel has been closed once.\n const shouldPreventMountAnimationRef = React.useRef(open);\n // React.Activity tears down Effects while preserving state, so revealing an\n // already-open panel would otherwise replay its CSS keyframe open animation.\n const shouldPreventActivityResumeAnimationRef = React.useRef(false);\n // Some open paths intentionally bypass motion, but the shared root transition\n // status still advances asynchronously. Override the panel to idle so its data\n // attributes and dimension cleanup reflect the immediate open state.\n const [forcePanelIdle, setForcePanelIdle] = React.useState(false);\n const pendingTemporaryStyleRestoreRef = React.useRef(null);\n const mergedPanelRef = useMergedRefs(externalRef, panelRef);\n const latestOpenRef = useValueAsRef(open);\n // Only used to handle panel close\n const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef);\n const hidden = !open && !mounted;\n const panelTransitionStatus = forcePanelIdle ? 'idle' : transitionStatus;\n const shouldPreventOpenAnimation = open && (\n // These 2 refs are safe to read in render, they are only written from committed\n // layout/effect paths and gate one-shot motion suppression for the next open\n // lifecycle. They intentionally expose the last committed motion snapshot.\n shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current);\n const renderedDimensions = !open && mounted &&\n // These 2 refs are also safe to read in render, both hold the last committed\n // animation mode and measurement. This fallback only restores a previously\n // measured pixel size after the live dimensions state has been reset back to `auto`.\n animationTypeRef.current === 'css-animation' && dimensions.height === undefined && dimensions.width === undefined ? lastMeasuredDimensionsRef.current : dimensions;\n const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== 'css-animation';\n\n // Most measured dimensions are reused later when CSS keyframe closes need a\n // pixel size after the rendered dimensions have been reset back to `auto`.\n // Passing `false` is only for clearing the current dimensions state.\n const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => {\n if (shouldCacheMeasurement) {\n lastMeasuredDimensionsRef.current = nextDimensions;\n }\n setDimensionsUnwrapped(nextDimensions);\n });\n const restorePendingTemporaryStyle = useStableCallback(() => {\n pendingTemporaryStyleRestoreRef.current?.();\n pendingTemporaryStyleRestoreRef.current = null;\n });\n const setPendingTemporaryStyleRestore = useStableCallback(restore => {\n restorePendingTemporaryStyle();\n pendingTemporaryStyleRestoreRef.current = () => {\n pendingTemporaryStyleRestoreRef.current = null;\n restore();\n };\n });\n\n // React.Activity unmounts Effects while preserving component state. If that\n // teardown happens while an already-open keyframe panel is visible, remember\n // to suppress the replayed open animation on the next committed reveal.\n const markActivityResumeAnimationSuppressed = useStableCallback(() => {\n if (open && mounted && animationTypeRef.current === 'css-animation') {\n shouldPreventActivityResumeAnimationRef.current = true;\n }\n });\n useIsoLayoutEffect(() => {\n // `forcePanelIdle` is only a temporary override for open paths that skip\n // motion. Keep it active while the shared root still reports `starting`,\n // then drop it once the root transition state catches up.\n if (!forcePanelIdle || transitionStatus === 'starting') {\n return;\n }\n setForcePanelIdle(false);\n }, [forcePanelIdle, transitionStatus]);\n React.useEffect(() => {\n return () => {\n markActivityResumeAnimationSuppressed();\n restorePendingTemporaryStyle();\n };\n }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]);\n useIsoLayoutEffect(() => {\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n\n // `beforematch` can temporarily force a `0s` motion duration so the matched\n // content reveals immediately. Restore the authored duration before detecting\n // the next close animation type, otherwise that first close is misread as\n // \"no motion\" and the close transition or keyframe gets skipped.\n if (!open && pendingTemporaryStyleRestoreRef.current) {\n restorePendingTemporaryStyle();\n }\n const animationType = getAnimationType(panel, shouldPreventOpenAnimation);\n animationTypeRef.current = animationType;\n\n // Initially open keyframe panels skip their first paint animation to avoid\n // layout shift, but we still need to cache the expanded size so the first\n // close animation can start from pixels instead of `auto`.\n if (open && transitionStatus === 'idle' && shouldPreventMountAnimationRef.current && animationType === 'css-animation') {\n lastMeasuredDimensionsRef.current = getDimensions(panel);\n return undefined;\n }\n\n // Handle the opening pass: measure the expanded size and, when necessary,\n // neutralize author-defined motion so the panel can open immediately.\n if (open && transitionStatus === 'starting') {\n // `beforematch` opens should reveal the panel immediately so find-in-page\n // does not wait for the author-defined transition or animation to finish.\n const skipNextOpen = shouldSkipNextOpenRef.current;\n shouldSkipNextOpenRef.current = false;\n if (animationType === 'none') {\n setDimensions(getDimensions(panel));\n setForcePanelIdle(true);\n return undefined;\n }\n if (animationType === 'css-transition') {\n const restoreLayoutStyles = resetLayoutStyles(panel);\n setDimensions(getDimensions(panel));\n if (!skipNextOpen) {\n return restoreLayoutStyles;\n }\n const restoreTransitionDuration = setTemporaryStyle(panel, 'transition-duration', '0s');\n setPendingTemporaryStyleRestore(restoreTransitionDuration);\n setForcePanelIdle(true);\n return restoreLayoutStyles;\n }\n setDimensions(getDimensions(panel));\n const restoreAnimationName = setTemporaryStyle(panel, 'animation-name', 'none');\n if (!skipNextOpen) {\n restoreAnimationName();\n return undefined;\n }\n const restoreAnimationDuration = setTemporaryStyle(panel, 'animation-duration', '0s');\n restoreAnimationName();\n setPendingTemporaryStyleRestore(restoreAnimationDuration);\n setForcePanelIdle(true);\n return undefined;\n }\n\n // Capture the current size as soon as close is requested, before the\n // deferred ending phase applies closed styles. This keeps close transitions\n // starting from a measured pixel value, including interrupted opens.\n if (!open && mounted && (transitionStatus === 'idle' || transitionStatus === 'starting')) {\n shouldPreventMountAnimationRef.current = false;\n shouldPreventActivityResumeAnimationRef.current = false;\n if (animationType === 'none') {\n setDimensions(EMPTY_DIMENSIONS, false);\n setMounted(false);\n return undefined;\n }\n setDimensions(getDimensions(panel));\n return undefined;\n }\n if (transitionStatus !== 'ending') {\n return undefined;\n }\n\n // Reachable when `transitionStatus` already flipped to `ending` before this effect ran, so\n // the close branch above was skipped. Without motion there is nothing to wait for, so unmount\n // here instead of deferring to the animation-finished path below.\n if (animationType === 'none') {\n setMounted(false);\n return undefined;\n }\n const nextDimensions = getDimensions(panel);\n const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0;\n if (!hasMeasuredSize) {\n setMounted(false);\n return undefined;\n }\n setDimensions(nextDimensions);\n if (animationType === 'css-animation') {\n const restoreAnimationName = setTemporaryStyle(panel, 'animation-name', 'none');\n restoreAnimationName();\n }\n return undefined;\n }, [mounted, open, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]);\n useOpenChangeComplete({\n enabled: open && mounted && panelTransitionStatus === 'idle',\n open: true,\n ref: panelRef,\n onComplete() {\n // `useOpenChangeComplete` only aborts from its effect cleanup, which React runs in the\n // post-paint passive flush. An animation's `finished` microtask can resolve after the render\n // that set `open` to `false` but before that cleanup, so re-check the latest value here.\n // Clearing the measured size in that window would make the close transition start from\n // `height: 0` instead of the expanded pixel height.\n if (!open) {\n return;\n }\n setDimensions(EMPTY_DIMENSIONS, false);\n }\n });\n\n // Closing panels need extra sequencing beyond `useOpenChangeComplete`.\n // This passive effect runs after the `ending` render has committed, so\n // `[data-ending-style]` is already present. Chrome can still register the\n // exit transition one frame later when an Accordion closes one item while\n // opening another, so wait one frame before watching animations.\n // See https://github.com/mui/base-ui/issues/3099\n React.useEffect(() => {\n if (open || !mounted || panelTransitionStatus !== 'ending') {\n return undefined;\n }\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n const abortController = new AbortController();\n let endingStyleFrame = -1;\n function handleComplete() {\n // Same post-paint race as the `useOpenChangeComplete` callback above, except `open` is\n // captured by this effect's closure and always `false` here, so read the latest value from\n // a ref. Unmounting a panel that has already reopened would drop it from the DOM.\n if (latestOpenRef.current) {\n return;\n }\n setMounted(false);\n setDimensions(EMPTY_DIMENSIONS, false);\n }\n endingStyleFrame = AnimationFrame.request(() => {\n runOnceCloseAnimationsFinish(handleComplete, abortController.signal);\n });\n return () => {\n AnimationFrame.cancel(endingStyleFrame);\n abortController.abort();\n };\n }, [latestOpenRef, mounted, open, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]);\n useIsoLayoutEffect(() => {\n const panel = panelRef.current;\n if (!panel || !hiddenUntilFound || !hidden) {\n return;\n }\n\n // React only supports a boolean for the `hidden` attribute and forces\n // legit string values to booleans so we have to force it back in the DOM\n // when necessary: https://github.com/react/react/issues/24740\n panel.setAttribute('hidden', 'until-found');\n }, [hidden, hiddenUntilFound]);\n React.useEffect(function registerBeforeMatchListener() {\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n function handleBeforeMatch(event) {\n const eventDetails = createChangeEventDetails(REASONS.none, event);\n onOpenChange(true, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n shouldSkipNextOpenRef.current = true;\n setOpen(true);\n }\n return addEventListener(panel, 'beforematch', handleBeforeMatch);\n }, [onOpenChange, setOpen]);\n const shouldRender = keepMounted || hiddenUntilFound || mounted || open;\n return {\n height: renderedDimensions.height,\n props: {\n ...(shouldPersistHiddenTransitionStyles ? {\n [CollapsiblePanelDataAttributes.startingStyle]: ''\n } : undefined),\n hidden,\n id: idParam\n },\n ref: mergedPanelRef,\n shouldPreventOpenAnimation,\n shouldRender,\n transitionStatus: panelTransitionStatus,\n width: renderedDimensions.width\n };\n}\nfunction getDimensions(element) {\n return {\n height: element.scrollHeight,\n width: element.scrollWidth\n };\n}\nfunction getAnimationType(element, hasSuppressedMountAnimation) {\n const panelStyles = ownerWindow(element).getComputedStyle(element);\n const hasAnimation = (panelStyles.animationName.split(',').map(name => name.trim()).some(name => name !== '' && name !== 'none') || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration);\n const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration);\n if (hasAnimation && hasTransition) {\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n warn('CSS transitions and CSS animations both detected on Collapsible or Accordion panel.', 'Only one of either animation type should be used.');\n }\n return 'css-transition';\n }\n if (hasTransition) {\n return 'css-transition';\n }\n if (hasAnimation) {\n return 'css-animation';\n }\n return 'none';\n}\nfunction hasNonZeroDuration(value) {\n return value.split(',').map(part => part.trim()).some(part => part !== '' && Number.parseFloat(part) > 0);\n}\n\n/**\n * Temporarily overrides an inline style property and returns a cleanup that\n * restores the previous inline value and priority.\n * @param element - The element whose inline style should be updated.\n * @param property - The CSS property name to override.\n * @param value - The temporary value to assign.\n * @returns A cleanup function that restores the original inline style state.\n */\nfunction setTemporaryStyle(element, property, value) {\n const previousValue = element.style.getPropertyValue(property);\n const previousPriority = element.style.getPropertyPriority(property);\n element.style.setProperty(property, value);\n return () => {\n if (previousValue === '') {\n element.style.removeProperty(property);\n return;\n }\n element.style.setProperty(property, previousValue, previousPriority);\n };\n}\n\n/**\n * Temporarily resets inline alignment styles that can distort scroll-based\n * size measurements, then restores them on the next animation frame.\n * @param element - The panel element being measured.\n * @returns A cleanup function that cancels the scheduled restore and reapplies\n * the original inline layout styles immediately.\n */\nfunction resetLayoutStyles(element) {\n const originalLayoutStyles = {\n 'justify-content': element.style.justifyContent,\n 'align-items': element.style.alignItems,\n 'align-content': element.style.alignContent,\n 'justify-items': element.style.justifyItems\n };\n Object.keys(originalLayoutStyles).forEach(key => {\n element.style.setProperty(key, 'initial', 'important');\n });\n function restoreLayoutStyles() {\n Object.entries(originalLayoutStyles).forEach(([key, value]) => {\n if (value === '') {\n element.style.removeProperty(key);\n return;\n }\n element.style.setProperty(key, value);\n });\n }\n const frame = AnimationFrame.request(restoreLayoutStyles);\n return () => {\n AnimationFrame.cancel(frame);\n restoreLayoutStyles();\n };\n}","export let CollapsiblePanelCssVars = /*#__PURE__*/function (CollapsiblePanelCssVars) {\n /**\n * The collapsible panel's height.\n * @type {number}\n */\n CollapsiblePanelCssVars[\"collapsiblePanelHeight\"] = \"--collapsible-panel-height\";\n /**\n * The collapsible panel's width.\n * @type {number}\n */\n CollapsiblePanelCssVars[\"collapsiblePanelWidth\"] = \"--collapsible-panel-width\";\n return CollapsiblePanelCssVars;\n}({});","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { warn } from '@base-ui/utils/warn';\nimport { resolveStyle } from \"../../utils/resolveStyle.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCollapsibleRootContext } from \"../root/CollapsibleRootContext.mjs\";\nimport { collapsibleStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useCollapsiblePanel } from \"./useCollapsiblePanel.mjs\";\nimport { CollapsiblePanelCssVars } from \"./CollapsiblePanelCssVars.mjs\";\n/**\n * A panel with the collapsible contents.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsiblePanel = /*#__PURE__*/React.forwardRef(function CollapsiblePanel(componentProps, forwardedRef) {\n const {\n className,\n hiddenUntilFound: hiddenUntilFoundProp,\n keepMounted: keepMountedProp,\n render,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hiddenUntilFoundProp && keepMountedProp === false) {\n warn('The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.');\n }\n }, [hiddenUntilFoundProp, keepMountedProp]);\n }\n const {\n defaultPanelId,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setPanelIdState,\n setOpen,\n state,\n transitionStatus\n } = useCollapsibleRootContext();\n const hiddenUntilFound = hiddenUntilFoundProp ?? false;\n const keepMounted = keepMountedProp ?? false;\n const registeredId = idProp || undefined;\n const id = registeredId ?? defaultPanelId;\n useIsoLayoutEffect(() => {\n setPanelIdState(currentId => registeredId ?? (currentId === null ? undefined : currentId));\n return () => {\n setPanelIdState(currentId => currentId === registeredId ? null : currentId);\n };\n }, [registeredId, setPanelIdState]);\n const {\n height,\n props,\n ref,\n shouldPreventOpenAnimation,\n shouldRender,\n transitionStatus: panelTransitionStatus,\n width\n } = useCollapsiblePanel({\n externalRef: forwardedRef,\n hiddenUntilFound,\n id,\n keepMounted,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setOpen,\n transitionStatus\n });\n const panelState = {\n ...state,\n transitionStatus: panelTransitionStatus\n };\n const resolvedStyle = resolveStyle(style, panelState);\n const element = useRenderElement('div', {\n ...componentProps,\n style: undefined\n }, {\n state: panelState,\n ref,\n props: [props, {\n style: {\n [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === undefined ? 'auto' : `${height}px`,\n [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === undefined ? 'auto' : `${width}px`\n }\n }, elementProps, resolvedStyle ? {\n style: resolvedStyle\n } : undefined,\n // Resolve the public `style` prop so temporary `animationName: 'none'`\n // can still win after user's inline styles have been merged.\n shouldPreventOpenAnimation ? {\n style: {\n animationName: 'none'\n }\n } : undefined],\n stateAttributesMapping: collapsibleStateAttributesMapping\n });\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") CollapsiblePanel.displayName = \"CollapsiblePanel\";","/**\n * Reads `navigator.userAgent` / `navigator.platform` (legacy but universally\n * supported) into a normalized shape. In development, prefers the modern\n * `navigator.userAgentData` API on Chromium to avoid DevTools warnings about\n * the deprecated reads; that branch is dead-code-eliminated in production\n * builds to keep the bundle small.\n *\n * Returns empty/zero values when `navigator` is undefined (SSR), so every\n * derived flag safely evaluates to `false`.\n */\nfunction readRawData() {\n if (typeof navigator === 'undefined') {\n return {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return {\n userAgent: uaData.brands.map(({\n brand,\n version\n }) => `${brand}/${version}`).join(' '),\n platform: uaData.platform ?? navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n }\n }\n return {\n userAgent: navigator.userAgent,\n platform: navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n}\nconst {\n userAgent,\n platform,\n maxTouchPoints\n} = readRawData();\nexport const lowerUserAgent = userAgent.toLowerCase();\nexport const lowerPlatform = platform.toLowerCase();\nexport { maxTouchPoints };","import { lowerUserAgent, lowerPlatform, maxTouchPoints } from \"./shared.mjs\";\n\n// iPadOS 13+ reports `MacIntel` for `navigator.platform`; disambiguated via\n// `maxTouchPoints` so iPad is classified as iOS, not macOS.\n// https://github.com/mui/base-ui/issues/1309\n/** iPhone, iPad (including iPadOS 13+ reporting as macOS), iPod. */\nexport const ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === 'macintel' && maxTouchPoints > 1;\n\n/** Android phones, tablets, and embedded Android browsers. */\nconst ANDROID_STRING = 'android';\nexport const android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);\n\n/** macOS desktop. Excludes iPadOS, which reports as `MacIntel`. */\nexport const mac = !ios && lowerPlatform.startsWith('mac');\n\n/** Windows desktop. */\nexport const windows = lowerPlatform.startsWith('win');\n\n/** Linux desktop (including Chrome OS). */\nexport const linux = !android && /^(linux|chrome os)/.test(lowerPlatform);\n\n/** Any Apple OS (`mac || ios`). */\nexport const apple = mac || ios;","import { lowerUserAgent } from \"./shared.mjs\";\n\n// WebKit (Safari, all iOS browsers, GNOME Web). Distinguished from Blink by\n// the legacy `-webkit-backdrop-filter` name — Blink forked from WebKit in 2013\n// and only ships the unprefixed `backdrop-filter`.\n/** WebKit: Safari, all iOS browsers, GNOME Web. Excludes Blink. */\nexport const webkit = typeof CSS !== 'undefined' && !!CSS.supports?.('-webkit-backdrop-filter:none');\n\n// Anchored to `!webkit` so engines are mutually exclusive by construction.\n// Firefox-on-iOS uses WebKit (its UA marker is `FxiOS/`, not `Firefox/`); the\n// `!webkit` prefix also defends against future iOS-browser UA changes that\n// might inject `Firefox` into a WebKit-based UA.\n/** Gecko: Firefox. */\nexport const gecko = !webkit && lowerUserAgent.includes('firefox');\n\n// All Chromium-based browsers ship `Chrome/` or `Chromium/` in their UA — both\n// share the `chrom` prefix, so a single substring check covers Chrome, Edge,\n// Opera, Brave, etc. Chrome-on-iOS uses `CriOS/` and stays WebKit. The positive\n// UA check also makes this SSR-safe — an empty UA matches nothing.\n/** Blink: Chrome, Edge, Opera, Brave, and other Chromium-based browsers. */\nexport const blink = !webkit && lowerUserAgent.includes('chrom');","import { apple } from \"./os.mjs\";\n\n// Whether a screen reader is *actually* running cannot be detected. These flags\n// identify platforms where a specific screen reader could be active. VoiceOver\n// is the system screen reader on Apple platforms and works with every browser\n// there, so the flag is purely an OS check; engine-specific quirks (e.g. the\n// NSAccessibility virtual-cursor focus path) should be gated at the call site.\n/**\n * The user *may* be using VoiceOver — actual activation is not detectable.\n * True on any Apple platform (macOS, iOS, iPadOS).\n */\nexport const voiceOver = apple;","import { lowerUserAgent } from \"./shared.mjs\";\n\n/** Running in jsdom or HappyDOM (used by unit tests). */\nexport const jsdom = /jsdom|happydom/.test(lowerUserAgent);","export const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';\nexport const ACTIVE_KEY = 'active';\nexport const SELECTED_KEY = 'selected';\nexport const TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';","import { isShadowRoot } from '@floating-ui/utils/dom';\nexport function activeElement(doc) {\n let element = doc.activeElement;\n while (element?.shadowRoot?.activeElement != null) {\n element = element.shadowRoot.activeElement;\n }\n return element;\n}\nexport function contains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n const rootNode = child.getRootNode?.();\n\n // First, attempt with the faster native method.\n if (parent.contains(child)) {\n return true;\n }\n\n // Then fall back to traversing out of shadow roots when needed.\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n while (next) {\n if (parent === next) {\n return true;\n }\n next = next.parentNode || next.host;\n }\n }\n return false;\n}\nexport function getTarget(event) {\n if ('composedPath' in event) {\n return event.composedPath()[0];\n }\n\n // TS assumes `composedPath()` always exists, but older browsers without\n // shadow DOM support still fall back to `target`.\n return event.target;\n}","import { isElement, isHTMLElement } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR } from \"./constants.mjs\";\nimport { activeElement, contains, getTarget } from \"../../internals/shadowDom.mjs\";\nexport { activeElement, contains, getTarget };\nexport function isTargetInsideEnabledTrigger(target, triggerElements) {\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n if (triggerElements.hasElement(targetElement)) {\n return !targetElement.hasAttribute('data-trigger-disabled');\n }\n for (const [, trigger] of triggerElements.entries()) {\n if (contains(trigger, targetElement)) {\n return !trigger.hasAttribute('data-trigger-disabled');\n }\n }\n return false;\n}\nexport function isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const eventAgain = event;\n return eventAgain.target != null && node.contains(eventAgain.target);\n}\nexport function isRootElement(element) {\n return element.matches('html,body');\n}\nexport function isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nexport function isInteractiveElement(element) {\n return element?.closest(`button,a[href],[role=\"button\"],select,[tabindex]:not([tabindex=\"-1\"]),${TYPEABLE_SELECTOR}`) != null;\n}\nexport function isTypeableCombobox(element) {\n if (!element) {\n return false;\n }\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nexport function matchesFocusVisible(element) {\n // We don't want to block focus from working with `visibleOnly`\n // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n if (!element || platform.env.jsdom) {\n return true;\n }\n try {\n return element.matches(':focus-visible');\n } catch (_e) {\n return true;\n }\n}\nexport function getFloatingFocusElement(floatingElement) {\n if (!floatingElement) {\n return null;\n }\n // Try to find the element that has `{...getFloatingProps()}` spread on it.\n // This indicates the floating element is acting as a positioning wrapper, and\n // so focus should be managed on the child element with the event handlers and\n // aria props.\n return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;\n}","/* eslint-disable @typescript-eslint/no-loop-func */\n\nexport function getNodeChildren(nodes, id, onlyOpenChildren = true) {\n const directChildren = nodes.filter(node => node.parentId === id);\n return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nexport function getDeepestNode(nodes, id) {\n let deepestNodeId;\n let maxDepth = -1;\n function findDeepest(nodeId, depth) {\n if (depth > maxDepth) {\n deepestNodeId = nodeId;\n maxDepth = depth;\n }\n const children = getNodeChildren(nodes, nodeId);\n children.forEach(child => {\n findDeepest(child.id, depth + 1);\n });\n }\n findDeepest(id, 0);\n return nodes.find(node => node.id === deepestNodeId);\n}\nexport function getNodeAncestors(nodes, id) {\n let allAncestors = [];\n let currentParentId = nodes.find(node => node.id === id)?.parentId;\n while (currentParentId) {\n const currentNode = nodes.find(node => node.id === currentParentId);\n currentParentId = currentNode?.parentId;\n if (currentNode) {\n allAncestors = allAncestors.concat(currentNode);\n }\n }\n return allAncestors;\n}","import { platform } from '@base-ui/utils/platform';\nexport function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nexport function isReactEvent(event) {\n return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts\nexport function isVirtualClick(event) {\n if (event.pointerType === '' && event.isTrusted) {\n return true;\n }\n if (platform.os.android && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nexport function isVirtualPointerEvent(event) {\n if (platform.env.jsdom) {\n return false;\n }\n return !platform.os.android && event.width === 0 && event.height === 0 || platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nexport function isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nexport function isClickLikeEvent(event) {\n const type = event.type;\n return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';\n}","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n const firstChar = placement[0];\n return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n const side = getSide(placement);\n return oppositeSideMap[side] + placement.slice(side.length);\n}\nfunction expandPaddingObject(padding) {\n var _padding$top, _padding$right, _padding$bottom, _padding$left;\n return {\n top: (_padding$top = padding.top) != null ? _padding$top : 0,\n right: (_padding$right = padding.right) != null ? _padding$right : 0,\n bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,\n left: (_padding$left = padding.left) != null ? _padding$left : 0\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = el.closest('[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}","import { getComputedStyle, getNodeName, isHTMLElement, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { activeElement, contains } from \"./element.mjs\";\nimport { isElementVisible } from \"./composite.mjs\";\nconst CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]';\nfunction getParentElement(element) {\n const assignedSlot = element.assignedSlot;\n if (assignedSlot) {\n return assignedSlot;\n }\n if (element.parentElement) {\n return element.parentElement;\n }\n const rootNode = element.getRootNode();\n return isShadowRoot(rootNode) ? rootNode.host : null;\n}\nfunction getDetailsSummary(details) {\n for (const child of Array.from(details.children)) {\n if (getNodeName(child) === 'summary') {\n return child;\n }\n }\n return null;\n}\nfunction isWithinOpenDetailsSummary(element, details) {\n const summary = getDetailsSummary(details);\n return !!summary && (element === summary || contains(summary, element));\n}\nfunction isFocusableCandidate(element) {\n const nodeName = element ? getNodeName(element) : '';\n return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');\n}\nfunction isFocusableElement(element) {\n if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {\n return false;\n }\n for (let current = element; current; current = getParentElement(current)) {\n const isAncestor = current !== element;\n const isSlot = getNodeName(current) === 'slot';\n if (current.hasAttribute('inert')) {\n return false;\n }\n if (isAncestor && getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {\n return false;\n }\n }\n return true;\n}\nfunction isVisibleInTabbableTree(element, isAncestor) {\n const styles = getComputedStyle(element);\n if (!isAncestor) {\n return isElementVisible(element, styles);\n }\n return styles.display !== 'none';\n}\nfunction getTabIndex(element) {\n const tabIndex = element.tabIndex;\n if (tabIndex < 0) {\n const nodeName = getNodeName(element);\n if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || isHTMLElement(element) && element.isContentEditable) {\n return 0;\n }\n }\n return tabIndex;\n}\nfunction getNamedRadioInput(element) {\n if (getNodeName(element) !== 'input') {\n return null;\n }\n const input = element;\n return input.type === 'radio' && input.name !== '' ? input : null;\n}\nfunction isTabbableRadio(element, candidates) {\n const input = getNamedRadioInput(element);\n if (!input) {\n return true;\n }\n const checkedRadio = candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form && radio.checked;\n });\n if (checkedRadio) {\n return checkedRadio === input;\n }\n return candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form;\n }) === input;\n}\nfunction getComposedChildren(container) {\n if (isHTMLElement(container) && getNodeName(container) === 'slot') {\n const assignedElements = container.assignedElements({\n flatten: true\n });\n if (assignedElements.length > 0) {\n return assignedElements;\n }\n }\n if (isHTMLElement(container) && container.shadowRoot) {\n return Array.from(container.shadowRoot.children);\n }\n return Array.from(container.children);\n}\nfunction appendCandidates(container, list) {\n getComposedChildren(container).forEach(child => {\n if (isFocusableCandidate(child)) {\n list.push(child);\n }\n appendCandidates(child, list);\n });\n}\nfunction appendMatchingElements(container, selector, list) {\n getComposedChildren(container).forEach(child => {\n if (isHTMLElement(child) && child.matches(selector)) {\n list.push(child);\n }\n appendMatchingElements(child, selector, list);\n });\n}\nexport function isTabbable(element) {\n return isFocusableElement(element) && getTabIndex(element) >= 0;\n}\nexport function focusable(container) {\n const candidates = [];\n appendCandidates(container, candidates);\n return candidates.filter(isFocusableElement);\n}\nexport function tabbable(container) {\n const candidates = focusable(container);\n return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));\n}\nfunction getTabbableIn(container, dir) {\n const list = tabbable(container);\n const len = list.length;\n if (len === 0) {\n return undefined;\n }\n const active = activeElement(ownerDocument(container));\n const index = list.indexOf(active);\n // eslint-disable-next-line no-nested-ternary\n const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n return list[nextIndex];\n}\nexport function getNextTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;\n}\nexport function getPreviousTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction getTabbableNearElement(referenceElement, dir) {\n if (!referenceElement) {\n return null;\n }\n const list = tabbable(ownerDocument(referenceElement).body);\n const elementCount = list.length;\n if (elementCount === 0) {\n return null;\n }\n const index = list.indexOf(referenceElement);\n if (index === -1) {\n return null;\n }\n const nextIndex = (index + dir + elementCount) % elementCount;\n return list[nextIndex];\n}\nexport function getTabbableAfterElement(referenceElement) {\n return getTabbableNearElement(referenceElement, 1);\n}\nexport function getTabbableBeforeElement(referenceElement) {\n return getTabbableNearElement(referenceElement, -1);\n}\nexport function isOutsideEvent(event, container) {\n const containerElement = container || event.currentTarget;\n const relatedTarget = event.relatedTarget;\n return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nexport function disableFocusInside(container) {\n const tabbableElements = tabbable(container);\n tabbableElements.forEach(element => {\n element.dataset.tabindex = element.getAttribute('tabindex') || '';\n element.setAttribute('tabindex', '-1');\n });\n}\nexport function enableFocusInside(container) {\n const elements = [];\n appendMatchingElements(container, '[data-tabindex]', elements);\n elements.forEach(element => {\n const tabindex = element.dataset.tabindex;\n delete element.dataset.tabindex;\n if (tabindex) {\n element.setAttribute('tabindex', tabindex);\n } else {\n element.removeAttribute('tabindex');\n }\n });\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\nconst EMPTY = 0;\nexport class Timeout {\n static create() {\n return new Timeout();\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n start(delay, fn) {\n this.clear();\n this.currentId = setTimeout(() => {\n this.currentId = EMPTY;\n fn();\n }, delay); /* Node.js types are enabled in development */\n }\n isStarted() {\n return this.currentId !== EMPTY;\n }\n clear = () => {\n if (this.currentId !== EMPTY) {\n clearTimeout(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.clear;\n };\n}\n\n/**\n * A `setTimeout` with automatic cleanup and guard.\n */\nexport function useTimeout() {\n const timeout = useRefWithInit(Timeout.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { activeElement } from \"../../floating-ui-react/utils.mjs\";\n\n/**\n * The form control to label and validate.\n * Renders an `<input>` element.\n *\n * You can omit this part and use any Base UI input component instead. For example,\n * [Input](https://base-ui.com/react/components/input), [Checkbox](https://base-ui.com/react/components/checkbox),\n * or [Select](https://base-ui.com/react/components/select), among others, will work with Field out of the box.\n *\n * Documentation: [Base UI Field](https://base-ui.com/react/components/field)\n */\nexport const FieldControl = /*#__PURE__*/React.forwardRef(function FieldControl(componentProps, forwardedRef) {\n const {\n render,\n className,\n id: idProp,\n name: nameProp,\n value: valueProp,\n disabled: disabledProp = false,\n onValueChange,\n defaultValue,\n autoFocus = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n name: fieldName,\n disabled: fieldDisabled,\n setTouched,\n setDirty,\n validityData,\n setFocused,\n setFilled,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n clearErrors\n } = useFormContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const state = {\n ...fieldState,\n disabled\n };\n const {\n labelId\n } = useLabelableContext();\n const id = useLabelableId({\n id: idProp\n });\n useIsoLayoutEffect(() => {\n const hasExternalValue = valueProp != null;\n if (validation.inputRef.current?.value || hasExternalValue && valueProp !== '') {\n setFilled(true);\n } else if (hasExternalValue && valueProp === '') {\n setFilled(false);\n }\n }, [validation.inputRef, setFilled, valueProp]);\n const inputRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {\n setFocused(true);\n }\n }, [autoFocus, setFocused]);\n const [valueUnwrapped] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'FieldControl',\n state: 'value'\n });\n const isControlled = valueProp !== undefined;\n const value = isControlled ? valueUnwrapped : undefined;\n const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);\n useRegisterFieldControl(validation.inputRef, id, value, getValueFromInput, !disabled, nameProp);\n const element = useRenderElement('input', componentProps, {\n ref: [forwardedRef, inputRef],\n state,\n props: [{\n id,\n disabled,\n name,\n ref: validation.inputRef,\n 'aria-labelledby': labelId,\n autoFocus,\n ...(isControlled ? {\n value\n } : {\n defaultValue\n }),\n onChange(event) {\n const inputValue = event.currentTarget.value;\n onValueChange?.(inputValue, createChangeEventDetails(REASONS.none, event.nativeEvent));\n // `validation.change` reads `markedDirtyRef`, so update dirty before validating.\n setDirty(inputValue !== (validityData.initialValue ?? ''));\n setFilled(inputValue !== '');\n\n // Workaround for https://github.com/react/react/issues/9023\n if (!event.nativeEvent.defaultPrevented) {\n clearErrors(name);\n validation.change(inputValue);\n }\n },\n onFocus() {\n setFocused(true);\n },\n onBlur(event) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(event.currentTarget.value);\n }\n },\n onKeyDown(event) {\n if (event.currentTarget.tagName === 'INPUT' && event.key === 'Enter') {\n setTouched(true);\n validation.commit(event.currentTarget.value);\n }\n }\n }, elementProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping: fieldValidityMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") FieldControl.displayName = \"FieldControl\";","'use client';\n\nimport * as React from 'react';\nimport { Field } from \"../field/index.mjs\";\n\n/**\n * A native input element that automatically works with [Field](https://base-ui.com/react/components/field).\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI Input](https://base-ui.com/react/components/input)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const Input = /*#__PURE__*/React.forwardRef(function Input(props, forwardedRef) {\n return /*#__PURE__*/_jsx(Field.Control, {\n ref: forwardedRef,\n ...props\n });\n});\nif (process.env.NODE_ENV !== \"production\") Input.displayName = \"Input\";","'use client';\n\nimport * as React from 'react';\nexport const CompositeListContext = /*#__PURE__*/React.createContext({\n register: () => {},\n unregister: () => {},\n subscribeMapChange: () => () => {},\n nextIndexRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") CompositeListContext.displayName = \"CompositeListContext\";\nexport function useCompositeListContext() {\n return React.useContext(CompositeListContext);\n}","/* eslint-disable no-bitwise */\n'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { CompositeListContext } from \"./CompositeListContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides context for a list of items in a composite component.\n */\nexport function CompositeList(props) {\n const {\n children,\n elementsRef,\n labelsRef,\n onMapChange: onMapChangeProp\n } = props;\n const onMapChange = useStableCallback(onMapChangeProp);\n const [, setMapTick] = React.useState(false);\n const listeners = useRefWithInit(createListeners).current;\n const map = useRefWithInit(createMap).current;\n const nextIndexRef = React.useRef(0);\n const isDirtyRef = React.useRef(true);\n const itemsRef = React.useRef([]);\n const mutationObserverRef = React.useRef(null);\n\n // Item effects can run without their parent rendering. Schedule one synchronous\n // parent update for the whole commit so refs are rebuilt before paint and while\n // the originating React event is still inside `act()` in tests.\n const scheduleMapUpdate = useStableCallback(() => {\n if (isDirtyRef.current) {\n return;\n }\n isDirtyRef.current = true;\n setMapTick(tick => !tick);\n });\n const register = useStableCallback((node, registration) => {\n map.set(node, registration);\n scheduleMapUpdate();\n });\n const unregister = useStableCallback(node => {\n map.delete(node);\n scheduleMapUpdate();\n });\n const syncRefs = useStableCallback(items => {\n const nextMap = new Map();\n elementsRef.current.length = 0;\n if (labelsRef) {\n labelsRef.current.length = 0;\n }\n items.forEach(item => {\n nextMap.set(item.element, {\n ...(item.registration.metadata ?? {}),\n index: item.index\n });\n elementsRef.current[item.index] = item.element;\n if (labelsRef) {\n labelsRef.current[item.index] = item.registration.label !== undefined ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;\n }\n });\n nextIndexRef.current = elementsRef.current.length;\n return nextMap;\n });\n function observe(sortedNodes) {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n\n // A single item can't reorder.\n if (typeof MutationObserver !== 'function' || sortedNodes.length < 2) {\n return;\n }\n const mutationObserver = new MutationObserver(entries => {\n // Only verify the order after a move: a node that was removed and later\n // re-added within the same batch. Additions and removals alone can't\n // change the relative order of the remaining items, and items that mount\n // or unmount re-sort through `register`/`unregister`.\n if (!hasMovedNode(entries)) {\n return;\n }\n let previousConnectedNode = null;\n\n // If any connected node now appears before the previous connected node,\n // wrappers/items moved and the index map needs to be rebuilt.\n for (const node of sortedNodes) {\n if (!node.isConnected) {\n continue;\n }\n if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {\n mutationObserver.disconnect();\n scheduleMapUpdate();\n return;\n }\n previousConnectedNode = node;\n }\n });\n mutationObserverRef.current = mutationObserver;\n\n // A reorder that changes item indexes must invert at least one adjacent pair\n // from the previous sorted order. Observing each pair's common parent catches\n // both direct item moves and ancestor wrapper moves at the boundary.\n const roots = new Set();\n for (let i = 1; i < sortedNodes.length; i += 1) {\n const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);\n if (root) {\n roots.add(root);\n }\n }\n roots.forEach(root => mutationObserver.observe(root, {\n childList: true\n }));\n }\n const flush = useStableCallback(() => {\n const [items, automaticNodes] = getCompositeListSnapshot(map);\n const nextMap = syncRefs(items);\n observe(automaticNodes);\n itemsRef.current = items;\n isDirtyRef.current = false;\n listeners.forEach(listener => listener(nextMap));\n onMapChange(nextMap);\n });\n useIsoLayoutEffect(() => {\n // Re-copy the last committed snapshot when the ref objects change or Strict Mode replays\n // effects without reattaching callback refs.\n if (!isDirtyRef.current) {\n syncRefs(itemsRef.current);\n }\n return () => {\n elementsRef.current = [];\n if (labelsRef) {\n labelsRef.current = [];\n }\n };\n }, [elementsRef, labelsRef, syncRefs]);\n useIsoLayoutEffect(() => {\n if (isDirtyRef.current) {\n flush();\n }\n });\n useIsoLayoutEffect(() => {\n return () => {\n mutationObserverRef.current?.disconnect();\n // React 18 Strict Mode replays effects without replaying callback refs.\n // Mark the retained map dirty so the replay rebuilds refs and observation.\n isDirtyRef.current = true;\n };\n }, []);\n const subscribeMapChange = useStableCallback(fn => {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n });\n const contextValue = React.useMemo(() => ({\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n }), [register, unregister, subscribeMapChange, nextIndexRef]);\n return /*#__PURE__*/_jsx(CompositeListContext.Provider, {\n value: contextValue,\n children: children\n });\n}\nfunction createMap() {\n return new Map();\n}\nfunction createListeners() {\n return new Set();\n}\nfunction getCompositeListSnapshot(map) {\n const reservedIndices = new Set();\n const items = [];\n const automaticItems = [];\n map.forEach((registration, node) => {\n if (!node.isConnected) {\n return;\n }\n const index = registration.index;\n const item = {\n index: index ?? -1,\n element: node,\n registration\n };\n if (index === null) {\n automaticItems.push(item);\n } else if (index >= 0) {\n reservedIndices.add(index);\n items.push(item);\n }\n });\n let nextAutomaticIndex = 0;\n automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));\n automaticItems.forEach(item => {\n while (reservedIndices.has(nextAutomaticIndex)) {\n nextAutomaticIndex += 1;\n }\n item.index = nextAutomaticIndex;\n items.push(item);\n nextAutomaticIndex += 1;\n });\n if (reservedIndices.size > 0) {\n items.sort((a, b) => a.index - b.index);\n }\n return [items, automaticItems.map(item => item.element)];\n}\nfunction getCommonAncestor(firstNode, lastNode) {\n let ancestor = firstNode.parentElement;\n\n // The `parentElement` walk cannot cross shadow boundaries, so the native\n // `contains` is sufficient here.\n while (ancestor && !ancestor.contains(lastNode)) {\n ancestor = ancestor.parentElement;\n }\n return ancestor;\n}\nfunction hasMovedNode(entries) {\n for (const entry of entries) {\n for (let i = 0; i < entry.removedNodes.length; i += 1) {\n if (entry.removedNodes[i].isConnected) {\n return true;\n }\n }\n }\n return false;\n}\nfunction sortByDocumentPosition(a, b) {\n // `DOCUMENT_POSITION_CONTAINED_BY` is always reported alongside `FOLLOWING`, and `CONTAINS`\n // alongside `PRECEDING`, so testing `FOLLOWING` alone orders siblings and nested items alike.\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\n/**\n * @internal\n */\nexport const TabsRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") TabsRootContext.displayName = \"TabsRootContext\";\nexport function useTabsRootContext() {\n const context = React.useContext(TabsRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.' : _formatErrorMessage(64));\n }\n return context;\n}","export const tabsStateAttributesMapping = {\n tabActivationDirection: dir => ({\n 'data-activation-direction': dir\n })\n};","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { TabsRootContext } from \"./TabsRootContext.mjs\";\nimport { tabsStateAttributesMapping } from \"./stateAttributesMapping.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * Groups the tabs and the corresponding panels.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const TabsRoot = /*#__PURE__*/React.forwardRef(function TabsRoot(componentProps, forwardedRef) {\n const {\n className,\n defaultValue: defaultValueProp = 0,\n onValueChange: onValueChangeProp,\n orientation = 'horizontal',\n render,\n value: valueProp,\n style,\n ...elementProps\n } = componentProps;\n\n // Track whether the user explicitly provided a defined `defaultValue` prop.\n // Used to determine if we should honor a disabled tab selection.\n const hasExplicitDefaultValueProp = componentProps.defaultValue !== undefined;\n const tabPanelRefs = React.useRef([]);\n const [mountedTabPanels, setMountedTabPanels] = React.useState(() => new Map());\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValueProp,\n name: 'Tabs',\n state: 'value'\n });\n const isControlled = valueProp !== undefined;\n const [tabMap, setTabMap] = React.useState(() => new Map());\n const lastKnownTabElementRef = React.useRef(undefined);\n\n // Used for activation direction detection via tab element positions.\n const getTabElementBySelectedValue = React.useCallback(selectedValue => findTabElement(tabMap, selectedValue), [tabMap]);\n const [activationDirectionState, setActivationDirectionState] = React.useState(() => ({\n previousValue: value,\n tabActivationDirection: 'none'\n }));\n const {\n previousValue,\n tabActivationDirection: committedTabActivationDirection\n } = activationDirectionState;\n let tabActivationDirection = committedTabActivationDirection;\n let directionComputationIncomplete = false;\n\n // Compute activation direction during render when value changes so children see\n // the correct direction on their very first render after the selection update.\n // The previous value snapshot is stored in state and synced after commit.\n // https://github.com/mui/base-ui/issues/3873\n if (previousValue !== value) {\n tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);\n\n // When a new tab is added and selected in the same controlled update,\n // the tab element may not yet be registered in tabMap, so direction was\n // computed from a value-based fallback. Keep the previous value snapshot\n // stale so we re-compute from DOM positions once tabMap is up to date.\n directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;\n }\n const nextPreviousValue = directionComputationIncomplete ? previousValue : value;\n const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;\n useIsoLayoutEffect(() => {\n if (!shouldSyncActivationDirectionState) {\n return;\n }\n setActivationDirectionState({\n previousValue: nextPreviousValue,\n tabActivationDirection\n });\n }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]);\n const onValueChange = useStableCallback((newValue, eventDetails) => {\n const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);\n eventDetails.activationDirection = activationDirection;\n onValueChangeProp?.(newValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValue(newValue);\n });\n const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {\n onValueChangeProp?.(nextValue, createChangeEventDetails(reason, undefined, undefined, {\n activationDirection: 'none'\n }));\n });\n const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {\n setMountedTabPanels(prev => {\n const next = new Map(prev);\n next.set(panelValue, panelId);\n return next;\n });\n return () => {\n setMountedTabPanels(prev => {\n // Another panel with the same value took ownership in the meantime;\n // leave its registration in place.\n if (prev.get(panelValue) !== panelId) {\n return prev;\n }\n const next = new Map(prev);\n next.delete(panelValue);\n return next;\n });\n };\n });\n\n // get the `id` attribute of <Tabs.Panel> to set as the value of `aria-controls` on <Tabs.Tab>\n const getTabPanelIdByValue = React.useCallback(tabValue => {\n return mountedTabPanels.get(tabValue);\n }, [mountedTabPanels]);\n\n // get the `id` attribute of <Tabs.Tab> to set as the value of `aria-labelledby` on <Tabs.Panel>\n const getTabIdByPanelValue = React.useCallback(tabPanelValue => {\n for (const tabMetadata of tabMap.values()) {\n if (tabPanelValue === tabMetadata.value) {\n return tabMetadata.id;\n }\n }\n return undefined;\n }, [tabMap]);\n const tabsContextValue = React.useMemo(() => ({\n getTabElementBySelectedValue,\n getTabIdByPanelValue,\n getTabPanelIdByValue,\n onValueChange,\n orientation,\n registerMountedTabPanel,\n setTabMap,\n tabActivationDirection,\n value\n }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, tabActivationDirection, value]);\n const selectedTabMetadata = React.useMemo(() => {\n for (const tabMetadata of tabMap.values()) {\n if (tabMetadata.value === value) {\n return tabMetadata;\n }\n }\n return undefined;\n }, [tabMap, value]);\n\n // Find the first non-disabled tab value.\n // Used as a fallback when the current selection is disabled or missing.\n const firstEnabledTabValue = React.useMemo(() => {\n for (const tabMetadata of tabMap.values()) {\n if (!tabMetadata.disabled) {\n return tabMetadata.value;\n }\n }\n return undefined;\n }, [tabMap]);\n\n // Implicit uncontrolled selections are still automatic changes, so notify\n // once when the tabs first register. Explicit defaults are treated as user-owned.\n const shouldNotifyInitialValueChangeRef = React.useRef(!hasExplicitDefaultValueProp);\n // useControlled warns if defaultValue changes after mount, but the\n // disabled-default honor policy below still needs a stable initial value.\n const initialDefaultValueRef = React.useRef(defaultValueProp);\n // An explicit defaultValue can intentionally point at a disabled tab on mount.\n // Once that selection becomes valid, later disabled states should fall back.\n const shouldHonorDisabledDefaultValueRef = React.useRef(hasExplicitDefaultValueProp);\n const didRegisterTabsRef = React.useRef(false);\n\n // Uncontrolled roots own automatic fallback. Controlled roots keep the exact\n // value supplied by the parent, even when that tab is disabled or missing.\n useIsoLayoutEffect(() => {\n if (isControlled) {\n return;\n }\n function commitAutomaticValueChange(fallbackValue, fallbackReason) {\n setValue(fallbackValue);\n // Automatic fallbacks are not directional transitions; reset the direction\n // alongside the value so the batched commit keeps both in sync.\n setActivationDirectionState({\n previousValue: fallbackValue,\n tabActivationDirection: 'none'\n });\n notifyAutomaticValueChange(fallbackValue, fallbackReason);\n // Mark the initial notification as delivered only after the consumer\n // callback returns. The fallback value is queued first so automatic\n // consistency updates are not cancelable through a throwing handler.\n shouldNotifyInitialValueChangeRef.current = false;\n }\n if (tabMap.size === 0) {\n // A Suspense boundary outside the root can clean up layout effects while\n // keeping the previous tabs connected. Don't treat that as removal.\n if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) {\n commitAutomaticValueChange(null, REASONS.missing);\n }\n return;\n }\n didRegisterTabsRef.current = true;\n lastKnownTabElementRef.current = tabMap.keys().next().value;\n const selectionIsDisabled = selectedTabMetadata?.disabled;\n const selectionIsMissing = selectedTabMetadata == null && value !== null;\n if (!selectionIsDisabled && value === initialDefaultValueRef.current) {\n shouldHonorDisabledDefaultValueRef.current = false;\n }\n if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) {\n return;\n }\n const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;\n if (selectionIsDisabled || selectionIsMissing) {\n const fallbackValue = firstEnabledTabValue ?? null;\n if (value === fallbackValue) {\n // Already at the fallback value; no commit or notification needed,\n // but record that the implicit-initial transition has resolved.\n shouldNotifyInitialValueChangeRef.current = false;\n return;\n }\n let fallbackReason = REASONS.missing;\n if (shouldNotifyInitialValueChange) {\n fallbackReason = REASONS.initial;\n } else if (selectionIsDisabled) {\n fallbackReason = REASONS.disabled;\n }\n commitAutomaticValueChange(fallbackValue, fallbackReason);\n return;\n }\n if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {\n notifyAutomaticValueChange(value, REASONS.initial);\n shouldNotifyInitialValueChangeRef.current = false;\n }\n }, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]);\n const state = {\n orientation,\n tabActivationDirection\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: elementProps,\n stateAttributesMapping: tabsStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(TabsRootContext.Provider, {\n value: tabsContextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: tabPanelRefs,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") TabsRoot.displayName = \"TabsRoot\";\nfunction findTabElement(tabMap, value) {\n for (const [tabElement, tabMetadata] of tabMap.entries()) {\n if (value === tabMetadata.value) {\n return tabElement;\n }\n }\n return null;\n}\nfunction computeActivationDirection(oldValue, newValue, orientation, tabMap) {\n if (oldValue == null || newValue == null) {\n return 'none';\n }\n const [positionProp, backward, forward] = orientation === 'horizontal' ? ['left', 'left', 'right'] : ['top', 'up', 'down'];\n const oldTab = findTabElement(tabMap, oldValue);\n const newTab = findTabElement(tabMap, newValue);\n if (oldTab == null || newTab == null) {\n // Fallback for dynamic tabs: when a tab element isn't registered yet\n // (e.g. added and selected in the same update), infer direction from\n // the values themselves. Works for comparable types (numbers, strings).\n if (oldTab !== newTab && (typeof oldValue === 'number' || typeof oldValue === 'string') && typeof oldValue === typeof newValue) {\n return newValue > oldValue ? forward : backward;\n }\n return 'none';\n }\n const oldPosition = oldTab.getBoundingClientRect()[positionProp];\n const newPosition = newTab.getBoundingClientRect()[positionProp];\n if (newPosition < oldPosition) {\n return backward;\n }\n if (newPosition > oldPosition) {\n return forward;\n }\n return 'none';\n}","export const ACTIVE_COMPOSITE_ITEM = 'data-composite-item-active';","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useCompositeListContext } from \"./CompositeListContext.mjs\";\n/**\n * Used to register a list item and its index (DOM position) in the `CompositeList`.\n */\nexport function useCompositeListItem(params = {}) {\n const {\n guess,\n label,\n metadata,\n textRef,\n index: externalIndex\n } = params;\n const {\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n } = useCompositeListContext();\n\n // Guess the index from the render order. This avoids a re-render after mount for\n // flat lists rendered in DOM order; when the guess is wrong (grouped or out-of-order\n // rendering), the commit flush corrects it before paint.\n const indexRef = React.useRef(-1);\n const [internalIndex, setInternalIndex] = React.useState(externalIndex == null && guess ? () => {\n if (indexRef.current === -1) {\n const newIndex = nextIndexRef.current;\n nextIndexRef.current += 1;\n indexRef.current = newIndex;\n }\n return indexRef.current;\n } : -1);\n const index = externalIndex ?? internalIndex;\n const componentRef = React.useRef(null);\n\n // Deliberately identity-sensitive: nested items sharing one DOM node rely on ref attachment\n // order to decide which registration wins, and republishing from an effect instead would let\n // an inner item's later update silently take ownership from the outer one.\n const ref = React.useCallback(node => {\n const previousNode = componentRef.current;\n if (previousNode) {\n unregister(previousNode);\n }\n componentRef.current = node;\n if (node) {\n register(node, {\n metadata: metadata ?? null,\n index: externalIndex ?? null,\n label,\n textRef\n });\n }\n }, [externalIndex, register, unregister, metadata, label, textRef]);\n useIsoLayoutEffect(() => {\n if (externalIndex != null) {\n return undefined;\n }\n return subscribeMapChange(map => {\n const i = componentRef.current ? map.get(componentRef.current)?.index : null;\n if (i != null) {\n setInternalIndex(i);\n }\n });\n }, [externalIndex, subscribeMapChange]);\n return {\n ref,\n index\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useCompositeRootContext } from \"../root/CompositeRootContext.mjs\";\nimport { useCompositeListItem } from \"../list/useCompositeListItem.mjs\";\nexport function useCompositeItem(params = {}) {\n const {\n highlightItemOnHover,\n highlightedIndex,\n onHighlightedIndexChange\n } = useCompositeRootContext();\n const {\n ref,\n index\n } = useCompositeListItem(params);\n const isHighlighted = highlightedIndex === index;\n const itemRef = React.useRef(null);\n const mergedRef = useMergedRefs(ref, itemRef);\n const compositeProps = {\n tabIndex: isHighlighted ? 0 : -1,\n onFocus() {\n onHighlightedIndexChange(index);\n },\n onMouseMove() {\n const item = itemRef.current;\n if (!highlightItemOnHover || !item) {\n return;\n }\n const disabled = item.hasAttribute('disabled') || item.ariaDisabled === 'true';\n if (!isHighlighted && !disabled) {\n item.focus();\n }\n }\n };\n return {\n compositeProps,\n compositeRef: mergedRef,\n index\n };\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const TabsListContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") TabsListContext.displayName = \"TabsListContext\";\nexport function useTabsListContext() {\n const context = React.useContext(TabsListContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.' : _formatErrorMessage(65));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { ACTIVE_COMPOSITE_ITEM } from \"../../internals/composite/constants.mjs\";\nimport { useCompositeItem } from \"../../internals/composite/item/useCompositeItem.mjs\";\nimport { useCompositeRootContext } from \"../../internals/composite/root/CompositeRootContext.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsListContext } from \"../list/TabsListContext.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { activeElement, contains } from \"../../floating-ui-react/utils.mjs\";\n\n/**\n * An individual interactive tab button that toggles the corresponding panel.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nexport const TabsTab = /*#__PURE__*/React.forwardRef(function TabsTab(componentProps, forwardedRef) {\n const {\n className,\n disabled = false,\n render,\n value,\n id: idProp,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n value: activeTabValue,\n getTabPanelIdByValue,\n onValueChange,\n orientation,\n tabActivationDirection\n } = useTabsRootContext();\n const {\n activateOnFocus,\n registerTabResizeObserverElement,\n tabsListElement\n } = useTabsListContext();\n const {\n highlightedIndex,\n onHighlightedIndexChange\n } = useCompositeRootContext();\n const id = useBaseUiId(idProp);\n const tabMetadata = React.useMemo(() => ({\n disabled,\n id,\n value\n }), [disabled, id, value]);\n const {\n compositeProps,\n compositeRef,\n index\n // hook is used instead of the CompositeItem component\n // because the index is needed for Tab internals\n } = useCompositeItem({\n metadata: tabMetadata\n });\n const active = value === activeTabValue;\n const isNavigatingRef = React.useRef(false);\n const unobserveTabElementRef = React.useRef(null);\n\n // Registered from the ref callback rather than an effect so the observer\n // follows the rendered element when the `render` prop swaps the host element.\n const observeTabElement = useStableCallback(element => {\n unobserveTabElementRef.current?.();\n unobserveTabElementRef.current = element ? registerTabResizeObserverElement(element) : null;\n });\n\n // Keep the highlighted item in sync with the currently active tab\n // when the value prop changes externally (controlled mode)\n useIsoLayoutEffect(() => {\n if (isNavigatingRef.current) {\n isNavigatingRef.current = false;\n return;\n }\n if (!(active && index > -1 && highlightedIndex !== index)) {\n return;\n }\n\n // If focus is currently within the tabs list, don't override the roving\n // focus highlight. This keeps keyboard navigation relative to the focused\n // item after an external/asynchronous selection change.\n const listElement = tabsListElement;\n if (listElement != null) {\n const activeEl = activeElement(ownerDocument(listElement));\n if (activeEl && contains(listElement, activeEl)) {\n return;\n }\n }\n\n // Don't highlight disabled tabs to prevent them from interfering with keyboard navigation.\n // Keyboard focus (tabIndex) should remain on an enabled tab even when a disabled tab is selected.\n if (!disabled) {\n onHighlightedIndexChange(index);\n }\n }, [active, index, highlightedIndex, onHighlightedIndexChange, disabled, tabsListElement]);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton,\n focusableWhenDisabled: true\n });\n const tabPanelId = getTabPanelIdByValue(value);\n const isPressingRef = React.useRef(false);\n const isMainButtonRef = React.useRef(false);\n\n // Both callers guard on `!active`, so the current value is never re-committed.\n function activate(event) {\n onValueChange(value, createChangeEventDetails(REASONS.none, event.nativeEvent, undefined, {\n activationDirection: 'none'\n }));\n }\n function onClick(event) {\n if (active || disabled) {\n return;\n }\n activate(event);\n }\n function onFocus(event) {\n if (active || disabled) {\n return;\n }\n if (activateOnFocus && (!isPressingRef.current ||\n // keyboard or touch focus\n isMainButtonRef.current) // main mouse button focus\n ) {\n activate(event);\n }\n }\n function onPointerDown(event) {\n if (active || disabled) {\n return;\n }\n isPressingRef.current = true;\n // Secondary presses (context menu, middle click) may focus the tab, but\n // must not activate it with `activateOnFocus`.\n isMainButtonRef.current = event.button === 0;\n\n // Registered for every button so a secondary press doesn't leave the tab\n // stuck in the pressing state, which would suppress later focus activation.\n const doc = ownerDocument(event.currentTarget);\n function handlePointerEnd() {\n isPressingRef.current = false;\n isMainButtonRef.current = false;\n doc.removeEventListener('pointerup', handlePointerEnd);\n doc.removeEventListener('pointercancel', handlePointerEnd);\n }\n doc.addEventListener('pointerup', handlePointerEnd);\n doc.addEventListener('pointercancel', handlePointerEnd);\n }\n const state = {\n disabled,\n active,\n orientation,\n tabActivationDirection\n };\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef, compositeRef, observeTabElement],\n props: [compositeProps, {\n role: 'tab',\n 'aria-controls': tabPanelId,\n 'aria-selected': active,\n id,\n onClick,\n onFocus,\n onPointerDown,\n [ACTIVE_COMPOSITE_ITEM]: active ? '' : undefined,\n onKeyDownCapture() {\n isNavigatingRef.current = true;\n }\n }, elementProps, getButtonProps],\n stateAttributesMapping: tabsStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") TabsTab.displayName = \"TabsTab\";","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import { isReactVersionAtLeast } from \"./reactVersion.mjs\";\nexport function inertValue(value) {\n if (isReactVersionAtLeast(19)) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nconst stateAttributesMapping = {\n ...tabsStateAttributesMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A panel displayed when the corresponding tab is active.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nexport const TabsPanel = /*#__PURE__*/React.forwardRef(function TabsPanel(componentProps, forwardedRef) {\n const {\n className,\n value,\n render,\n keepMounted = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n value: selectedValue,\n getTabIdByPanelValue,\n orientation,\n tabActivationDirection,\n registerMountedTabPanel\n } = useTabsRootContext();\n const id = useBaseUiId();\n const {\n ref: listItemRef,\n index\n } = useCompositeListItem();\n const open = value === selectedValue;\n const {\n mounted,\n transitionStatus,\n setMounted\n } = useTransitionStatus(open);\n const hidden = !mounted;\n const correspondingTabId = getTabIdByPanelValue(value);\n const state = {\n hidden,\n orientation,\n tabActivationDirection,\n transitionStatus\n };\n const panelRef = React.useRef(null);\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, listItemRef, panelRef],\n props: [{\n 'aria-labelledby': correspondingTabId,\n hidden,\n id,\n role: 'tabpanel',\n tabIndex: open ? 0 : -1,\n inert: inertValue(!open),\n // Computed key: a plain literal key fails the DOM-props excess property check.\n ['data-index']: index\n }, elementProps],\n stateAttributesMapping\n });\n useOpenChangeComplete({\n open,\n ref: panelRef,\n onComplete() {\n if (!open) {\n setMounted(false);\n }\n }\n });\n useIsoLayoutEffect(() => {\n // On React 17 `useId` resolves in a passive effect, so `id` is still\n // undefined during this layout effect on the first commit. Skip the\n // registration until the effect re-runs with the resolved id.\n if (id == null || hidden && !keepMounted) {\n return undefined;\n }\n return registerMountedTabPanel(value, id);\n }, [hidden, keepMounted, value, id, registerMountedTabPanel]);\n const shouldRender = keepMounted || mounted;\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") TabsPanel.displayName = \"TabsPanel\";","export function isElementDisabled(element) {\n return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';\n}","import { isHTMLElement } from '@floating-ui/utils/dom';\nexport { stopEvent, isIndexOutOfListBounds, isListIndexDisabled, findNonDisabledListIndex, getMaxListIndex, getMinListIndex } from \"../../floating-ui-react/utils.mjs\";\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const HOME = 'Home';\nexport const END = 'End';\nexport const PAGE_UP = 'PageUp';\nexport const PAGE_DOWN = 'PageDown';\nexport const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);\nexport const SHIFT = 'Shift';\nexport const MODIFIER_KEYS = [SHIFT, 'Control', 'Alt', 'Meta'];\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName === 'INPUT';\n}\nexport function isNativeInput(element) {\n if (isInputElement(element) && element.selectionStart != null) {\n return true;\n }\n if (isHTMLElement(element) && element.tagName === 'TEXTAREA') {\n return true;\n }\n return false;\n}\nexport function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {\n if (!scrollContainer || !element || !element.scrollTo) {\n return;\n }\n let targetX = scrollContainer.scrollLeft;\n let targetY = scrollContainer.scrollTop;\n const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;\n const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;\n if (isOverflowingX && orientation !== 'vertical') {\n const elementOffsetLeft = getOffset(scrollContainer, element, 'left');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (direction === 'ltr') {\n if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n }\n }\n if (direction === 'rtl') {\n if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n }\n }\n }\n if (isOverflowingY && orientation !== 'horizontal') {\n const elementOffsetTop = getOffset(scrollContainer, element, 'top');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {\n // overflow upwards, align top edges\n targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;\n } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {\n // overflow downwards, align bottom edges\n targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;\n }\n }\n scrollContainer.scrollTo({\n left: targetX,\n top: targetY,\n behavior: 'auto'\n });\n}\nfunction getOffset(ancestor, element, side) {\n const propName = side === 'left' ? 'offsetLeft' : 'offsetTop';\n let result = 0;\n while (element.offsetParent) {\n result += element[propName];\n if (element.offsetParent === ancestor) {\n break;\n }\n element = element.offsetParent;\n }\n return result;\n}\nfunction getStyles(element) {\n const styles = getComputedStyle(element);\n return {\n scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,\n scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,\n scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,\n scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,\n scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,\n scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,\n scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,\n scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { isElementDisabled } from '@base-ui/utils/isElementDisabled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { COMPOSITE_KEYS, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, END, HOME, MODIFIER_KEYS, findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isListIndexDisabled, isIndexOutOfListBounds, isNativeInput, scrollIntoViewIfNeeded } from \"../composite.mjs\";\nimport { ACTIVE_COMPOSITE_ITEM } from \"../constants.mjs\";\nimport { getTarget } from \"../../../floating-ui-react/utils.mjs\";\nconst EMPTY_ARRAY = [];\nexport function useCompositeRoot(params) {\n const {\n loopFocus = true,\n orientation = 'both',\n grid,\n onLoop,\n direction,\n highlightedIndex: externalHighlightedIndex,\n onHighlightedIndexChange: externalSetHighlightedIndex,\n rootRef: externalRef,\n enableHomeAndEndKeys = false,\n stopEventPropagation,\n disabledIndices,\n modifierKeys = EMPTY_ARRAY\n } = params;\n const [internalHighlightedIndex, internalSetHighlightedIndex] = React.useState(0);\n const isGrid = grid != null;\n const rootRef = React.useRef(null);\n const mergedRef = useMergedRefs(rootRef, externalRef);\n const elementsRef = React.useRef([]);\n const hasSetDefaultIndexRef = React.useRef(false);\n const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;\n const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {\n (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);\n if (shouldScrollIntoView) {\n const newActiveItem = elementsRef.current[index];\n scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);\n }\n });\n const onMapChange = useStableCallback(map => {\n if (map.size === 0 || hasSetDefaultIndexRef.current) {\n return;\n }\n hasSetDefaultIndexRef.current = true;\n const sortedElements = Array.from(map.keys());\n const activeItem = sortedElements.find(compositeElement => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;\n // Set the default highlighted index of an arbitrary composite item. The map value carries\n // the item's own index, which is not its position among the keys once a list mixes explicit\n // and automatic indexes and leaves gaps.\n const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;\n if (activeIndex !== -1) {\n onHighlightedIndexChange(activeIndex);\n } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {\n // The default highlighted item is disabled, so it should not hold the single\n // roving tab stop: a natively disabled element is removed from the tab order,\n // and an aria-disabled one should not be the entry point. Move the tab stop\n // to the first enabled item. If every item is disabled, keep the current\n // highlighted index.\n const firstEnabledIndex = findNonDisabledListIndex(sortedElements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);\n });\n useIsoLayoutEffect(() => {\n // `disabledIndices` can resolve a render after the initial map population\n // (e.g. Toolbar derives it from item metadata through a state update), so the\n // default tab stop at index 0 may now point at a disabled item, leaving the\n // composite without a reachable tab stop. Re-validate and move it to the first\n // enabled item. Gated on `disabledIndices` being provided so composites that\n // rely on the DOM disabled fallback keep their existing behavior.\n if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) {\n return;\n }\n const elements = elementsRef.current;\n if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {\n const firstEnabledIndex = findNonDisabledListIndex(elements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]);\n const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {\n if (!onLoop) {\n return nextIndex;\n }\n return onLoop(event, prevIndex, nextIndex, elementsRef);\n });\n\n // Stable so that `relayKeyboardEvent` does not invalidate identity-sensitive\n // consumers (the `CompositeRootContext` value and trigger data forwarding).\n const onKeyDown = useStableCallback(event => {\n const isHomeOrEnd = event.key === HOME || event.key === END;\n if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) {\n return;\n }\n if (isModifierKeySet(event, modifierKeys)) {\n return;\n }\n const element = rootRef.current;\n if (!element) {\n return;\n }\n const isRtl = direction === 'rtl';\n const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;\n const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;\n const forwardKey = orientation === 'vertical' ? ARROW_DOWN : horizontalForwardKey;\n const backwardKey = orientation === 'vertical' ? ARROW_UP : horizontalBackwardKey;\n const target = getTarget(event.nativeEvent);\n if (target != null && isNativeInput(target) && !isElementDisabled(target)) {\n const selectionStart = target.selectionStart;\n const selectionEnd = target.selectionEnd;\n const textContent = target.value;\n // return to native textbox behavior when\n // 1 - Shift is held to make a text selection, or if there already is a text selection\n if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {\n return;\n }\n // 2 - arrow-ing forward and not in the last position of the text\n if (event.key !== backwardKey && selectionStart < textContent.length) {\n return;\n }\n // 3 -arrow-ing backward and not in the first position of the text\n if (event.key !== forwardKey && selectionStart > 0) {\n return;\n }\n }\n let nextIndex = highlightedIndex;\n const minIndex = getMinListIndex(elementsRef, disabledIndices);\n const maxIndex = getMaxListIndex(elementsRef, disabledIndices);\n if (grid != null) {\n nextIndex = grid({\n disabledIndices,\n elementsRef,\n event,\n highlightedIndex,\n loopFocus,\n maxIndex,\n minIndex,\n onLoop: wrappedOnLoop,\n orientation,\n rtl: isRtl\n });\n }\n const isForwardKey = orientation !== 'vertical' && event.key === horizontalForwardKey || orientation !== 'horizontal' && event.key === ARROW_DOWN;\n const isBackwardKey = orientation !== 'vertical' && event.key === horizontalBackwardKey || orientation !== 'horizontal' && event.key === ARROW_UP;\n if (enableHomeAndEndKeys) {\n if (event.key === HOME) {\n nextIndex = minIndex;\n } else if (event.key === END) {\n nextIndex = maxIndex;\n }\n }\n if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) {\n if (loopFocus && nextIndex === maxIndex && isForwardKey) {\n nextIndex = minIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else if (loopFocus && nextIndex === minIndex && isBackwardKey) {\n nextIndex = maxIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else {\n nextIndex = findNonDisabledListIndex(elementsRef.current, {\n startingIndex: nextIndex,\n decrement: isBackwardKey,\n disabledIndices\n });\n }\n }\n if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {\n if (stopEventPropagation) {\n event.stopPropagation();\n }\n if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) {\n event.preventDefault();\n }\n onHighlightedIndexChange(nextIndex, true);\n\n // Wait for FocusManager `returnFocus` to execute.\n queueMicrotask(() => {\n elementsRef.current[nextIndex]?.focus();\n });\n }\n });\n const props = {\n ref: mergedRef,\n onFocus(event) {\n const element = rootRef.current;\n const target = getTarget(event.nativeEvent);\n if (!element || target == null || !isNativeInput(target)) {\n return;\n }\n target.setSelectionRange(0, target.value.length);\n },\n onKeyDown\n };\n return {\n props,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange,\n relayKeyboardEvent: onKeyDown\n };\n}\nfunction isModifierKeySet(event, ignoredModifierKeys) {\n for (const key of MODIFIER_KEYS) {\n if (ignoredModifierKeys.includes(key)) {\n continue;\n }\n if (event.getModifierState(key)) {\n return true;\n }\n }\n return false;\n}","'use client';\n\nimport * as React from 'react';\nexport const DirectionContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") DirectionContext.displayName = \"DirectionContext\";\nexport function useDirection() {\n const context = React.useContext(DirectionContext);\n return context?.direction ?? 'ltr';\n}","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { CompositeList } from \"../list/CompositeList.mjs\";\nimport { useCompositeRoot } from \"./useCompositeRoot.mjs\";\nimport { CompositeRootContext } from \"./CompositeRootContext.mjs\";\nimport { useRenderElement } from \"../../useRenderElement.mjs\";\nimport { useDirection } from \"../../direction-context/DirectionContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function CompositeRoot(componentProps) {\n const {\n render,\n className,\n style,\n refs = EMPTY_ARRAY,\n props = EMPTY_ARRAY,\n state = EMPTY_OBJECT,\n stateAttributesMapping,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n orientation,\n grid,\n loopFocus,\n onLoop,\n enableHomeAndEndKeys,\n onMapChange: onMapChangeProp,\n stopEventPropagation = true,\n rootRef,\n disabledIndices,\n modifierKeys,\n highlightItemOnHover = false,\n tag = 'div',\n ...elementProps\n } = componentProps;\n const direction = useDirection();\n const {\n props: defaultProps,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange: onMapChangeUnwrapped,\n relayKeyboardEvent\n } = useCompositeRoot({\n grid,\n loopFocus,\n onLoop,\n orientation,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n rootRef,\n stopEventPropagation,\n enableHomeAndEndKeys,\n direction,\n disabledIndices,\n modifierKeys\n });\n const element = useRenderElement(tag, componentProps, {\n state,\n ref: refs,\n props: [defaultProps, ...props, elementProps],\n stateAttributesMapping\n });\n const contextValue = React.useMemo(() => ({\n highlightedIndex,\n onHighlightedIndexChange,\n highlightItemOnHover,\n relayKeyboardEvent\n }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);\n return /*#__PURE__*/_jsx(CompositeRootContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: elementsRef,\n onMapChange: newMap => {\n onMapChangeProp?.(newMap);\n onMapChangeUnwrapped(newMap);\n },\n children: element\n })\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { CompositeRoot } from \"../../internals/composite/root/CompositeRoot.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nimport { TabsListContext } from \"./TabsListContext.mjs\";\n\n/**\n * Groups the individual tab buttons.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const TabsList = /*#__PURE__*/React.forwardRef(function TabsList(componentProps, forwardedRef) {\n const {\n activateOnFocus = false,\n className,\n loopFocus = true,\n render,\n style,\n ...elementProps\n } = componentProps;\n const {\n orientation,\n setTabMap,\n tabActivationDirection\n } = useTabsRootContext();\n const [highlightedTabIndex, setHighlightedTabIndex] = React.useState(0);\n const [tabsListElement, setTabsListElement] = React.useState(null);\n const indicatorUpdateListenersRef = React.useRef(new Set());\n const tabResizeObserverElementsRef = React.useRef(new Set());\n const resizeObserverRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const resizeObserver = new ResizeObserver(() => {\n indicatorUpdateListenersRef.current.forEach(listener => {\n listener();\n });\n });\n resizeObserverRef.current = resizeObserver;\n if (tabsListElement) {\n resizeObserver.observe(tabsListElement);\n }\n tabResizeObserverElementsRef.current.forEach(element => {\n resizeObserver.observe(element);\n });\n return () => {\n resizeObserver.disconnect();\n resizeObserverRef.current = null;\n };\n }, [tabsListElement]);\n const registerIndicatorUpdateListener = useStableCallback(listener => {\n indicatorUpdateListenersRef.current.add(listener);\n return () => {\n indicatorUpdateListenersRef.current.delete(listener);\n };\n });\n const registerTabResizeObserverElement = useStableCallback(element => {\n tabResizeObserverElementsRef.current.add(element);\n resizeObserverRef.current?.observe(element);\n return () => {\n tabResizeObserverElementsRef.current.delete(element);\n resizeObserverRef.current?.unobserve(element);\n };\n });\n const state = {\n orientation,\n tabActivationDirection\n };\n const defaultProps = {\n 'aria-orientation': orientation === 'vertical' ? 'vertical' : undefined,\n role: 'tablist'\n };\n const tabsListContextValue = React.useMemo(() => ({\n activateOnFocus,\n registerIndicatorUpdateListener,\n registerTabResizeObserverElement,\n tabsListElement\n }), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]);\n return /*#__PURE__*/_jsx(TabsListContext.Provider, {\n value: tabsListContextValue,\n children: /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef, setTabsListElement],\n props: [defaultProps, elementProps],\n stateAttributesMapping: tabsStateAttributesMapping,\n highlightedIndex: highlightedTabIndex,\n enableHomeAndEndKeys: true,\n loopFocus: loopFocus,\n orientation: orientation,\n onHighlightedIndexChange: setHighlightedTabIndex,\n onMapChange: setTabMap,\n disabledIndices: EMPTY_ARRAY\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") TabsList.displayName = \"TabsList\";","import * as React from 'react';\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { resolveDisclosure } from './disclosure.js';\n\n/**\n * The chevron both panels use. Kept here rather than copied into each panel:\n * the two had already drifted apart in geometry once, which is exactly the\n * failure a shared control prevents.\n */\nexport const chevronIcon = React.createElement(\n 'svg',\n { width: 12, height: 12, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': true },\n React.createElement('path', {\n d: 'M6 3.5 10.5 8 6 12.5',\n stroke: 'currentColor',\n strokeWidth: 1.4,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n }),\n);\n\nexport interface DisclosureRowOptions {\n /** Stable identity for both the React key and the expanded-state map. */\n readonly rowKey: string;\n /** Whether this row's detail is currently expanded. */\n readonly expanded: boolean;\n /** A filter is active, so matching detail is forced open. */\n readonly filtering: boolean;\n readonly onOpenChange: (open: boolean) => void;\n /** Accessible name for the trigger; the caller translates it. */\n readonly triggerLabel: string;\n readonly className: string;\n readonly headerClassName: string;\n /** Rendered inside the trigger, next to the chevron. */\n readonly heading: React.ReactNode;\n /** Rendered after the trigger, outside it: switches, chips, buttons. */\n readonly actions: readonly React.ReactNode[];\n /** The revealed content. Absent means there is nothing to reveal. */\n readonly detail?: React.ReactNode;\n readonly style?: React.CSSProperties;\n /** Class for the placeholder that keeps a detail-less row aligned. */\n readonly spacerClassName?: string;\n}\n\n/**\n * One capability row that may reveal detail.\n *\n * Both panels show the same kind of thing — a name, a switch, and detail worth\n * hiding until asked for — so both get the same affordance from one place. A\n * row with no detail renders no trigger at all rather than an empty one, and\n * takes a spacer so its name still lines up with the rows that do.\n */\nexport function disclosureRow(options: DisclosureRowOptions): React.ReactElement {\n const hasDetail = options.detail !== undefined && options.detail !== null && options.detail !== '';\n if (!hasDetail) {\n return React.createElement(\n 'div',\n { className: options.className, ...(options.style === undefined ? {} : { style: options.style }) },\n React.createElement(\n 'div',\n { className: options.headerClassName },\n React.createElement('span', {\n 'aria-hidden': true,\n ...(options.spacerClassName === undefined\n ? { style: { width: '18px', flex: 'none' } }\n : { className: options.spacerClassName }),\n }),\n options.heading,\n ...options.actions,\n ),\n );\n }\n const disclosure = resolveDisclosure(options.expanded, options.filtering);\n return React.createElement(\n Collapsible.Root,\n {\n open: disclosure.open,\n onOpenChange: options.onOpenChange,\n className: options.className,\n ...(options.style === undefined ? {} : { style: options.style }),\n },\n React.createElement(\n 'div',\n { className: options.headerClassName },\n React.createElement(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger',\n disabled: disclosure.disabled,\n 'aria-label': options.triggerLabel,\n },\n React.createElement('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n options.heading,\n ),\n ...options.actions,\n ),\n React.createElement(Collapsible.Panel, { className: 'ci-collapse' }, options.detail),\n );\n}\n","/**\n * The settings panel's text filter. It is the same function the composer panel\n * uses, fixed to the preset payload types: the two scopes must behave\n * identically under one query, and sharing the implementation is what makes\n * that true rather than merely intended.\n */\nimport { filterCapabilities } from './filter-core.js';\nimport type { FilteredCapabilities } from './filter-core.js';\nimport type { PresetMcpView, PresetSkillView, PresetToolPresetView, PresetToolView } from './preset-store.js';\n\nexport type FilteredPreset = FilteredCapabilities<PresetSkillView, PresetToolView, PresetMcpView>;\n\nexport function filterPreset(preset: PresetToolPresetView, rawQuery: string): FilteredPreset {\n return filterCapabilities(preset, rawQuery);\n}\n","/**\n * Runtime guards for the preset payload contract, shared so the client parser\n * and the composition tests exercise the exact same code. A rejected payload\n * must read as an error in the panel, not as an empty preset list -- the\n * host/client version skew that produces one (client hot-reloads, host needs\n * a restart) is exactly when shapes diverge.\n */\nimport type {\n PresetMcpServer,\n PresetSkillRow,\n PresetToolEntry,\n PresetToolPayload,\n PresetToolRow,\n} from './preset-contract.js';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\nfunction parseTools(raw: readonly unknown[]): PresetToolRow[] | null {\n const tools: PresetToolRow[] = [];\n for (const rawTool of raw) {\n if (!isRecord(rawTool)) return null;\n const { name, label, description, enabled, reserved } = rawTool;\n if (typeof name !== 'string' || typeof label !== 'string' || typeof enabled !== 'boolean') return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (reserved !== undefined && typeof reserved !== 'boolean') return null;\n tools.push({\n name,\n label,\n ...(description === undefined ? {} : { description }),\n enabled,\n ...(reserved === undefined ? {} : { reserved }),\n });\n }\n return tools;\n}\n\nfunction parseSkills(raw: readonly unknown[]): PresetSkillRow[] | null {\n const skills: PresetSkillRow[] = [];\n for (const rawSkill of raw) {\n if (!isRecord(rawSkill)) return null;\n const { name, description, enabled, project, source, path, group } = rawSkill;\n if (typeof name !== 'string' || typeof enabled !== 'boolean') return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (project !== undefined && typeof project !== 'boolean') return null;\n if (source !== undefined && typeof source !== 'string') return null;\n if (path !== undefined && typeof path !== 'string') return null;\n if (group !== undefined && typeof group !== 'string') return null;\n skills.push({\n name,\n ...(description === undefined ? {} : { description }),\n enabled,\n ...(project === undefined ? {} : { project }),\n ...(source === undefined ? {} : { source }),\n ...(path === undefined ? {} : { path }),\n ...(group === undefined ? {} : { group }),\n });\n }\n return skills;\n}\n\n/** Parse one payload, returning null for anything that is not the contract. */\nexport function parsePresetToolPayload(value: unknown): PresetToolPayload | null {\n if (!isRecord(value)) return null;\n const { presets: rawPresets, writable } = value;\n if (!Array.isArray(rawPresets) || typeof writable !== 'boolean') return null;\n const presets: PresetToolEntry[] = [];\n for (const raw of rawPresets) {\n if (!isRecord(raw)) return null;\n const { id, name, description, broken, trust, skills: rawSkills, mcp: rawMcp, systemTools: rawSystem } = raw;\n if (typeof id !== 'string' || typeof name !== 'string' || (trust !== 'system' && trust !== 'user')) return null;\n if (!Array.isArray(rawMcp) || !Array.isArray(rawSystem) || !Array.isArray(rawSkills)) return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (broken !== undefined && typeof broken !== 'string') return null;\n const systemTools = parseTools(rawSystem);\n if (systemTools === null) return null;\n const skills = parseSkills(rawSkills);\n if (skills === null) return null;\n const mcp: PresetMcpServer[] = [];\n for (const rawServer of rawMcp) {\n if (!isRecord(rawServer)) return null;\n const { server, tools: rawTools, enabled, source, path } = rawServer;\n if (typeof server !== 'string' || typeof enabled !== 'boolean' || !Array.isArray(rawTools)) return null;\n if (source !== undefined && typeof source !== 'string') return null;\n if (path !== undefined && typeof path !== 'string') return null;\n const tools = parseTools(rawTools);\n if (tools === null) return null;\n mcp.push({ server, tools, enabled, ...(source === undefined ? {} : { source }), ...(path === undefined ? {} : { path }) });\n }\n presets.push({\n id,\n name,\n ...(description === undefined ? {} : { description }),\n ...(broken === undefined ? {} : { broken }),\n trust,\n skills,\n mcp,\n systemTools,\n });\n }\n return { presets, writable };\n}\n","import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';\n\nexport type {\n PresetMcpServer as PresetMcpView,\n PresetSkillRow as PresetSkillView,\n PresetToolEntry as PresetToolPresetView,\n PresetToolRow as PresetToolView,\n} from '../preset-contract.js';\nimport type { PresetToolPayload } from '../preset-contract.js';\nimport { parsePresetToolPayload } from '../preset-wire.js';\n\nexport interface PresetToolState {\n readonly loading: boolean;\n readonly payload: PresetToolPayload | null;\n readonly selectedId: string | null;\n readonly error: string | null;\n}\n\nconst INITIAL: PresetToolState = { loading: false, payload: null, selectedId: null, error: null };\nconst store = createSnapshotStore<PresetToolState>(INITIAL);\nlet epoch = 0;\nlet queue: Promise<void> = Promise.resolve();\nlet requests = 0;\n\nexport const subscribePresetTools = (listener: () => void): (() => void) => store.subscribe(listener);\nexport const getPresetToolsSnapshot = (): PresetToolState => store.getSnapshot();\n\nasync function requestPayload(init?: RequestInit): Promise<PresetToolPayload> {\n const response = await fetch('/api/capability-panel/presets', { credentials: 'same-origin', ...init });\n if (!response.ok) {\n let detail = '';\n try {\n const body = await response.json() as { error?: unknown };\n if (typeof body.error === 'string') detail = `: ${body.error}`;\n } catch {}\n throw new Error(`HTTP ${response.status}${detail}`);\n }\n const payload = parsePresetToolPayload(await response.json());\n if (payload === null) throw new Error('unexpected preset payload shape (host/client version skew?)');\n return payload;\n}\n\nfunction begin(): number {\n requests += 1;\n store.set({ ...store.getSnapshot(), loading: true, error: null });\n return epoch;\n}\n\nfunction finish(requestEpoch: number, patch: Partial<PresetToolState>): void {\n if (requestEpoch !== epoch) return;\n requests -= 1;\n const current = store.getSnapshot();\n const nextPayload = patch.payload ?? current.payload;\n const selectedExists = nextPayload?.presets.some((preset) => preset.id === current.selectedId) === true;\n store.set({\n ...current,\n ...patch,\n selectedId: selectedExists ? current.selectedId : (nextPayload?.presets[0]?.id ?? null),\n loading: requests > 0,\n });\n}\n\nexport async function loadPresetTools(): Promise<void> {\n const requestEpoch = begin();\n try {\n finish(requestEpoch, { payload: await requestPayload(), error: null });\n } catch (error) {\n finish(requestEpoch, { error: error instanceof Error ? error.message : String(error) });\n }\n}\n\nexport function selectPreset(id: string): void {\n const current = store.getSnapshot();\n if (current.payload?.presets.some((preset) => preset.id === id) !== true) return;\n store.set({ ...current, selectedId: id });\n}\n\n/** Serialized write: every toggle is one POST whose response is the new truth. */\nfunction mutate(body: { presetId: string; kind: 'tool' | 'mcp-server' | 'skill'; name: string; enabled: boolean }): Promise<void> {\n const requestEpoch = begin();\n const run = async (): Promise<void> => {\n try {\n finish(requestEpoch, {\n payload: await requestPayload({\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n }),\n error: null,\n });\n } catch (error) {\n finish(requestEpoch, { error: error instanceof Error ? error.message : String(error) });\n }\n };\n const result = queue.then(run);\n queue = result;\n return result;\n}\n\nexport function setPresetTool(presetId: string, name: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'tool', name, enabled });\n}\n\n/** Toggle one skill's default for a preset. */\nexport function setPresetSkill(presetId: string, name: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'skill', name, enabled });\n}\n\n/** Toggle a whole MCP server in one write instead of one request per tool. */\nexport function setPresetServer(presetId: string, server: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'mcp-server', name: server, enabled });\n}\n\nexport function resetPresetTools(): void {\n epoch += 1;\n requests = 0;\n queue = Promise.resolve();\n store.set(INITIAL);\n}\n","import * as React from 'react';\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { Input } from '@base-ui/react/input';\nimport { Tabs } from '@base-ui/react/tabs';\nimport { resolveDisclosure } from './disclosure.js';\nimport { chevronIcon, disclosureRow } from './disclosure-row.js';\nimport { capabilitySwitch } from './switch.js';\nimport { filterPreset } from './preset-filter.js';\nimport {\n getPresetToolsSnapshot,\n loadPresetTools,\n selectPreset,\n setPresetServer,\n setPresetSkill,\n setPresetTool,\n subscribePresetTools,\n} from './preset-store.js';\nimport type { PresetSkillView, PresetToolView } from './preset-store.js';\nimport type { Translate } from './locale.js';\nimport { TOK } from './styles.js';\n\nexport interface PresetToolSectionProps {\n readonly t: Translate;\n readonly subscribeLocale: (listener: () => void) => () => void;\n readonly getLocaleSnapshot: () => { readonly active: string; readonly revision: number };\n}\n\n/** Middle ellipsis for long path labels; the full path stays in the tooltip. */\nconst ellipsizeMiddle = (text: string, max = 56): string => {\n if (text.length <= max) return text;\n const head = Math.ceil((max - 1) / 2);\n const tail = Math.floor((max - 1) / 2);\n return `${text.slice(0, head)}…${text.slice(text.length - tail)}`;\n};\n\n/** Group items by a key, preserving first-seen order. */\nfunction groupBy<T>(items: readonly T[], keyOf: (item: T) => string): [string, T[]][] {\n const groups = new Map<string, T[]>();\n const order: string[] = [];\n for (const item of items) {\n const key = keyOf(item);\n const bucket = groups.get(key);\n if (bucket !== undefined) bucket.push(item);\n else { groups.set(key, [item]); order.push(key); }\n }\n return order.map((key) => [key, groups.get(key)!]);\n}\n\n/**\n * Settings-side twin of the composer panel. It reuses that panel's vocabulary\n * and interaction — an always-visible filter, MCP tools collapsed under their\n * server, one switch per row — because at ~200 tools a flat list is not\n * usable, and because two scopes of one feature should not feel like two\n * unrelated features.\n */\nexport function PresetToolSection(props: PresetToolSectionProps): React.ReactElement {\n const { t } = props;\n const state = React.useSyncExternalStore(subscribePresetTools, getPresetToolsSnapshot);\n React.useSyncExternalStore(props.subscribeLocale, props.getLocaleSnapshot);\n React.useEffect(() => { void loadPresetTools(); }, []);\n const [query, setQuery] = React.useState('');\n const [expanded, setExpanded] = React.useState<Record<string, boolean>>({});\n // Which categories to show. The composer panel switches between them with\n // exclusive tabs because it is a 360px popover; this panel is wide enough to\n // show all three at once, so \"all\" is the default and the tabs narrow it.\n const [kind, setKind] = React.useState<'all' | 'skills' | 'mcp' | 'system'>('all');\n\n const selected = state.payload?.presets.find((preset) => preset.id === state.selectedId);\n const filtering = query.trim() !== '';\n const view = selected === undefined ? null : filterPreset(selected, query);\n const writable = state.payload?.writable === true;\n const locked = state.loading || !writable;\n\n /** One switch, shared by tool rows, server rows and skill rows. */\n const switchFor = (\n on: boolean,\n frozen: boolean,\n label: string,\n onChange: (checked: boolean) => void,\n ): React.ReactElement =>\n capabilitySwitch({\n checked: on,\n disabled: locked || frozen,\n busy: state.loading,\n label,\n onCheckedChange: onChange,\n });\n\n /**\n * Open a source folder from the settings page. The route resolves\n * user/project/host/preset sources without a session (project sources\n * against the dsh process's own cwd, matching how this page lists them).\n */\n const openSourceFolder = (source: string): void => {\n void fetch('/api/capability-panel/open-folder', {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ source }),\n }).then((response) => {\n if (!response.ok) console.warn(`[capability-panel] cannot open source folder (${response.status})`);\n }).catch((error: unknown) => {\n console.warn('[capability-panel] open source folder request failed', error);\n });\n };\n\n /** Sources the open-folder route can resolve without a session. */\n const SESSIONLESS_OPENABLE = new Set(['user-dsh', 'user-agents', 'project-dsh', 'project-agents', 'host']);\n\n /**\n * A ruled source divider inside a settings list — the same visual language\n * as the session panel's group headers (`── label (count) ────`). Preset\n * groups name their preset; other groups show the directory (ellipsized);\n * openable groups offer the hover folder icon and a click-through.\n */\n const sourceDivider = (\n groupKey: string,\n items: readonly { path?: string }[],\n first: boolean,\n ): React.ReactElement => {\n const presetName = groupKey.startsWith('preset:') ? groupKey.slice(7) : undefined;\n const path = items.find((item) => item.path !== undefined)?.path;\n // Unknown or untranslated group keys display as-is, never the raw\n // `source.*` locale key (the session panel falls back the same way).\n const translated = t(`source.${groupKey}`);\n const fallbackLabel = translated === `source.${groupKey}` ? groupKey : translated;\n const label = presetName ?? (path !== undefined ? ellipsizeMiddle(path) : groupKey === 'host' ? t('source.host') : fallbackLabel);\n const openSource = presetName ?? groupKey;\n const openable = presetName !== undefined || SESSIONLESS_OPENABLE.has(groupKey);\n const rule = (grow: boolean): React.ReactElement =>\n React.createElement('span', {\n style: grow\n ? { flex: '1', height: '1px', background: TOK.borderStrong }\n : { flex: 'none', width: '16px', height: '1px', background: TOK.borderStrong },\n });\n return React.createElement(\n 'li',\n { key: `source:${groupKey}`, className: 'ci-source-divider' },\n React.createElement(\n 'div',\n {\n className: 'ci-source-header',\n style: { display: 'flex', alignItems: 'center', gap: '8px', margin: first ? '6px 0 2px' : '18px 0 2px' },\n },\n rule(false),\n React.createElement(\n 'span',\n {\n style: {\n flex: 'none',\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n fontSize: '12px',\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n cursor: openable ? 'pointer' : 'default',\n },\n title: openable ? t('source.openFolder', { source: path ?? label }) : undefined,\n onClick: openable ? () => { openSourceFolder(openSource); } : undefined,\n },\n openable\n ? React.createElement(\n 'span',\n { className: 'ci-folder-icon', style: { display: 'inline-grid', placeItems: 'center', opacity: 0, transition: 'opacity 0.15s' } },\n React.createElement(\n 'svg',\n { width: '12', height: '12', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': '2', 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },\n React.createElement('path', { d: 'M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z' }),\n ),\n )\n : null,\n `${label} (${items.length})`,\n ),\n rule(true),\n ),\n );\n };\n\n const toggle = (tool: PresetToolView, presetId: string): React.ReactElement =>\n switchFor(\n tool.enabled,\n tool.reserved === true,\n tool.reserved === true\n ? t('preset.reserved', { name: tool.label })\n : t(tool.enabled ? 'action.disable' : 'action.enable', { name: tool.label }),\n (checked) => { void setPresetTool(presetId, tool.name, checked); },\n );\n\n /** Expand/collapse label, worded like the composer panel's. */\n const detailAria = (subject: string, rowKey: string): string => {\n const state = resolveDisclosure(expanded[rowKey] === true, filtering);\n const detail = t('detail.description');\n if (state.disabled) return t('disclosure.pinned', { subject, detail });\n return t(state.open ? 'disclosure.collapse' : 'disclosure.expand', { subject, detail });\n };\n\n const skillRow = (skill: PresetSkillView, presetId: string): React.ReactElement => {\n const rowKey = `skill:${skill.name}`;\n return React.createElement(\n 'li',\n { key: rowKey, className: 'ci-preset-item' },\n disclosureRow({\n rowKey,\n expanded: expanded[rowKey] === true,\n filtering,\n onOpenChange: (open) => { setExpanded((prev) => ({ ...prev, [rowKey]: open })); },\n triggerLabel: detailAria(skill.name, rowKey),\n className: 'ci-preset-disclosure',\n headerClassName: 'ci-row-head ci-preset-tool-row',\n spacerClassName: 'ci-preset-spacer',\n heading: React.createElement(\n 'span',\n { className: 'ci-preset-tool-name' },\n skill.name,\n // A project skill is real but conditional: it exists because THIS\n // workspace supplies it, and a session opened elsewhere will not see\n // it. Marking beats hiding, which would just look like a short list.\n skill.project === true\n ? React.createElement('span', { className: 'ci-preset-badge' }, t('preset.projectSkill'))\n : null,\n ),\n actions: [\n switchFor(\n skill.enabled,\n false,\n t(skill.enabled ? 'action.disable' : 'action.enable', { name: skill.name }),\n (checked) => { void setPresetSkill(presetId, skill.name, checked); },\n ),\n ],\n ...(skill.description === undefined\n ? {}\n : { detail: React.createElement('div', { className: 'ci-preset-detail' }, skill.description) }),\n }),\n );\n };\n\n const toolRow = (tool: PresetToolView, presetId: string, nested: boolean): React.ReactElement => {\n const rowKey = `tool:${tool.name}`;\n return React.createElement(\n 'li',\n { key: tool.name, className: nested ? 'ci-toolrow ci-preset-item' : 'ci-preset-item' },\n disclosureRow({\n rowKey,\n expanded: expanded[rowKey] === true,\n filtering,\n onOpenChange: (open) => { setExpanded((prev) => ({ ...prev, [rowKey]: open })); },\n triggerLabel: detailAria(tool.label, rowKey),\n className: 'ci-preset-disclosure',\n headerClassName: 'ci-row-head ci-preset-tool-row',\n spacerClassName: 'ci-preset-spacer',\n heading: React.createElement('span', { className: 'ci-preset-tool-name' }, tool.label),\n actions: [toggle(tool, presetId)],\n ...(tool.description === undefined\n ? {}\n : { detail: React.createElement('div', { className: 'ci-preset-detail' }, tool.description) }),\n }),\n );\n };\n\n const body = (): React.ReactElement | null => {\n if (selected === undefined || view === null) return React.createElement('p', null, t('preset.empty'));\n if (selected.broken !== undefined) {\n return React.createElement(\n 'p',\n { role: 'alert', className: 'ci-settings-note', style: { color: TOK.error } },\n t('preset.broken', { reason: selected.broken }),\n );\n }\n if (view.total === 0) {\n return React.createElement('p', null, filtering ? t('empty.match') : t('preset.noTools'));\n }\n // The same three groups the composer panel uses, with the same labels and\n // the same shown/total counts. They are three because they are three\n // different things: skills and MCP servers both come from outside the\n // preset (the user's skills roots and the host composition), while system\n // tools are what the preset itself carries.\n const totals = {\n skills: selected.skills.length,\n mcp: selected.mcp.length,\n systemTools: selected.systemTools.length,\n };\n const groups: React.ReactElement[] = [];\n const group = (\n key: 'skills' | 'mcp' | 'system',\n label: string,\n rows: readonly React.ReactElement[],\n ): void => {\n if (kind !== 'all' && kind !== key) return;\n if (rows.length === 0) return;\n groups.push(React.createElement(\n 'section',\n { key, className: 'ci-preset-part' },\n React.createElement('h3', { className: 'ci-preset-part-title' }, label),\n React.createElement('ul', { className: 'ci-preset-tool-list' }, ...rows),\n ));\n };\n\n group(\n 'skills',\n t('group.skills', { shown: view.skills.length, total: totals.skills }),\n groupBy(view.skills, (skill) => skill.group ?? skill.source ?? 'unknown').flatMap(([groupKey, items], i) => [\n sourceDivider(groupKey, items, i === 0),\n ...items.map((skill) => skillRow(skill, selected.id)),\n ]),\n );\n\n const serverRow = (server: (typeof view.mcp)[number]): React.ReactElement => {\n const key = `mcp:${server.server}`;\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n return React.createElement(\n 'li',\n { key, className: 'ci-preset-group' },\n React.createElement(\n Collapsible.Root,\n {\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setExpanded((prev) => ({ ...prev, [key]: open })); },\n },\n React.createElement(\n 'div',\n { className: 'ci-row-head ci-preset-tool-row' },\n React.createElement(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger ci-preset-server-trigger',\n disabled: disclosure.disabled,\n },\n React.createElement('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n React.createElement(\n 'span',\n { className: 'ci-preset-tool-copy' },\n React.createElement('span', { className: 'ci-preset-tool-name' }, server.server),\n React.createElement(\n 'span',\n { className: 'ci-preset-tool-description' },\n server.tools.length === 1 ? t('server.tool.one') : t('server.tools', { count: server.tools.length }),\n ),\n ),\n ),\n // One write for the whole server: the reason a 200-tool preset is\n // tractable at all.\n switchFor(\n server.enabled,\n false,\n t(server.enabled ? 'action.disable' : 'action.enable', { name: server.server }),\n (checked) => { void setPresetServer(selected.id, server.server, checked); },\n ),\n ),\n React.createElement(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n React.createElement(\n 'ul',\n { className: 'ci-preset-tool-list' },\n ...server.tools.map((tool) => toolRow(tool, selected.id, true)),\n ),\n ),\n ),\n );\n };\n\n group(\n 'mcp',\n t('group.mcp', { shown: view.mcp.length, total: totals.mcp }),\n groupBy(view.mcp, (server) => server.source === undefined || server.source === 'host' ? 'host' : `preset:${server.source}`).flatMap(([groupKey, items], i) => [\n sourceDivider(groupKey, items, i === 0),\n ...items.map((server) => serverRow(server)),\n ]),\n );\n group(\n 'system',\n t('group.system', { shown: view.systemTools.length, total: totals.systemTools }),\n view.systemTools.map((tool) => toolRow(tool, selected.id, false)),\n );\n // Narrowing to a category that this preset has nothing in is a normal\n // outcome, not an error: say so rather than render an empty panel.\n if (groups.length === 0) {\n return React.createElement('p', null, filtering ? t('empty.match') : t('preset.noTools'));\n }\n return React.createElement(React.Fragment, null, ...groups);\n };\n\n return React.createElement(\n 'div',\n { className: 'ci-preset-section' },\n React.createElement('h2', { className: 'ci-settings-title' }, t('preset.title')),\n React.createElement('p', { className: 'ci-settings-intro' }, t('preset.intro')),\n state.error === null\n ? null\n : React.createElement('p', { role: 'alert', style: { color: TOK.error } }, t('status.error', { error: state.error })),\n state.loading && state.payload === null\n ? React.createElement('p', { 'aria-live': 'polite', style: { color: TOK.textTertiary } }, t('status.loading'))\n : null,\n state.payload === null\n ? null\n : React.createElement(\n React.Fragment,\n null,\n writable\n ? null\n : React.createElement('p', { role: 'note', className: 'ci-settings-note' }, t('preset.readonly')),\n React.createElement(\n 'div',\n { className: 'ci-preset-toolbar' },\n React.createElement(\n 'label',\n { className: 'ci-preset-picker-label' },\n React.createElement('span', null, t('preset.choose')),\n React.createElement(\n 'select',\n {\n className: 'ci-preset-picker',\n value: state.selectedId ?? '',\n onChange: (event: React.ChangeEvent<HTMLSelectElement>) => { selectPreset(event.target.value); },\n },\n ...state.payload.presets.map((preset) => React.createElement('option', { key: preset.id, value: preset.id }, preset.name)),\n ),\n ),\n React.createElement(Input, {\n className: 'ci-filter ci-preset-filter',\n value: query,\n placeholder: t('filter.placeholder'),\n 'aria-label': t('filter.aria'),\n autoComplete: 'off',\n spellCheck: false,\n name: 'ci-preset-filter',\n onChange: (event: { target: { value: string } }) => { setQuery(event.target.value); },\n onKeyDown: (event: { key: string }) => { if (event.key === 'Escape' && filtering) setQuery(''); },\n }),\n ),\n // Same three categories, same words, as the composer panel's tabs --\n // plus \"all\", because this panel is wide enough to show every group\n // at once and that is the useful default here.\n selected === undefined\n ? null\n : React.createElement(\n Tabs.Root,\n {\n value: kind,\n onValueChange: (value: string) => { setKind(value as 'all' | 'skills' | 'mcp' | 'system'); },\n className: 'ci-preset-kinds',\n },\n React.createElement(\n Tabs.List,\n { 'aria-label': t('preset.kindAria'), className: 'ci-tabs' },\n React.createElement(Tabs.Tab, { value: 'all', className: 'ci-tab' }, t('tab.all')),\n React.createElement(Tabs.Tab, { value: 'skills', className: 'ci-tab' }, `${t('tab.skills')} ${selected.skills.length}`),\n React.createElement(Tabs.Tab, { value: 'mcp', className: 'ci-tab' }, `${t('tab.mcp')} ${selected.mcp.length}`),\n React.createElement(\n Tabs.Tab,\n { value: 'system', className: 'ci-tab', 'aria-label': t('tab.system.aria', { count: selected.systemTools.length }) },\n `${t('tab.system')} ${selected.systemTools.length}`,\n ),\n ),\n ),\n selected?.description === undefined\n ? null\n : React.createElement('p', { className: 'ci-settings-description' }, selected.description),\n view === null || !filtering\n ? null\n : React.createElement(\n 'p',\n { 'aria-live': 'polite', className: 'ci-settings-description' },\n t('filter.count', { shown: view.total, total: selected === undefined ? 0 : selected.skills.length + selected.mcp.length + selected.systemTools.length }),\n ),\n body(),\n ),\n );\n}\n","import { isMouseLikePointerType } from \"../utils/event.mjs\";\nexport { isTargetInsideEnabledTrigger as isInsideEnabledTrigger } from \"../utils/element.mjs\";\nfunction resolveValue(value, pointerType) {\n if (pointerType != null && !isMouseLikePointerType(pointerType)) {\n return 0;\n }\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function getDelay(value, prop, pointerType) {\n const result = resolveValue(value, pointerType);\n if (typeof result === 'number') {\n return result;\n }\n return result?.[prop];\n}\nexport function getRestMs(value) {\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function isClickLikeOpenEvent(openEventType, interactedInside) {\n return interactedInside || openEventType === 'click' || openEventType === 'mousedown';\n}\nexport function isHoverOpenEvent(openEventType) {\n return openEventType?.includes('mouse') && openEventType !== 'mousedown';\n}","/**\n * Combines multiple cleanup functions into a single cleanup function.\n */\nexport function mergeCleanups(...cleanups) {\n return () => {\n for (let i = 0; i < cleanups.length; i += 1) {\n const cleanup = cleanups[i];\n if (cleanup) {\n cleanup();\n }\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { platform } from '@base-ui/utils/platform';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n const [role, setRole] = React.useState();\n useIsoLayoutEffect(() => {\n // Unlike NVDA and JAWS, VoiceOver's virtual cursor triggers `onFocus` as\n // it moves — but only on focusable/role-button elements through WebKit's\n // NSAccessibility path. Setting `role=\"button\"` lets the focus trap catch\n // the cursor.\n if (platform.screenReader.voiceOver && platform.engine.webkit) {\n setRole('button');\n }\n }, []);\n const restProps = {\n tabIndex: 0,\n // Role is only for VoiceOver\n role\n };\n return /*#__PURE__*/_jsx(\"span\", {\n ...props,\n ref: ref,\n style: visuallyHidden,\n \"aria-hidden\": role ? undefined : true,\n ...restProps,\n \"data-base-ui-focus-guard\": \"\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") FocusGuard.displayName = \"FocusGuard\";","export function createAttribute(name) {\n return `data-base-ui-${name}`;\n}","import { NOOP } from '@base-ui/utils/empty';\nlet rafId = 0;\nexport function enqueueFocus(el, options = {}) {\n const {\n preventScroll = false,\n sync = false,\n shouldFocus\n } = options;\n cancelAnimationFrame(rafId);\n function exec() {\n if (shouldFocus && !shouldFocus()) {\n return;\n }\n el?.focus({\n preventScroll\n });\n }\n if (sync) {\n exec();\n return NOOP;\n }\n const currentRafId = requestAnimationFrame(exec);\n rafId = currentRafId;\n return () => {\n if (rafId === currentRafId) {\n cancelAnimationFrame(currentRafId);\n rafId = 0;\n }\n };\n}","// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nimport { getNodeName, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nconst counters = {\n inert: new WeakMap(),\n 'aria-hidden': new WeakMap()\n};\nconst markerName = 'data-base-ui-inert';\nconst uncontrolledElementsSets = {\n inert: new WeakSet(),\n 'aria-hidden': new WeakSet()\n};\nlet markerCounterMap = new WeakMap();\nlet lockCount = 0;\nfunction getUncontrolledElementsSet(controlAttribute) {\n return uncontrolledElementsSets[controlAttribute];\n}\nfunction unwrapHost(node) {\n if (!node) {\n return null;\n }\n return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);\n}\nconst correctElements = (parent, targets) => targets.map(target => {\n if (parent.contains(target)) {\n return target;\n }\n const correctedTarget = unwrapHost(target);\n if (parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n return null;\n}).filter(x => x != null);\nconst buildKeepSet = targets => {\n const keep = new Set();\n targets.forEach(target => {\n let node = target;\n while (node && !keep.has(node)) {\n keep.add(node);\n node = node.parentNode;\n }\n });\n return keep;\n};\nconst collectOutsideElements = (root, keepElements, stopElements) => {\n const outside = [];\n const walk = parent => {\n if (!parent || stopElements.has(parent)) {\n return;\n }\n Array.from(parent.children).forEach(node => {\n if (getNodeName(node) === 'script') {\n return;\n }\n if (keepElements.has(node)) {\n walk(node);\n } else {\n outside.push(node);\n }\n });\n };\n walk(root);\n return outside;\n};\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {\n mark = true\n}) {\n let controlAttribute = null;\n if (inert) {\n controlAttribute = 'inert';\n } else if (ariaHidden) {\n controlAttribute = 'aria-hidden';\n }\n let counterMap = null;\n let uncontrolledElementsSet = null;\n const avoidElements = correctElements(body, uncorrectedAvoidElements);\n const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];\n const hiddenElements = [];\n const markedElements = [];\n if (controlAttribute) {\n const map = counters[controlAttribute];\n const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);\n uncontrolledElementsSet = currentUncontrolledElementsSet;\n counterMap = map;\n const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));\n const controlElements = avoidElements.concat(ariaLiveElements);\n const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));\n controlTargets.forEach(node => {\n const attr = node.getAttribute(controlAttribute);\n const alreadyHidden = attr !== null && attr !== 'false';\n const counterValue = (map.get(node) || 0) + 1;\n map.set(node, counterValue);\n hiddenElements.push(node);\n if (counterValue === 1 && alreadyHidden) {\n currentUncontrolledElementsSet.add(node);\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n }\n });\n }\n if (mark) {\n markerTargets.forEach(node => {\n const markerValue = (markerCounterMap.get(node) || 0) + 1;\n markerCounterMap.set(node, markerValue);\n markedElements.push(node);\n if (markerValue === 1) {\n node.setAttribute(markerName, '');\n }\n });\n }\n lockCount += 1;\n return () => {\n if (counterMap) {\n hiddenElements.forEach(element => {\n const currentCounterValue = counterMap.get(element) || 0;\n const counterValue = currentCounterValue - 1;\n counterMap.set(element, counterValue);\n if (!counterValue) {\n if (!uncontrolledElementsSet?.has(element) && controlAttribute) {\n element.removeAttribute(controlAttribute);\n }\n uncontrolledElementsSet?.delete(element);\n }\n });\n }\n if (mark) {\n markedElements.forEach(element => {\n const markerValue = (markerCounterMap.get(element) || 0) - 1;\n markerCounterMap.set(element, markerValue);\n if (!markerValue) {\n element.removeAttribute(markerName);\n }\n });\n }\n lockCount -= 1;\n if (!lockCount) {\n counters.inert = new WeakMap();\n counters['aria-hidden'] = new WeakMap();\n uncontrolledElementsSets.inert = new WeakSet();\n uncontrolledElementsSets['aria-hidden'] = new WeakSet();\n markerCounterMap = new WeakMap();\n }\n };\n}\nexport function markOthers(avoidElements, options = {}) {\n const {\n ariaHidden = false,\n inert = false,\n mark = true\n } = options;\n const body = ownerDocument(avoidElements[0]).body;\n return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {\n mark\n });\n}","export const TYPEAHEAD_RESET_MS = 500;\nexport const PATIENT_CLICK_THRESHOLD = 500;\nexport const DISABLED_TRANSITIONS_STYLE = {\n style: {\n transition: 'none'\n }\n};\nexport const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';\nexport const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';\nexport const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';\nexport const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;\nexport const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;\n\n/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'none'\n};\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'end'\n};\n\n/**\n * Special visually hidden styles for the aria-owns owner element to ensure owned element\n * accessibility in iOS/Safari/VoiceControl.\n * The owner element is an empty span, so most of the common visually hidden styles are not needed.\n * @see https://github.com/floating-ui/floating-ui/issues/3403\n */\nexport const ownerVisuallyHidden = {\n clipPath: 'inset(50%)',\n position: 'fixed',\n top: 0,\n left: 0\n};","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { isNode } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { enableFocusInside, disableFocusInside, getPreviousTabbable, getNextTabbable, isOutsideEvent } from \"../utils/tabbable.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ownerVisuallyHidden } from \"../../internals/constants.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") PortalContext.displayName = \"PortalContext\";\nexport const usePortalContext = () => React.useContext(PortalContext);\nconst attr = createAttribute('portal');\nexport function useFloatingPortalNode(props = {}) {\n const {\n ref,\n container: containerProp,\n componentProps = EMPTY_OBJECT,\n elementProps\n } = props;\n const uniqueId = useId();\n const portalContext = usePortalContext();\n const parentPortalNode = portalContext?.portalNode;\n const [containerElement, setContainerElement] = React.useState(null);\n const [portalNode, setPortalNode] = React.useState(null);\n const setPortalNodeRef = useStableCallback(node => {\n if (node !== null) {\n // the useIsoLayoutEffect below watching containerProp / parentPortalNode\n // sets setPortalNode(null) when the container becomes null or changes.\n // So even though the ref callback now ignores null, the portal node still gets cleared.\n setPortalNode(node);\n }\n });\n const containerRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n // Wait for the container to be resolved if explicitly `null`.\n if (containerProp === null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;\n if (resolvedContainer == null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n if (containerRef.current !== resolvedContainer) {\n containerRef.current = resolvedContainer;\n setPortalNode(null);\n setContainerElement(resolvedContainer);\n }\n }, [containerProp, parentPortalNode]);\n const portalElement = useRenderElement('div', componentProps, {\n ref: [ref, setPortalNodeRef],\n props: [{\n id: uniqueId,\n [attr]: ''\n }, elementProps]\n });\n\n // This `createPortal` call injects `portalElement` into the `container`.\n // Another call inside `FloatingPortal`/`FloatingPortalLite` then injects the children into `portalElement`.\n const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ReactDOM.createPortal(portalElement, containerElement) : null;\n return {\n node: portalNode,\n // `id` and `render` props can override or remove the generated ID. Use the exact\n // rendered value so `aria-owns` never points at an ID absent from the DOM.\n nodeId: /*#__PURE__*/React.isValidElement(portalElement) ? portalElement.props.id : undefined,\n subtree: portalSubtree\n };\n}\n\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n * @internal\n */\nexport const FloatingPortal = /*#__PURE__*/React.forwardRef(function FloatingPortal(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n container,\n ...elementProps\n } = componentProps;\n const {\n node: portalNode,\n nodeId: portalNodeId,\n subtree: portalSubtree\n } = useFloatingPortalNode({\n container,\n ref: forwardedRef,\n componentProps,\n elementProps\n });\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const [focusManagerState, setFocusManagerState] = React.useState(null);\n const focusInsideDisabledRef = React.useRef(false);\n const modal = focusManagerState?.modal;\n const open = focusManagerState?.open;\n const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!portalNode || modal) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (portalNode && event.relatedTarget && isOutsideEvent(event)) {\n if (event.type === 'focusin') {\n if (focusInsideDisabledRef.current) {\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }\n } else {\n disableFocusInside(portalNode);\n focusInsideDisabledRef.current = true;\n }\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));\n }, [portalNode, modal]);\n useIsoLayoutEffect(() => {\n if (!portalNode || open !== true || !focusInsideDisabledRef.current) {\n return;\n }\n\n // Restore tabbability before the focus manager's queued focus-on-open step runs.\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }, [open, portalNode]);\n const portalContextValue = React.useMemo(() => ({\n beforeOutsideRef,\n afterOutsideRef,\n beforeInsideRef,\n afterInsideRef,\n portalNode,\n setFocusManagerState\n }), [portalNode]);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [portalSubtree, /*#__PURE__*/_jsxs(PortalContext.Provider, {\n value: portalContextValue,\n children: [shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: beforeOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n beforeInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n }\n }\n }), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(\"span\", {\n \"aria-owns\": portalNodeId,\n style: ownerVisuallyHidden\n }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: afterOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n afterInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n if (focusManagerState?.closeOnFocusOut) {\n focusManagerState?.onOpenChange(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") FloatingPortal.displayName = \"FloatingPortal\";","export function createEventEmitter() {\n const map = new Map();\n return {\n emit(event, data) {\n map.get(event)?.forEach(listener => listener(data));\n },\n on(event, listener) {\n if (!map.has(event)) {\n map.set(event, new Set());\n }\n map.get(event).add(listener);\n },\n off(event, listener) {\n map.get(event)?.delete(listener);\n }\n };\n}","import { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\n\n/**\n * Stores and manages floating elements in a tree structure.\n * This is a backing store for the `FloatingTree` component.\n */\nexport class FloatingTreeStore {\n nodesRef = {\n current: []\n };\n events = createEventEmitter();\n addNode(node) {\n this.nodesRef.current.push(node);\n }\n removeNode(node) {\n const index = this.nodesRef.current.findIndex(n => n === node);\n if (index !== -1) {\n this.nodesRef.current.splice(index, 1);\n }\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FloatingTreeStore } from \"./FloatingTreeStore.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") FloatingNodeContext.displayName = \"FloatingNodeContext\";\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nif (process.env.NODE_ENV !== \"production\") FloatingTreeContext.displayName = \"FloatingTreeContext\";\nexport const useFloatingParentNodeId = () => React.useContext(FloatingNodeContext)?.id || null;\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nexport const useFloatingTree = externalTree => {\n const contextTree = React.useContext(FloatingTreeContext);\n return externalTree ?? contextTree;\n};\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nexport function useFloatingNodeId(externalTree) {\n const id = useId();\n const tree = useFloatingTree(externalTree);\n const parentId = useFloatingParentNodeId();\n useIsoLayoutEffect(() => {\n if (!id) {\n return undefined;\n }\n const node = {\n id,\n parentId\n };\n tree?.addNode(node);\n return () => {\n tree?.removeNode(node);\n };\n }, [tree, id, parentId]);\n return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingNode(props) {\n const {\n children,\n id\n } = props;\n const parentId = useFloatingParentNodeId();\n return /*#__PURE__*/_jsx(FloatingNodeContext.Provider, {\n value: React.useMemo(() => ({\n id,\n parentId\n }), [id, parentId]),\n children: children\n });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingTree(props) {\n const {\n children,\n externalTree\n } = props;\n const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;\n return /*#__PURE__*/_jsx(FloatingTreeContext.Provider, {\n value: tree,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { platform } from '@base-ui/utils/platform';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { activeElement, contains, getTarget, isTypeableCombobox, getFloatingFocusElement, isTypeableElement } from \"../utils/element.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nimport { tabbable, focusable, isOutsideEvent, isTabbable, getNextTabbable, getPreviousTabbable } from \"../utils/tabbable.mjs\";\nimport { getNodeAncestors, getNodeChildren } from \"../utils/nodes.mjs\";\nimport { isElementVisible } from \"../utils/composite.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { markOthers } from \"../utils/markOthers.mjs\";\nimport { usePortalContext } from \"./FloatingPortal.mjs\";\nimport { useFloatingTree } from \"./FloatingTree.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { resolveRef } from \"../../utils/resolveRef.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction getEventType(event, lastInteractionType) {\n const win = ownerWindow(getTarget(event));\n if (event instanceof win.KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof win.FocusEvent) {\n // Focus events can be caused by a preceding pointer interaction (e.g., focusout on outside press).\n // Prefer the last known pointer type if provided, else treat as keyboard.\n return lastInteractionType || 'keyboard';\n }\n if ('pointerType' in event) {\n return event.pointerType || 'keyboard';\n }\n if ('touches' in event) {\n return 'touch';\n }\n if (event instanceof win.MouseEvent) {\n // onClick events may not contain pointer events, and will fall through to here\n return lastInteractionType || (event.detail === 0 ? 'keyboard' : 'mouse');\n }\n return '';\n}\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n previouslyFocusedElements = previouslyFocusedElements.filter(entry => {\n return entry.deref()?.isConnected;\n });\n}\nfunction addPreviouslyFocusedElement(element) {\n clearDisconnectedPreviouslyFocusedElements();\n if (element && getNodeName(element) !== 'body') {\n previouslyFocusedElements.push(new WeakRef(element));\n if (previouslyFocusedElements.length > LIST_LIMIT) {\n previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);\n }\n }\n}\nfunction getPreviouslyFocusedElement() {\n clearDisconnectedPreviouslyFocusedElements();\n return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();\n}\nfunction getFirstTabbableElement(container) {\n if (!container) {\n return null;\n }\n if (isTabbable(container)) {\n return container;\n }\n return tabbable(container)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement) {\n if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {\n return;\n }\n if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) {\n return;\n }\n const focusableElements = focusable(floatingFocusElement);\n const tabbableContent = focusableElements.filter(element => {\n const dataTabIndex = element.getAttribute('data-tabindex') || '';\n return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n });\n const tabIndex = floatingFocusElement.getAttribute('tabindex');\n if (tabbableContent.length === 0) {\n if (tabIndex !== '0') {\n floatingFocusElement.setAttribute('tabindex', '0');\n // Mark our own write so the externally-managed early-return above doesn't\n // mistake it for a user-authored `tabindex` and freeze management.\n floatingFocusElement.setAttribute('data-tabindex', '0');\n }\n } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n floatingFocusElement.setAttribute('tabindex', '-1');\n floatingFocusElement.setAttribute('data-tabindex', '-1');\n }\n}\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n * @internal\n */\nexport function FloatingFocusManager(props) {\n const {\n context,\n children,\n disabled = false,\n initialFocus = true,\n returnFocus = true,\n restoreFocus = false,\n modal = true,\n closeOnFocusOut = true,\n openInteractionType = '',\n nextFocusableElement,\n previousFocusableElement,\n beforeContentFocusGuardRef,\n externalTree,\n getInsideElements\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const domReference = store.useState('domReferenceElement');\n const floating = store.useState('floatingElement');\n const {\n events,\n dataRef\n } = store.context;\n const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);\n const ignoreInitialFocus = initialFocus === false;\n // A typeable combobox reference (e.g. input/textarea) with `initialFocus={false}`\n // has different focus semantics: focus is not trapped inside the floating element,\n // so in the modal case the guards are not rendered, but `aria-hidden` is still\n // applied to the outside nodes.\n const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n const initialFocusRef = useValueAsRef(initialFocus);\n const returnFocusRef = useValueAsRef(returnFocus);\n const openInteractionTypeRef = useValueAsRef(openInteractionType);\n const openRef = useValueAsRef(open);\n const tree = useFloatingTree(externalTree);\n const portalContext = usePortalContext();\n const preventReturnFocusRef = React.useRef(false);\n const isPointerDownRef = React.useRef(false);\n const pointerDownOutsideRef = React.useRef(false);\n const lastFocusedTabbableRef = React.useRef(null);\n const closeTypeRef = React.useRef('');\n const lastInteractionTypeRef = React.useRef('');\n const beforeGuardRef = React.useRef(null);\n const afterGuardRef = React.useRef(null);\n const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);\n const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);\n const blurTimeout = useTimeout();\n const pointerDownTimeout = useTimeout();\n const restoreFocusFrame = useAnimationFrame();\n const isInsidePortal = portalContext != null;\n const floatingFocusElement = getFloatingFocusElement(floating);\n const getTabbableContent = useStableCallback((container = floatingFocusElement) => {\n return container ? tabbable(container) : [];\n });\n const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);\n\n // Prevent Tab from escaping the modal when there are no tabbable elements.\n React.useEffect(() => {\n if (disabled || !modal) {\n return undefined;\n }\n function onKeyDown(event) {\n if (event.key === 'Tab') {\n // The focus guards have nothing to focus, so we need to stop the event.\n if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n stopEvent(event);\n }\n }\n }\n const doc = ownerDocument(floatingFocusElement);\n return addEventListener(doc, 'keydown', onKeyDown);\n }, [disabled, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);\n\n // Track pointer/keyboard interactions to disambiguate focus and outside presses.\n React.useEffect(() => {\n if (disabled || !open) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n function clearPointerDownOutside() {\n pointerDownOutsideRef.current = false;\n }\n function onPointerDown(event) {\n const target = getTarget(event);\n const insideElements = getResolvedInsideElements();\n const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));\n pointerDownOutsideRef.current = !pointerTargetInside;\n lastInteractionTypeRef.current = event.pointerType || 'keyboard';\n if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {\n isPointerDownRef.current = true;\n // Reset on the next tick so a single click on a click-trigger doesn't\n // permanently suppress focus-out closing for the lifetime of the instance.\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n }\n function onKeyDown() {\n lastInteractionTypeRef.current = 'keyboard';\n }\n return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true),\n // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)\n // if the popup dismissed between pointerdown and pointerup.\n clearPointerDownOutside);\n }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);\n\n // Close on focus out and restore focus within the floating tree when needed.\n React.useEffect(() => {\n if (disabled || !closeOnFocusOut) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n\n // In Safari, buttons lose focus when pressing them.\n function handlePointerDown() {\n isPointerDownRef.current = true;\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n function handleFocusIn(event) {\n const target = getTarget(event);\n if (isTabbable(target)) {\n lastFocusedTabbableRef.current = target;\n }\n }\n function handleFocusOutside(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n const target = getTarget(event);\n\n // When focus is lost to the body (e.g. on a backdrop press), record the element that\n // had focus so a confirmation dialog opened while the body is focused can return focus\n // to it. Scoped to `modal` to avoid non-modal popups polluting the shared stack.\n if (modal && relatedTarget == null && target != null && contains(floating, target)) {\n addPreviouslyFocusedElement(target);\n }\n queueMicrotask(() => {\n const nodeId = getNodeId();\n const triggers = store.context.triggerElements;\n const insideElements = getResolvedInsideElements();\n const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);\n const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));\n if (currentTarget === domReference && floatingFocusElement) {\n handleTabIndex(floatingFocusElement);\n }\n\n // Restore focus to the previously focused tabbable element to prevent\n // focus from being lost outside the floating tree.\n if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {\n // Let `FloatingPortal` effect knows that focus is still inside the\n // floating tree.\n if (isHTMLElement(floatingFocusElement)) {\n floatingFocusElement.focus();\n // If explicitly requested to restore focus to the popup container, do not search\n // for the next/previous tabbable element.\n if (restoreFocus === 'popup') {\n // If the focused element is removed on pointerdown, the browser\n // tries to move focus to it right after the `.focus()` call above,\n // but because it's removed in the same tick, focus is lost instead.\n // Re-focusing asynchronously (next frame) wins that race.\n restoreFocusFrame.request(() => {\n floatingFocusElement.focus();\n });\n return;\n }\n }\n const tabbableContent = getTabbableContent();\n const prevTabbable = lastFocusedTabbableRef.current;\n const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n if (isHTMLElement(nodeToFocus)) {\n nodeToFocus.focus();\n }\n }\n\n // https://github.com/floating-ui/floating-ui/issues/3060\n if (dataRef.current.insideReactTree) {\n dataRef.current.insideReactTree = false;\n return;\n }\n\n // Focus did not move inside the floating tree, and there are no tabbable\n // portal guards to handle closing.\n if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (\n // Fix React 18 Strict Mode returnFocus due to double rendering.\n // For an \"untrapped\" typeable combobox (input role=combobox with\n // initialFocus=false), re-opening the popup and tabbing out should still close it even\n // when the previously focused element (e.g. the next tabbable outside the popup) is\n // focused again. Otherwise, the popup remains open on the second Tab sequence:\n // click input -> Tab (closes) -> click input -> Tab.\n // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.\n isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {\n preventReturnFocusRef.current = true;\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event));\n }\n });\n }\n function markInsideReactTree() {\n if (pointerDownOutsideRef.current) {\n return;\n }\n dataRef.current.insideReactTree = true;\n blurTimeout.start(0, () => {\n dataRef.current.insideReactTree = false;\n });\n }\n const domReferenceElement = isHTMLElement(domReference) ? domReference : null;\n if (!floating && !domReferenceElement) {\n return undefined;\n }\n return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));\n }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Hide everything outside the floating tree from assistive tech while open.\n React.useEffect(() => {\n if (disabled || !floating || !open) {\n return undefined;\n }\n\n // Don't hide portals nested within the parent portal.\n const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);\n const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;\n const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];\n const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n const ariaHiddenCleanup = markOthers(insideElements, {\n ariaHidden: modal || isUntrappedTypeableCombobox,\n mark: false\n });\n const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);\n const markerCleanup = markOthers(markerInsideElements);\n return () => {\n markerCleanup();\n ariaHiddenCleanup();\n };\n }, [open, disabled, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Focus the initial element when the floating element opens.\n useIsoLayoutEffect(() => {\n if (!open || disabled || !isHTMLElement(floatingFocusElement)) {\n return;\n }\n closeTypeRef.current = '';\n lastInteractionTypeRef.current = '';\n const doc = ownerDocument(floatingFocusElement);\n const previouslyFocusedElement = activeElement(doc);\n\n // Wait for any layout effect state setters to execute to set `tabIndex`.\n queueMicrotask(() => {\n const initialFocusValueOrFn = initialFocusRef.current;\n const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {\n return;\n }\n const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);\n if (focusAlreadyInsideFloatingEl) {\n return;\n }\n let focusableElements = null;\n const getDefaultFocusElement = () => {\n if (focusableElements == null) {\n focusableElements = getTabbableContent(floatingFocusElement);\n }\n return focusableElements[0] || floatingFocusElement;\n };\n let elToFocus;\n if (resolvedInitialFocus === true || resolvedInitialFocus === null) {\n elToFocus = getDefaultFocusElement();\n } else {\n elToFocus = resolveRef(resolvedInitialFocus);\n }\n elToFocus = elToFocus || getDefaultFocusElement();\n const hadFocusInside = contains(floatingFocusElement, activeElement(doc));\n\n // enqueueFocus returns a rAF-cancel function; we intentionally don't cancel this focus.\n void enqueueFocus(elToFocus, {\n preventScroll: elToFocus === floatingFocusElement,\n shouldFocus() {\n // This focus is queued on the next animation frame. If the floating element has closed\n // before it runs — e.g. tabbing out of a kept-mounted popup — don't pull focus back\n // onto the initial element after it has legitimately moved elsewhere.\n if (!openRef.current) {\n return false;\n }\n if (hadFocusInside) {\n return true;\n }\n const currentActiveElement = activeElement(doc);\n const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);\n return !focusMovedInside;\n }\n });\n });\n }, [disabled, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);\n\n // Track return focus targets and restore focus on unmount/close.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n const elementFocusedBeforeOpen = activeElement(doc);\n // Only an explicit `null` interaction type represents a programmatic open.\n // `undefined` is normalized to `''` by the prop default, so it never reaches\n // here as nullish and is intentionally not treated as programmatic.\n const preferPreviousFocus = openInteractionTypeRef.current == null;\n addPreviouslyFocusedElement(elementFocusedBeforeOpen);\n function onOpenChangeLocal(details) {\n if (!details.open) {\n closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);\n }\n if (details.reason === REASONS.triggerHover && details.nativeEvent.type === 'mouseleave') {\n preventReturnFocusRef.current = true;\n }\n if (details.reason !== REASONS.outsidePress) {\n return;\n }\n if (details.nested) {\n preventReturnFocusRef.current = false;\n } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {\n preventReturnFocusRef.current = false;\n } else {\n // On outside press, only return focus to the reference when the browser supports the\n // `focus({ preventScroll })` option; without it, restoring focus scrolls the page.\n // Chrome on Android and Samsung Internet still don't support `preventScroll`\n // (https://issues.chromium.org/issues/41453122), so the runtime check keeps return\n // focus disabled there to avoid the scroll jump.\n let isPreventScrollSupported = false;\n ownerDocument(floatingFocusElement).createElement('div').focus({\n get preventScroll() {\n isPreventScrollSupported = true;\n return false;\n }\n });\n if (isPreventScrollSupported) {\n preventReturnFocusRef.current = false;\n } else {\n preventReturnFocusRef.current = true;\n }\n }\n }\n events.on('openchange', onOpenChangeLocal);\n function getReturnElement(closeType) {\n const returnFocusValueOrFn = returnFocusRef.current;\n let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedReturnFocusValue === undefined || resolvedReturnFocusValue === false) {\n return null;\n }\n if (resolvedReturnFocusValue === null) {\n resolvedReturnFocusValue = true;\n }\n const referenceReturnElement = domReference?.isConnected ? domReference : null;\n const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== 'body' ? elementFocusedBeforeOpen : null;\n let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;\n if (!defaultReturnElement) {\n defaultReturnElement = getPreviouslyFocusedElement() || null;\n }\n if (typeof resolvedReturnFocusValue === 'boolean') {\n return defaultReturnElement;\n }\n return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;\n }\n return () => {\n events.off('openchange', onOpenChangeLocal);\n const activeEl = activeElement(doc);\n const insideElements = getResolvedInsideElements();\n const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const returnFocusValueOrFn = returnFocusRef.current;\n const closeType = closeTypeRef.current;\n const returnElement = getReturnElement(closeType);\n queueMicrotask(() => {\n // `returnElement` if it is tabbable, otherwise its first tabbable child,\n // otherwise `returnElement` itself (which may not be tabbable at all).\n const tabbableReturnElement = getFirstTabbableElement(returnElement);\n const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';\n if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n // If the focus moved somewhere else after mount, avoid returning focus\n // since it likely entered a different element which should be\n // respected: https://github.com/floating-ui/floating-ui/issues/2607\n !hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n const focusOptions = {\n preventScroll: true\n };\n if (closeType === 'keyboard') {\n focusOptions.focusVisible = true;\n }\n tabbableReturnElement.focus(focusOptions);\n }\n preventReturnFocusRef.current = false;\n });\n };\n }, [disabled, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);\n\n // Safari may randomly scroll to the bottom of the page if an input inside a popup has focus\n // when the popup unmounts from the DOM.\n // By blurring it before the popup unmounts, we can prevent this behavior.\n useIsoLayoutEffect(() => {\n if (!platform.engine.webkit || open || !floating) {\n return;\n }\n const activeEl = activeElement(ownerDocument(floating));\n if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {\n return;\n }\n if (contains(floating, activeEl)) {\n activeEl.blur();\n }\n }, [open, floating]);\n\n // Synchronize the focus manager state (modal, closeOnFocusOut, open, etc.) to the\n // FloatingPortal context, which uses it to decide whether to render its own guards.\n useIsoLayoutEffect(() => {\n if (disabled || !portalContext) {\n return undefined;\n }\n portalContext.setFocusManagerState({\n modal,\n closeOnFocusOut,\n open,\n onOpenChange: store.setOpen,\n domReference\n });\n return () => {\n portalContext.setFocusManagerState(null);\n };\n }, [disabled, portalContext, modal, open, store, closeOnFocusOut, domReference]);\n\n // Keep the floating element tabIndex in sync and clear stale focus records.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n handleTabIndex(floatingFocusElement);\n return () => {\n queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n };\n }, [disabled, floatingFocusElement]);\n const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedBeforeGuardRef,\n onFocus: event => {\n if (modal) {\n const els = getTabbableContent();\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(els[els.length - 1]);\n } else if (portalContext?.portalNode) {\n preventReturnFocusRef.current = false;\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n } else {\n resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();\n }\n }\n }\n }), children, shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedAfterGuardRef,\n onFocus: event => {\n if (modal) {\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(getTabbableContent()[0]);\n } else if (portalContext?.portalNode) {\n if (closeOnFocusOut) {\n preventReturnFocusRef.current = true;\n }\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n } else {\n resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();\n }\n }\n }\n })]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getTarget, isTypeableElement } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType, isVirtualPointerEvent } from \"../utils/event.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nexport function useClick(context, props = {}) {\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n stickIfOpen = true,\n touchOpenDelay = 0,\n reason = REASONS.triggerPress\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const dataRef = store.context.dataRef;\n const pointerTypeRef = React.useRef(undefined);\n const frame = useAnimationFrame();\n const touchOpenTimeout = useTimeout();\n const reference = React.useMemo(() => {\n function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {\n const details = createChangeEventDetails(reason, nativeEvent, target);\n if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {\n touchOpenTimeout.start(touchOpenDelay, () => {\n store.setOpen(true, details);\n });\n } else {\n store.setOpen(nextOpen, details);\n }\n }\n function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {\n const openEvent = dataRef.current.openEvent;\n const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== currentTarget;\n if (open && hasClickedOnInactiveTrigger) {\n // Moving between triggers should always open the newly active one.\n return true;\n }\n if (!open) {\n // A closed popup should open on the next press.\n return true;\n }\n if (!toggle) {\n // Non-toggle mode never closes on a repeated trigger press.\n return true;\n }\n if (openEvent && stickIfOpen) {\n // Preserve hover/focus-opened popups until the matching click-like event closes them.\n return !isClickLikeOpenEvent(openEvent.type);\n }\n\n // Otherwise, a repeated click toggles the popup closed.\n return false;\n }\n return {\n onPointerDown(event) {\n // Screen reader activations (Android TalkBack, desktop screen readers) report a\n // mouse-like `pointerType`, but `ignoreMouse` must not drop them: hover logic cannot\n // open for a virtual press since there is no real pointer movement to wait for.\n // Virtual `touch` presses (iOS VoiceOver) keep their type so `touchOpenDelay` applies.\n pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? 'virtual' : event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n const nativeEvent = event.nativeEvent;\n const open = store.select('open');\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0 || eventOption === 'click' || isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown');\n\n // Animations sometimes won't run on a typeable element if using a rAF.\n // Focus is always set on these elements. For touch, we may delay opening.\n const target = getTarget(nativeEvent);\n if (isTypeableElement(target)) {\n setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);\n return;\n }\n\n // Capture the currentTarget before the rAF.\n // as React sets it to null after the event handler completes.\n const eventCurrentTarget = event.currentTarget;\n\n // Wait until focus is set on the element. This is an alternative to\n // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.\n frame.request(() => {\n setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);\n });\n },\n onClick(event) {\n if (eventOption === 'mousedown-only') {\n return;\n }\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerType) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const open = store.select('open');\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown' || openEventType === 'keydown' || openEventType === 'keyup');\n setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);\n },\n onKeyDown() {\n pointerTypeRef.current = undefined;\n }\n };\n }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);\n return React.useMemo(() => enabled ? {\n reference\n } : EMPTY_OBJECT, [enabled, reference]);\n}","'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n React.useEffect(() => {\n if (!open || !enabled) {\n return clearInsideReactTree;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // In intentional mode, a press that starts inside and ends outside gets\n // one suppressed outside click. Run this after inside-target checks so\n // inside clicks don't consume the one-shot suppression.\n if (getOutsidePressEvent() === 'intentional' && suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n if (event.type === 'pointerdown') {\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const doc = ownerDocument(floatingElement);\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, true), addEventListener(doc, 'touchmove', handleTouchMoveCapture, true), addEventListener(doc, 'touchend', handleTouchEndCapture, true)));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n clearInsideReactTree();\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n const alignment = getAlignment(placement);\n if (alignment) {\n coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(minPadding, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n\n // No rects (e.g. a hidden or detached reference, or a collapsed range) —\n // keep the existing reference rect rather than resetting to an invalid\n // one with non-finite values.\n if (!nativeClientRects.length) {\n return {};\n }\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n return rectToClientRect({\n x: left,\n y: top,\n width: right - left,\n height: bottom - top\n });\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n return rectToClientRect({\n x: minLeft,\n y: top,\n width: maxRight - minLeft,\n height: bottom - top\n });\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);\n if (checkMainAxis) {\n mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);\n }\n if (checkCrossAxis) {\n crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n var _rawOffset$mainAxis, _rawOffset$crossAxis;\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,\n crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n// Method syntax keeps callback parameters bivariant, but expressing the\n// explicit `| undefined` required by `exactOptionalPropertyTypes` needs\n// property syntax, which is contravariant under `strictFunctionTypes`.\n// Extracting the function from a method position restores that bivariance so\n// consumers can still assign callbacks with narrower parameter types.\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const shiftData = state.middlewareData.shift;\n const noShift = !shiftData;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if (shiftData != null && shiftData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if (shiftData != null && shiftData.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n if (isYAxis) {\n availableWidth = width - 2 * max(overflow.left, overflow.right);\n } else {\n availableHeight = height - 2 * max(overflow.top, overflow.bottom);\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement && offsetParent) {\n const win = getWindow(domElement);\n const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return element.getClientRects ? Array.from(element.getClientRects()) : [];\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(html) {\n const scroll = getNodeScroll(html);\n const body = html.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(html);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy, rootBoundary) {\n if (rootBoundary === void 0) {\n rootBoundary = 'viewport';\n }\n const isLayoutViewport = rootBoundary === 'layoutViewport';\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n // Client coordinates are relative to the layout viewport, except in\n // WebKit with an `absolute` strategy, where they are relative to the\n // visual viewport.\n const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';\n if (isLayoutViewport) {\n if (!layoutRelativeClientCoords) {\n x = -visualViewport.offsetLeft;\n y = -visualViewport.offsetTop;\n }\n } else {\n width = visualViewport.width;\n height = visualViewport.height;\n if (layoutRelativeClientCoords) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks\n // the visual width but isn't reflected in `html.clientWidth`, so subtract it.\n // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also\n // reserves an empty inline-start gutter that clips nothing, so exclude just\n // the one scrollbar-side gutter — halve the measured (two-gutter) total. A\n // left-side scrollbar (`windowScrollbarX > 0`) is already handled by\n // `getHTMLOffset`/`visualViewport.width`; skip it here.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;\n if (gutter <= SCROLLBAR_MAX) {\n width -= gutter;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = getScale(element);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {\n rect = getViewportRect(element, strategy, clippingAncestor);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let lastKeptComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n // Position of the containing block chain below the current node. A fixed\n // element whose containing block hasn't been found yet is a fixed chain.\n const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';\n\n // A non-containing ancestor does not clip the element when the chain\n // below it escapes it: a fixed chain escapes all ancestors up to the\n // next containing block, an absolute chain escapes static ancestors.\n const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // The kept node carries the chain position for the next iteration.\n lastKeptComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n if (!isOffsetParentAnElement && documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove, ancestorResize) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n\n // The entry is a snapshot, so the reference may have moved since the\n // intersection was computed (under performance constraints, or between\n // consecutive frames of a multi-frame layout shift). The reported ratio\n // and the observed area are stale in that case and cannot be trusted to\n // detect subsequent movement, so refresh regardless of the ratio.\n if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n return refresh();\n }\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped in place, the ratio is 0. Throttle\n // the refresh to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n const win = getWindow(element);\n // The window is a resize ancestor, so when `ancestorResize` is enabled its\n // listener already runs the update on resize. Here we only need to rebuild\n // the `IntersectionObserver` for the new root size, skipping a redundant\n // update. When `ancestorResize` is disabled, this becomes the sole update.\n const handleResize = () => refresh(ancestorResize);\n win.addEventListener('resize', handleResize);\n refresh(true);\n return () => {\n win.removeEventListener('resize', handleResize);\n cleanup();\n };\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update);\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = options != null ? options : {};\n const platformWithCache = {\n ...platform,\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst hooks = [];\nlet currentInstance = undefined;\nexport function getInstance() {\n return currentInstance;\n}\nexport function setInstance(instance) {\n currentInstance = instance;\n}\nexport function register(hook) {\n hooks.push(hook);\n}\n\n/**\n * Wraps a component function to enable performance optimizations for internal hooks.\n *\n * **Performance Optimization:**\n * Components wrapped with `fastComponent` have access to a shared \"instance\" context that enables\n * specialized hook implementations to batch operations and reduce overhead. The wrapper creates a\n * stable instance object that persists across renders, sets it as the current context, calls\n * registered hooks before and after rendering, then clears the context. The primary benefit is\n * with `useStore`, where multiple store subscriptions within the same component are collapsed into\n * a single `useSyncExternalStore` subscription per store, significantly reducing re-render overhead.\n * This optimization is only active on React 19+; on earlier versions `useStore` falls back to a\n * separate subscription per call.\n *\n * **Requirements:**\n * - The component function should follow standard React component patterns\n * - `useStore` calls must keep a stable order and count across renders, as batched hooks are\n * matched by call index\n * - Do not rely on the instance context outside of specialized hooks\n *\n * @param fn - The component function to wrap\n * @returns A wrapped component with the same signature as the input function\n *\n * @example\n * ```tsx\n * // Wrapping a component to enable optimized useStore batching\n * export const TooltipRoot = fastComponent(function TooltipRoot(props) {\n * // These useStore calls share a single subscription\n * const open = useStore(store, (state) => state.open);\n * const disabled = useStore(store, (state) => state.disabled);\n * const value = useStore(store, (state) => state.value);\n * // ...\n * });\n * ```\n */\nexport function fastComponent(fn) {\n const FastComponent = (props, forwardedRef) => {\n const instance = useRefWithInit(createInstance).current;\n let result;\n try {\n currentInstance = instance;\n for (const hook of hooks) {\n hook.before(instance);\n }\n result = fn(props, forwardedRef);\n for (const hook of hooks) {\n hook.after(instance);\n }\n instance.didInitialize = true;\n } finally {\n currentInstance = undefined;\n }\n return result;\n };\n FastComponent.displayName = fn.displayName || fn.name;\n return FastComponent;\n}\n\n/**\n * Wraps a component function with ref forwarding to enable performance optimizations for internal hooks.\n *\n * This is a convenience wrapper that combines `fastComponent` with `React.forwardRef`, enabling\n * both performance optimizations and proper ref forwarding. See `fastComponent` for details on\n * the performance benefits.\n *\n * @param fn - The component function that accepts props and a forwarded ref\n * @returns A wrapped component with ref forwarding enabled\n *\n * @example\n * ```tsx\n * // Wrapping a component with ref forwarding and optimized hooks\n * export const TooltipTrigger = fastComponentRef(function TooltipTrigger(\n * props,\n * forwardedRef\n * ) {\n * const store = useContext(TooltipContext);\n * const open = useStore(store, (state) => state.open);\n * // ... component logic with ref\n * return <button ref={forwardedRef} {...props} />;\n * });\n * ```\n */\nexport function fastComponentRef(fn) {\n return /*#__PURE__*/React.forwardRef(fastComponent(fn));\n}\nfunction createInstance() {\n return {\n didInitialize: false\n };\n}","import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}","import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}","/* False positives - ESLint thinks we're calling a hook from a class component. */\n/* eslint-disable react-hooks/rules-of-hooks */\n'use client';\n\nimport * as React from 'react';\nimport { Store } from \"./Store.mjs\";\nimport { useStore } from \"./useStore.mjs\";\nimport { useStableCallback } from \"../useStableCallback.mjs\";\nimport { useIsoLayoutEffect } from \"../useIsoLayoutEffect.mjs\";\nimport { NOOP } from \"../empty.mjs\";\n\n/**\n * A Store that supports controlled state keys, non-reactive values and provides utility methods for React.\n */\nexport class ReactStore extends Store {\n /**\n * Creates a new ReactStore instance.\n *\n * @param state Initial state of the store.\n * @param context Non-reactive context values.\n * @param selectors Optional selectors for use with `useState`.\n */\n constructor(state, context = {}, selectors) {\n super(state);\n this.context = context;\n this.selectors = selectors;\n }\n\n /**\n * Non-reactive values such as refs, callbacks, etc.\n */\n\n /**\n * Synchronizes a single external value into the store.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValue(key, value) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes a single external value into the store and\n * cleans it up (sets to `undefined`) on unmount.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValueWithCleanup(key, value) {\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n return () => {\n store.set(key, undefined);\n };\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes multiple external values into the store.\n *\n * Note that the while the values in `state` are updated immediately, the values returned\n * by `useState` are updated before the next render (similarly to React's `useState`).\n */\n useSyncedValues(statePart) {\n // eslint-disable-next-line consistent-this\n const store = this;\n if (process.env.NODE_ENV !== 'production') {\n // Check that an object with the same shape is passed on every render\n React.useDebugValue(statePart, p => Object.keys(p));\n const keys = React.useRef(Object.keys(statePart)).current;\n const nextKeys = Object.keys(statePart);\n if (keys.length !== nextKeys.length || keys.some((key, index) => key !== nextKeys[index])) {\n console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');\n }\n }\n const dependencies = Object.values(statePart);\n useIsoLayoutEffect(() => {\n store.update(statePart);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...dependencies]);\n }\n\n /**\n * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`\n * is non-undefined, the store's state at `key` is updated to match `controlled`.\n */\n useControlledProp(key, controlled) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n const isControlled = controlled !== undefined;\n useIsoLayoutEffect(() => {\n if (isControlled && !Object.is(store.state[key], controlled)) {\n // Set the internal state to match the controlled value.\n store.setState({\n ...store.state,\n [key]: controlled\n });\n }\n }, [store, key, controlled, isControlled]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n const cache = this.controlledValues ??= new Map();\n if (!cache.has(key)) {\n cache.set(key, isControlled);\n }\n const previouslyControlled = cache.get(key);\n if (previouslyControlled !== undefined && previouslyControlled !== isControlled) {\n console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);\n }\n }\n }\n\n /** Gets the current value from the store using a selector with the provided key.\n *\n * @param key Key of the selector to use.\n */\n\n select(key, a1, a2, a3) {\n const selector = this.selectors[key];\n return selector(this.state, a1, a2, a3);\n }\n\n /**\n * Returns a value from the store's state using a selector function.\n * Used to subscribe to specific parts of the state.\n * This methods causes a rerender whenever the selected state changes.\n *\n * @param key Key of the selector to use.\n */\n\n useState(key, a1, a2, a3) {\n React.useDebugValue(key);\n return useStore(this, this.selectors[key], a1, a2, a3);\n }\n\n /**\n * Wraps a function with `useStableCallback` to ensure it has a stable reference\n * and assigns it to the context.\n *\n * @param key Key of the event callback. Must be a function in the context.\n * @param fn Function to assign.\n */\n useContextCallback(key, fn) {\n React.useDebugValue(key);\n const stableFunction = useStableCallback(fn ?? NOOP);\n this.context[key] = stableFunction;\n }\n\n /**\n * Returns a stable setter function for a specific key in the store's state.\n * It's commonly used to pass as a ref callback to React elements.\n *\n * @param key Key of the state to set.\n */\n useStateSetter(key) {\n const ref = React.useRef(undefined);\n if (ref.current === undefined) {\n ref.current = value => {\n this.set(key, value);\n };\n }\n return ref.current;\n }\n\n /**\n * Observes changes derived from the store's selectors and calls the listener when the selected value changes.\n *\n * @param key Key of the selector to observe.\n * @param listener Listener function called when the selector result changes.\n */\n\n observe(selector, listener) {\n let selectFn;\n if (typeof selector === 'function') {\n selectFn = selector;\n } else {\n selectFn = this.selectors[selector];\n }\n let prevValue = selectFn(this.state);\n listener(prevValue, prevValue, this);\n return this.subscribe(nextState => {\n const nextValue = selectFn(nextState);\n if (!Object.is(prevValue, nextValue)) {\n const oldValue = prevValue;\n prevValue = nextValue;\n listener(nextValue, oldValue, this);\n }\n });\n }\n}","import { ReactStore } from '@base-ui/utils/store';\nimport { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\nimport { isClickLikeEvent } from \"../utils.mjs\";\nconst selectors = {\n open: state => state.open,\n transitionStatus: state => state.transitionStatus,\n domReferenceElement: state => state.domReferenceElement,\n referenceElement: state => state.positionReference ?? state.referenceElement,\n floatingElement: state => state.floatingElement,\n floatingId: state => state.floatingId\n};\nexport class FloatingRootStore extends ReactStore {\n constructor(options) {\n const {\n syncOnly,\n nested,\n onOpenChange,\n triggerElements,\n ...initialState\n } = options;\n super({\n ...initialState,\n positionReference: initialState.referenceElement,\n domReferenceElement: initialState.referenceElement\n }, {\n onOpenChange,\n dataRef: {\n current: {}\n },\n events: createEventEmitter(),\n nested,\n triggerElements\n }, selectors);\n this.syncOnly = syncOnly;\n }\n\n /**\n * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.\n */\n syncOpenEvent = (newOpen, event) => {\n if (!newOpen || !this.state.open ||\n // Prevent a pending hover-open from overwriting a click-open event, while allowing\n // click events to upgrade a hover-open.\n event != null && isClickLikeEvent(event)) {\n this.context.dataRef.current.openEvent = newOpen ? event : undefined;\n }\n };\n\n /**\n * Runs the root-owned side effects for an open state change.\n */\n dispatchOpenChange = (newOpen, eventDetails) => {\n this.syncOpenEvent(newOpen, eventDetails.event);\n const details = {\n open: newOpen,\n reason: eventDetails.reason,\n nativeEvent: eventDetails.event,\n nested: this.context.nested,\n triggerElement: eventDetails.trigger\n };\n this.context.events.emit('openchange', details);\n };\n\n /**\n * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.\n *\n * @param newOpen The new open state.\n * @param eventDetails Details about the event that triggered the open state change.\n */\n setOpen = (newOpen, eventDetails) => {\n if (this.syncOnly) {\n this.context.onOpenChange?.(newOpen, eventDetails);\n return;\n }\n this.dispatchOpenChange(newOpen, eventDetails);\n this.context.onOpenChange?.(newOpen, eventDetails);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\n/**\n * Keeps a FloatingRootStore in sync with the provided PopupStore.\n * Uses the provided FloatingRootStore when one exists, otherwise creates one once and updates it on every render.\n */\nexport function useSyncedFloatingRootContext(options) {\n const {\n popupStore,\n treatPopupAsFloatingElement = false,\n floatingRootContext: floatingRootContextProp,\n floatingId,\n nested,\n onOpenChange\n } = options;\n const open = popupStore.useState('open');\n const referenceElement = popupStore.useState('activeTriggerElement');\n const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? 'popupElement' : 'positionerElement');\n const triggerElements = popupStore.context.triggerElements;\n const handleOpenChange = onOpenChange;\n const internalStoreRef = React.useRef(null);\n if (floatingRootContextProp === undefined && internalStoreRef.current === null) {\n internalStoreRef.current = new FloatingRootStore({\n open,\n transitionStatus: undefined,\n referenceElement,\n floatingElement,\n triggerElements,\n onOpenChange: handleOpenChange,\n floatingId,\n syncOnly: true,\n nested\n });\n }\n const store = floatingRootContextProp ?? internalStoreRef.current;\n popupStore.useSyncedValue('floatingId', floatingId);\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId,\n referenceElement,\n floatingElement\n };\n if (isElement(referenceElement)) {\n valuesToSync.domReferenceElement = referenceElement;\n }\n if (store.state.positionReference === store.state.referenceElement) {\n valuesToSync.positionReference = referenceElement;\n }\n store.update(valuesToSync);\n }, [open, floatingId, referenceElement, floatingElement, store]);\n\n // Keep non-reactive context values fresh for interactions that call `store.setOpen`.\n store.context.onOpenChange = handleOpenChange;\n store.context.nested = nested;\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useId } from '@base-ui/utils/useId';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FOCUSABLE_ATTRIBUTE } from \"../../floating-ui-react/utils/constants.mjs\";\nimport { useFloatingParentNodeId } from \"../../floating-ui-react/components/FloatingTree.mjs\";\nimport { useSyncedFloatingRootContext } from \"../../floating-ui-react/hooks/useSyncedFloatingRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nexport const FOCUSABLE_POPUP_PROPS = {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n};\n\n/**\n * Returns the default `initialFocus` resolver for a popup. When opened by touch it focuses the\n * popup element itself to prevent the virtual keyboard from opening (required for Android\n * specifically; iOS handles this automatically). Otherwise it falls back to the default behavior.\n */\nexport function createDefaultInitialFocus(popupRef) {\n return interactionType => interactionType === 'touch' ? popupRef.current : true;\n}\n\n/**\n * The subset of a popup handle that a Root needs to bind its store to. Both the real handle classes\n * and any test double satisfy it.\n */\n\n/**\n * Creates and owns a popup store on behalf of a Root part. The store is created exactly once, with\n * controlled props and root state synced separately after creation. Sets up the synced floating\n * root context and returns the store.\n *\n * @param createStore Factory that builds the store. Called exactly once, receiving the floating id\n * and whether the popup is nested inside another floating element, both resolved on the first render.\n * @param treatPopupAsFloatingElement Whether the popup element is passed to Floating UI as the\n * floating element instead of the default positioner.\n */\nexport function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n const store = useRefWithInit(() => createStore(floatingId, nested)).current;\n useSyncedFloatingRootContext({\n popupStore: store,\n treatPopupAsFloatingElement,\n floatingRootContext: store.state.floatingRootContext,\n floatingId,\n nested,\n onOpenChange: store.setOpen\n });\n return store;\n}\n\n/**\n * Attaches a Root's store to a handle for this component's committed lifetime. Popup Roots render\n * it before their interactions and user children so its layout effect runs before descendant layout\n * effects. This lets descendants call the handle during the Root's initial commit without attaching\n * during render, which would leak suspended or abandoned stores. Store subscribers are notified by\n * `attachStore` in this ordinary layout phase, where React permits synchronous updates.\n *\n * Popup Roots must render this component only when a handle is present so handle-less Roots avoid\n * mounting an extra fiber and layout effect.\n */\nexport function PopupHandleAttachment({\n handle,\n store\n}) {\n useIsoLayoutEffect(() => {\n return handle.attachStore(store);\n }, [handle, store]);\n return null;\n}\n\n/**\n * Returns a callback ref that registers/unregisters the trigger element in the store.\n *\n * @param store The Store instance where the trigger should be registered.\n */\nexport function useTriggerRegistration(id, store) {\n // Keep track of the currently registered element to unregister it on unmount or id change.\n const registeredElementIdRef = React.useRef(null);\n const registeredElementRef = React.useRef(null);\n return React.useCallback(element => {\n if (id === undefined) {\n return;\n }\n let shouldSyncTriggerCount = false;\n if (registeredElementIdRef.current !== null) {\n const registeredId = registeredElementIdRef.current;\n const registeredElement = registeredElementRef.current;\n const currentElement = store.context.triggerElements.getById(registeredId);\n if (registeredElement && currentElement === registeredElement) {\n store.context.triggerElements.delete(registeredId);\n shouldSyncTriggerCount = true;\n }\n registeredElementIdRef.current = null;\n registeredElementRef.current = null;\n }\n if (element !== null) {\n registeredElementIdRef.current = id;\n registeredElementRef.current = element;\n store.context.triggerElements.add(id, element);\n shouldSyncTriggerCount = true;\n }\n if (shouldSyncTriggerCount) {\n const triggerCount = store.context.triggerElements.size;\n if (store.select('open') && store.state.triggerCount !== triggerCount) {\n store.set('triggerCount', triggerCount);\n }\n }\n }, [store, id]);\n}\nexport function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {\n if (open) {\n // Opening starts a new close cycle, so clear any previous request to keep the popup mounted.\n state.preventUnmountingOnClose = false;\n } else if (preventUnmountOnClose) {\n state.preventUnmountingOnClose = true;\n }\n const triggerId = trigger?.id ?? null;\n\n // If a popup is closing, the `trigger` may be undefined.\n // We want to keep the previous value so that exit animations are played and focus is returned correctly.\n if (triggerId || open) {\n state.activeTriggerId = triggerId;\n state.activeTriggerElement = trigger ?? null;\n }\n}\nexport function attachPreventUnmountOnClose(eventDetails) {\n let preventUnmountOnClose = false;\n eventDetails.preventUnmountOnClose = () => {\n preventUnmountOnClose = true;\n };\n return () => preventUnmountOnClose;\n}\n\n/**\n * Runs the shared open-change sequence for a popup store: notifies `onOpenChange`,\n * honors cancellation, dispatches the floating root change, maps the reason to an\n * `instantType`, and commits the state update (synchronously for hover so\n * `getAnimations()` observes it). Stores supply their own differences via\n * `extraState` (e.g. the last change reason) and `onBeforeDispatch` (e.g. updating\n * inline-rect coordinates).\n */\nexport function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {\n const reason = eventDetails.reason;\n const isHover = reason === REASONS.triggerHover;\n const isFocusOpen = nextOpen && reason === REASONS.triggerFocus;\n const isDismissClose = !nextOpen && (reason === REASONS.triggerPress || reason === REASONS.escapeKey);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n store.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n options.onBeforeDispatch?.();\n store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n // Spread `extraState` first so `open` always reflects `nextOpen`, keeping it in\n // sync with the value already passed to `dispatchOpenChange`/`setPopupOpenState`.\n const updatedState = {\n ...options.extraState,\n open: nextOpen\n };\n if (isFocusOpen) {\n updatedState.instantType = 'focus';\n } else if (isDismissClose) {\n updatedState.instantType = 'dismiss';\n } else if (isHover) {\n updatedState.instantType = undefined;\n }\n setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n store.update(updatedState);\n };\n if (isHover) {\n // Flush synchronously for hover so `node.getAnimations()` sees the new state.\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n}\n\n/**\n * Sets up trigger data forwarding to the store.\n *\n * @param triggerId Id of the trigger.\n * @param triggerElementRef Ref for the trigger DOM element.\n * @param store The Store instance managing the popup state.\n * @param stateUpdates An object with state updates to apply when the trigger is active.\n */\nexport function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {\n const isMountedByThisTrigger = store.useState('isMountedByTrigger', triggerId);\n const baseRegisterTrigger = useTriggerRegistration(triggerId, store);\n\n // Applies trigger-owned state (active-trigger ownership and payload) when the trigger registers.\n // Stable so payload/`stateUpdates` changes do not change the ref identity (which would needlessly\n // churn registration); it reads the latest closure values when invoked.\n const applyTriggerData = useStableCallback(element => {\n const open = store.select('open');\n const activeTriggerId = store.select('activeTriggerId');\n if (activeTriggerId === triggerId) {\n store.update({\n activeTriggerElement: element,\n ...(open ? stateUpdates : null)\n });\n return;\n }\n if (activeTriggerId == null && open) {\n // If a popup is already open, a detached trigger can mount before any active trigger\n // has been established. Claim the first registered trigger so trigger-owned focus\n // management and ARIA relationships work.\n store.update({\n activeTriggerId: triggerId,\n activeTriggerElement: element,\n ...stateUpdates\n });\n }\n });\n\n // Intentionally NOT stable. Its identity is derived from `baseRegisterTrigger`, which is keyed on\n // `[store, id]`, so when a handle-backed trigger's store pointer swaps the merged ref re-fires —\n // unregistering from the previous store and registering into the new one. This lets a detached\n // trigger follow its handle's currently-attached store across attach/detach/remount. (A stable\n // callback would keep its identity and never re-fire on a store swap.)\n const registerTrigger = React.useCallback(element => {\n baseRegisterTrigger(element);\n if (element) {\n applyTriggerData(element);\n }\n }, [baseRegisterTrigger, applyTriggerData]);\n useIsoLayoutEffect(() => {\n if (isMountedByThisTrigger) {\n store.update({\n activeTriggerElement: triggerElementRef.current,\n ...stateUpdates\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);\n return {\n registerTrigger,\n isMountedByThisTrigger\n };\n}\n/**\n * Keeps trigger registration state synchronized while the popup is open.\n *\n * When a popup opens without an explicit trigger id and exactly one trigger is registered, that\n * trigger is claimed as the active trigger. When the active trigger id is still registered but its\n * element changed, the active element is refreshed. When the active trigger id is missing from the\n * registry but the same element is still registered under a different id (e.g. the rendered trigger\n * carries its own DOM `id` that differs from Base UI's internal trigger id), the active id is\n * reassociated to the registered id instead of being treated as lost. When the active trigger\n * unregisters, the default path preserves existing ownership so non-closing popup families do not\n * silently claim a different trigger while staying open.\n *\n * If `closeOnActiveTriggerUnmount` is enabled, unregistering a previously resolved active trigger\n * requests a close after a microtask so a same-tick replacement trigger with the same id can\n * register first. An active trigger id that has not matched a registered trigger yet is treated as\n * pending and does not request a close.\n *\n * This should be called on the Root part.\n *\n * @param store The Store instance managing the popup state.\n * @param options Options for active trigger unmount behavior.\n */\nexport function useImplicitActiveTrigger(store, options = {}) {\n const {\n closeOnActiveTriggerUnmount = false\n } = options;\n // Distinguishes a trigger that unmounted from a new active trigger that has not hydrated yet.\n const resolvedActiveTriggerIdRef = React.useRef(null);\n const open = store.useState('open');\n const reactiveTriggerCount = store.useState('triggerCount');\n // Subscribe to the active trigger id so the reconciliation below reruns when ownership moves to\n // another trigger while the popup stays open (e.g. a focus/hover handoff between triggers).\n const activeTriggerId = store.useState('activeTriggerId');\n // Subscribe to the active trigger element so the reconciliation reruns when a pending active\n // trigger registers in a commit where the trigger count nets out unchanged (registration\n // forwards the element to the store when the registering trigger matches the active id).\n // Without this, the id would never be marked resolved and a later genuine unmount would be\n // misclassified as pending, disabling `closeOnActiveTriggerUnmount`.\n const reactiveActiveTriggerElement = store.useState('activeTriggerElement');\n useIsoLayoutEffect(() => {\n if (!open) {\n resolvedActiveTriggerIdRef.current = null;\n if (store.state.triggerCount !== 0) {\n store.set('triggerCount', 0);\n }\n return;\n }\n const triggerCount = store.context.triggerElements.size;\n const stateUpdates = {};\n if (store.state.triggerCount !== triggerCount) {\n stateUpdates.triggerCount = triggerCount;\n }\n const currentActiveTriggerId = store.select('activeTriggerId');\n let lostActiveTriggerId = null;\n if (currentActiveTriggerId) {\n const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);\n if (!activeTriggerElement) {\n for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {\n if (triggerElement === store.state.activeTriggerElement) {\n stateUpdates.activeTriggerId = triggerId;\n stateUpdates.activeTriggerElement = triggerElement;\n resolvedActiveTriggerIdRef.current = triggerId;\n break;\n }\n }\n if (stateUpdates.activeTriggerId === undefined) {\n if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {\n lostActiveTriggerId = currentActiveTriggerId;\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = currentActiveTriggerId;\n if (activeTriggerElement !== store.state.activeTriggerElement) {\n stateUpdates.activeTriggerElement = activeTriggerElement;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {\n const iteratorResult = store.context.triggerElements.entries().next();\n if (!iteratorResult.done) {\n const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;\n stateUpdates.activeTriggerId = implicitTriggerId;\n stateUpdates.activeTriggerElement = implicitTriggerElement;\n resolvedActiveTriggerIdRef.current = implicitTriggerId;\n }\n }\n if (stateUpdates.triggerCount !== undefined || stateUpdates.activeTriggerId !== undefined || stateUpdates.activeTriggerElement !== undefined) {\n store.update(stateUpdates);\n }\n if (lostActiveTriggerId) {\n if (closeOnActiveTriggerUnmount) {\n // Defer so a same-tick replacement trigger with the same id can register first.\n queueMicrotask(() => {\n if (store.select('open') && store.select('activeTriggerId') === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {\n const eventDetails = createChangeEventDetails(REASONS.none);\n store.setOpen(false, eventDetails);\n // If closing is canceled, keep the previous active trigger ownership for the\n // still-open popup instead of claiming another trigger implicitly.\n if (!eventDetails.isCanceled) {\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null\n });\n }\n }\n });\n }\n }\n }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);\n}\n\n/**\n * Manages the mounted state of the popup.\n * Sets up the transition status listeners and handles unmounting when needed.\n * Updates the `mounted`, `transitionStatus`, and `preventUnmountingOnClose` states in the store.\n *\n * @param open Whether the popup is open.\n * @param store The Store instance managing the popup state.\n * @param onUnmount Optional callback to be called when the popup is unmounted.\n *\n * @returns A function to forcibly unmount the popup.\n */\nexport function useOpenStateTransitions(open, store, onUnmount) {\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const preventUnmountingOnClose = store.useState('preventUnmountingOnClose');\n // Opening starts a new close cycle. Clear during render so the close-completion hook below\n // reads the synchronized value on the same pass.\n const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;\n store.useSyncedValues({\n mounted,\n transitionStatus,\n preventUnmountingOnClose: syncedPreventUnmountingOnClose\n });\n const forceUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null,\n mounted: false,\n preventUnmountingOnClose: false\n });\n onUnmount?.();\n store.context.onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: mounted && !open && !syncedPreventUnmountingOnClose,\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (!open) {\n forceUnmount();\n }\n }\n });\n return {\n forceUnmount,\n transitionStatus\n };\n}\nexport function usePopupInteractionProps(store, statePart) {\n store.useSyncedValues(statePart);\n useIsoLayoutEffect(() => () => {\n store.update({\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n });\n }, [store]);\n}\nexport function usePopupRootSync(store, open) {\n useIsoLayoutEffect(() => {\n if (!open && store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [open, store]);\n useIsoLayoutEffect(() => () => {\n if (store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [store]);\n}","/**\n * Development-only reverse index of element to registered id, keyed by the owning map.\n *\n * Registration would otherwise have to scan every entry to detect an element claimed by two ids,\n * making the mount of many triggers sharing one handle quadratic. Kept module-scoped, lazily\n * initialized, and read only from `process.env.NODE_ENV` guards so production builds drop it along\n * with the checks.\n */\nlet devElementIdsByMap;\nfunction getDevElementIds(map) {\n devElementIdsByMap ??= new WeakMap();\n let elementIds = devElementIdsByMap.get(map);\n if (!elementIds) {\n elementIds = new WeakMap();\n devElementIdsByMap.set(map, elementIds);\n }\n return elementIds;\n}\n\n/**\n * Data structure to keep track of popup trigger elements by their IDs.\n *\n * Element lookups iterate the id map rather than maintaining a parallel Set. Registration is O(1),\n * while `hasElement` and `hasMatchingElement` are linear in the number of triggers.\n */\nexport class PopupTriggerMap {\n constructor() {\n this.idMap = new Map();\n }\n\n /**\n * Adds a trigger element with the given ID.\n *\n * Note: The provided element is assumed to not be registered under multiple IDs.\n */\n add(id, element) {\n if (process.env.NODE_ENV !== 'production') {\n const elementIds = getDevElementIds(this);\n const existingId = elementIds.get(element);\n if (existingId !== undefined && existingId !== id) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error('Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.');\n }\n\n // Reusing an id for a different element evicts the previous one, so it must lose its claim\n // on the id or a later registration under a different id would be reported as a duplicate.\n const previousElement = this.idMap.get(id);\n if (previousElement !== undefined && previousElement !== element) {\n elementIds.delete(previousElement);\n }\n elementIds.set(element, id);\n }\n this.idMap.set(id, element);\n }\n\n /**\n * Removes the trigger element with the given ID.\n */\n delete(id) {\n if (process.env.NODE_ENV !== 'production') {\n const element = this.idMap.get(id);\n if (element !== undefined) {\n devElementIdsByMap?.get(this)?.delete(element);\n }\n }\n this.idMap.delete(id);\n }\n\n /**\n * Whether the given element is registered as a trigger.\n */\n hasElement(element) {\n for (const registered of this.idMap.values()) {\n if (registered === element) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether there is a registered trigger element matching the given predicate.\n */\n hasMatchingElement(predicate) {\n for (const element of this.idMap.values()) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the trigger element associated with the given ID, or undefined if no such element exists.\n */\n getById(id) {\n return this.idMap.get(id);\n }\n\n /**\n * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].\n */\n entries() {\n return this.idMap.entries();\n }\n\n /**\n * Returns an iterable of all registered trigger elements.\n */\n elements() {\n return this.idMap.values();\n }\n\n /**\n * Returns the number of registered trigger elements.\n */\n get size() {\n return this.idMap.size;\n }\n}","import { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function getEmptyRootContext() {\n return new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements: new PopupTriggerMap(),\n floatingId: undefined,\n syncOnly: false,\n nested: false,\n onOpenChange: undefined\n });\n}","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FloatingRootStore } from \"../../floating-ui-react/components/FloatingRootStore.mjs\";\nimport { getEmptyRootContext } from \"../../floating-ui-react/utils/getEmptyRootContext.mjs\";\n\n/**\n * State common to all popup stores.\n */\n\nexport function createInitialPopupStoreState() {\n return {\n open: false,\n openProp: undefined,\n mounted: false,\n transitionStatus: undefined,\n floatingRootContext: getEmptyRootContext(),\n floatingId: undefined,\n triggerCount: 0,\n preventUnmountingOnClose: false,\n payload: undefined,\n activeTriggerId: null,\n activeTriggerElement: null,\n triggerIdProp: undefined,\n popupElement: null,\n positionerElement: null,\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n };\n}\nexport function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {\n return new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements,\n floatingId,\n syncOnly: true,\n nested,\n onOpenChange: undefined\n });\n}\nconst activeTriggerIdSelector = state => state.triggerIdProp ?? state.activeTriggerId;\nconst openSelector = state => state.openProp ?? state.open;\nconst popupIdSelector = state => {\n const popupId = state.popupElement?.id ?? state.floatingId;\n return popupId || undefined;\n};\nfunction triggerOwnsOpenPopup(state, triggerId) {\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) === triggerId;\n}\nfunction triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {\n if (triggerOwnsOpenPopup(state, triggerId)) {\n return true;\n }\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;\n}\nexport const popupStoreSelectors = {\n open: openSelector,\n mounted: state => state.mounted,\n transitionStatus: state => state.transitionStatus,\n floatingRootContext: state => state.floatingRootContext,\n triggerCount: state => state.triggerCount,\n preventUnmountingOnClose: state => state.preventUnmountingOnClose,\n payload: state => state.payload,\n activeTriggerId: activeTriggerIdSelector,\n activeTriggerElement: state => state.mounted ? state.activeTriggerElement : null,\n popupId: popupIdSelector,\n /**\n * Whether the trigger with the given ID was used to open the popup.\n */\n isTriggerActive: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId,\n /**\n * Whether the popup is open and was activated by a trigger with the given ID.\n */\n isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),\n /**\n * Whether the popup is mounted and was activated by a trigger with the given ID.\n */\n isMountedByTrigger: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId && state.mounted,\n triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,\n /**\n * Popup id for the trigger that currently owns the open popup.\n */\n triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : undefined,\n popupProps: state => state.popupProps,\n popupElement: state => state.popupElement,\n positionerElement: state => state.positionerElement\n};\n\n/**\n * Store members a detached handle-backed trigger reads or invokes for trigger registration and data\n * forwarding. `set`/`update` are included only for trigger-count and trigger-data bookkeeping; on a\n * detached (inert) store they are intentionally no-ops, so a write through them is not guaranteed to\n * be durable. Component handle-store views Pick these from their concrete store (preserving its\n * context and selectors) and add any component-specific trigger-invoked members such as `setOpen`.\n */\n\n/**\n * The subset of a popup store that trigger registration and data forwarding rely on. Narrow enough\n * that an inert store can be passed while detached.\n */","'use client';\n\nimport * as React from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { NOOP } from '@base-ui/utils/empty';\n/**\n * Reads the store currently exposed by a popup handle and subscribes to store-pointer changes.\n * Detached triggers use this to follow a handle as a root attaches or detaches: while no root is\n * attached, the handle exposes its fallback store; once a root attaches, subscribers re-render and\n * read from the live root store.\n *\n * Returns `undefined` when no handle is provided so callers can fall back to their root context.\n *\n * @param handle The popup handle to read from, or `undefined` when the trigger is not handle-bound.\n */\nexport function usePopupHandleStore(handle) {\n const subscribe = React.useCallback(listener => {\n if (handle === undefined) {\n return NOOP;\n }\n return handle.subscribeStore(listener);\n }, [handle]);\n const getSnapshot = React.useCallback(() => {\n return handle === undefined ? undefined : handle.store;\n }, [handle]);\n return useSyncExternalStore(subscribe, getSnapshot, () => handle?.serverStore);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useFloating as usePosition } from '@floating-ui/react-dom';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { useFloatingRootContext } from \"./useFloatingRootContext.mjs\";\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(options = {}) {\n const internalStore = useFloatingRootContext(options);\n const store = options.rootContext || internalStore;\n return useFloatingWithStore(options, store);\n}\n\n/**\n * Base UI's private `useFloating` path. The caller must supply the root store, so this skips the\n * internal root-context hook used by the public Floating UI-compatible API.\n */\nexport function useBaseUIFloating(options) {\n return useFloatingWithStore(options, options.rootContext);\n}\nfunction useFloatingWithStore(options, store) {\n const {\n nodeId,\n externalTree\n } = options;\n const referenceElement = store.useState('referenceElement');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const open = store.useState('open');\n const floatingId = store.useState('floatingId');\n const [positionReference, setPositionReferenceRaw] = React.useState(null);\n const [localDomReference, setLocalDomReference] = React.useState(undefined);\n const [localFloatingElement, setLocalFloatingElement] = React.useState(undefined);\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree(externalTree);\n const storeElements = React.useMemo(() => ({\n reference: referenceElement,\n floating: floatingElement,\n domReference: domReferenceElement\n }), [referenceElement, floatingElement, domReferenceElement]);\n const position = usePosition({\n ...options,\n elements: {\n ...storeElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;\n const syncedFloatingElement = localFloatingElement === undefined ? store.state.floatingElement : localFloatingElement;\n store.useSyncedValue('referenceElement', localDomReference ?? null);\n store.useSyncedValue('domReferenceElement', localDomReference === undefined ? domReferenceElement : localDomReferenceElement);\n store.useSyncedValue('floatingElement', syncedFloatingElement);\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => node.getClientRects(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n setPositionReferenceRaw(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setLocalDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs, setLocalDomReference]);\n const setFloating = React.useCallback(node => {\n setLocalFloatingElement(node);\n position.refs.setFloating(node);\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setFloating,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setFloating, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReferenceElement\n }), [position.elements, domReferenceElement]);\n const context = React.useMemo(() => ({\n ...position,\n dataRef: store.context.dataRef,\n open,\n onOpenChange: store.setOpen,\n events: store.context.events,\n floatingId,\n refs,\n elements,\n nodeId,\n rootStore: store\n }), [position, refs, elements, nodeId, store, open, floatingId]);\n useIsoLayoutEffect(() => {\n if (domReferenceElement) {\n domReferenceRef.current = domReferenceElement;\n }\n }, [domReferenceElement]);\n useIsoLayoutEffect(() => {\n store.context.dataRef.current.floatingContext = context;\n const node = tree?.nodesRef.current.find(n => n.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements,\n rootStore: store\n }), [position, refs, elements, context, store]);\n}","'use client';\n\nimport { useOnMount } from '@base-ui/utils/useOnMount';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { isInteractiveElement } from \"../utils.mjs\";\nexport { isInteractiveElement };\nexport class HoverInteraction {\n constructor() {\n this.pointerType = undefined;\n this.interactedInside = false;\n this.handler = undefined;\n this.blockMouseMove = true;\n this.performedPointerEventsMutation = false;\n this.pointerEventsScopeElement = null;\n this.pointerEventsReferenceElement = null;\n this.pointerEventsFloatingElement = null;\n this.restTimeoutPending = false;\n this.openChangeTimeout = new Timeout();\n this.restTimeout = new Timeout();\n this.handleCloseOptions = undefined;\n }\n static create() {\n return new HoverInteraction();\n }\n dispose = () => {\n this.openChangeTimeout.clear();\n this.restTimeout.clear();\n };\n disposeEffect = () => {\n return this.dispose;\n };\n}\nconst pointerEventsMutationOwnerByScopeElement = new WeakMap();\nexport function clearSafePolygonPointerEventsMutation(instance) {\n if (!instance.performedPointerEventsMutation) {\n return;\n }\n const scopeElement = instance.pointerEventsScopeElement;\n if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {\n instance.pointerEventsScopeElement?.style.removeProperty('pointer-events');\n instance.pointerEventsReferenceElement?.style.removeProperty('pointer-events');\n instance.pointerEventsFloatingElement?.style.removeProperty('pointer-events');\n pointerEventsMutationOwnerByScopeElement.delete(scopeElement);\n }\n instance.performedPointerEventsMutation = false;\n instance.pointerEventsScopeElement = null;\n instance.pointerEventsReferenceElement = null;\n instance.pointerEventsFloatingElement = null;\n}\nexport function applySafePolygonPointerEventsMutation(instance, options) {\n const {\n scopeElement,\n referenceElement,\n floatingElement\n } = options;\n const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);\n if (existingOwner && existingOwner !== instance) {\n clearSafePolygonPointerEventsMutation(existingOwner);\n }\n clearSafePolygonPointerEventsMutation(instance);\n instance.performedPointerEventsMutation = true;\n instance.pointerEventsScopeElement = scopeElement;\n instance.pointerEventsReferenceElement = referenceElement;\n instance.pointerEventsFloatingElement = floatingElement;\n pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);\n scopeElement.style.pointerEvents = 'none';\n referenceElement.style.pointerEvents = 'auto';\n floatingElement.style.pointerEvents = 'auto';\n}\nexport function useHoverInteractionSharedState(store) {\n const data = store.context.dataRef.current;\n const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;\n if (!data.hoverInteractionState) {\n data.hoverInteractionState = instance;\n }\n useOnMount(data.hoverInteractionState.disposeEffect);\n return data.hoverInteractionState;\n}","'use client';\n\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, isInteractiveElement, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, isClickLikeOpenEvent as isClickLikeOpenEventShared, isHoverOpenEvent, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\n/**\n * Provides hover interactions that should be attached to the floating element.\n */\nexport function useHoverFloatingInteraction(context, parameters = {}) {\n const {\n enabled = true,\n closeDelay: closeDelayProp = 0,\n nodeId: nodeIdProp\n } = parameters;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree();\n const parentId = useFloatingParentNodeId();\n const instance = useHoverInteractionSharedState(store);\n const childClosedTimeout = useTimeout();\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const isHoverOpen = useStableCallback(() => {\n return isHoverOpenEvent(dataRef.current.openEvent?.type);\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n instance.pointerType = undefined;\n instance.restTimeoutPending = false;\n instance.interactedInside = false;\n clearPointerEvents();\n }\n }, [open, instance, clearPointerEvents]);\n React.useEffect(() => {\n return clearPointerEvents;\n }, [clearPointerEvents]);\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {\n const ref = domReferenceElement;\n const floatingEl = floatingElement;\n const doc = ownerDocument(floatingElement);\n const parentFloating = tree?.nodesRef.current.find(node => node.id === parentId)?.context?.elements.floating;\n if (parentFloating) {\n parentFloating.style.pointerEvents = '';\n }\n\n // A keep-mounted submenu can appear in the tree before it opens, so a\n // cached scope or parent lookup may resolve to the submenu itself. That\n // would not shield sibling items in the parent menu.\n const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;\n const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest('[data-rootownerid]') ?? doc.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: ref,\n floatingElement: floatingEl\n });\n return () => {\n clearPointerEvents();\n };\n }\n return undefined;\n }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function hasParentChildren() {\n return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);\n }\n function closeWithDelay(event) {\n const closeDelay = getDelay(closeDelayProp, 'close', instance.pointerType);\n const close = () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n };\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, close);\n } else {\n instance.openChangeTimeout.clear();\n close();\n }\n }\n function handleInteractInside(event) {\n const target = getTarget(event);\n if (!isInteractiveElement(target)) {\n instance.interactedInside = false;\n return;\n }\n instance.interactedInside = target?.closest('[aria-haspopup]') != null;\n }\n function onFloatingMouseEnter() {\n instance.openChangeTimeout.clear();\n childClosedTimeout.clear();\n tree?.events.off('floating.closed', onNodeClosed);\n clearPointerEvents();\n }\n function onFloatingMouseLeave(event) {\n if (hasParentChildren() && tree) {\n tree.events.on('floating.closed', onNodeClosed);\n return;\n }\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n // If the mouse is leaving the reference element to another trigger, don't explicitly close the popup\n // as it will be moved.\n return;\n }\n const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;\n const relatedTarget = event.relatedTarget;\n const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some(node => contains(node.context?.elements.floating, relatedTarget));\n if (isMovingIntoDescendantFloating) {\n return;\n }\n\n // If the safePolygon handler is active, let it handle the close logic.\n if (instance.handler) {\n instance.handler(event);\n return;\n }\n clearPointerEvents();\n if (isHoverOpen() && !isClickLikeOpenEvent()) {\n closeWithDelay(event);\n }\n }\n function onNodeClosed(event) {\n if (!tree || !parentId || hasParentChildren()) {\n return;\n }\n // Allow the mouseenter event to fire in case child was closed because mouse moved into parent.\n childClosedTimeout.start(0, () => {\n tree.events.off('floating.closed', onNodeClosed);\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree.events.emit('floating.closed', event);\n });\n }\n const floating = floatingElement;\n return mergeCleanups(floating && addEventListener(floating, 'mouseenter', onFloatingMouseEnter), floating && addEventListener(floating, 'mouseleave', onFloatingMouseLeave), floating && addEventListener(floating, 'pointerdown', handleInteractInside, true), () => {\n tree?.events.off('floating.closed', onNodeClosed);\n });\n }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType } from \"../utils/event.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, getRestMs, isClickLikeOpenEvent as isClickLikeOpenEventShared, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\nconst EMPTY_REF = {\n current: null\n};\n\n/**\n * Provides hover interactions that should be attached to reference or trigger\n * elements.\n */\nexport function useHoverReferenceInteraction(context, props = {}) {\n const {\n enabled = true,\n delay = 0,\n handleClose = null,\n mouseOnly = false,\n restMs = 0,\n move = true,\n triggerElementRef = EMPTY_REF,\n externalTree,\n isActiveTrigger = true,\n getHandleCloseContext,\n isClosing,\n shouldOpen: shouldOpenProp,\n guardStaleOpen = false\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const instance = useHoverInteractionSharedState(store);\n const isHoverCloseActiveRef = React.useRef(false);\n const handleCloseRef = useValueAsRef(handleClose);\n const delayRef = useValueAsRef(delay);\n const restMsRef = useValueAsRef(restMs);\n const enabledRef = useValueAsRef(enabled);\n const shouldOpenRef = useValueAsRef(shouldOpenProp);\n const isClosingRef = useValueAsRef(isClosing);\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const checkShouldOpen = useStableCallback(() => {\n return shouldOpenRef.current?.() !== false;\n });\n const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {\n const allTriggers = store.context.triggerElements;\n\n // Fast path for normal usage where handlers are attached directly to triggers.\n if (allTriggers.hasElement(currentTarget)) {\n return !currentDomReference || !contains(currentDomReference, currentTarget);\n }\n\n // Fallback for delegated/wrapper usage where currentTarget may be outside the trigger map.\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n return allTriggers.hasMatchingElement(trigger => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));\n });\n const cleanupMouseMoveHandler = useStableCallback(() => {\n if (!instance.handler) {\n return;\n }\n const doc = ownerDocument(store.select('domReferenceElement'));\n doc.removeEventListener('mousemove', instance.handler);\n instance.handler = undefined;\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n if (isActiveTrigger) {\n // eslint-disable-next-line no-underscore-dangle\n instance.handleCloseOptions = handleCloseRef.current?.__options;\n }\n React.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);\n\n // When closing before opening, clear the delay timeouts to cancel it\n // from showing.\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function onOpenChangeLocal(details) {\n if (!details.open) {\n isHoverCloseActiveRef.current = details.reason === REASONS.triggerHover;\n cleanupMouseMoveHandler();\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.blockMouseMove = true;\n instance.restTimeoutPending = false;\n } else {\n isHoverCloseActiveRef.current = false;\n }\n }\n events.on('openchange', onOpenChangeLocal);\n return () => {\n events.off('openchange', onOpenChangeLocal);\n };\n }, [enabled, events, instance, cleanupMouseMoveHandler]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function closeWithDelay(event, runElseBranch = true) {\n const closeDelay = getDelay(delayRef.current, 'close', instance.pointerType);\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n });\n } else if (runElseBranch) {\n instance.openChangeTimeout.clear();\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n }\n }\n const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select('domReferenceElement') : null);\n if (!isElement(trigger)) {\n return undefined;\n }\n function onMouseEnter(event) {\n instance.openChangeTimeout.clear();\n instance.blockMouseMove = false;\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n\n // Only rest delay is set; there's no fallback delay.\n // This will be handled by `onMouseMove`.\n const restMsValue = getRestMs(restMsRef.current);\n const openDelay = getDelay(delayRef.current, 'open', instance.pointerType);\n const eventTarget = getTarget(event);\n const currentTarget = event.currentTarget ?? null;\n const currentDomReference = store.select('domReferenceElement');\n let triggerNode = currentTarget;\n\n // Wrapper/delegated mode: resolve the actual trigger from the event target.\n if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {\n for (const triggerElement of store.context.triggerElements.elements()) {\n if (contains(triggerElement, eventTarget)) {\n triggerNode = triggerElement;\n break;\n }\n }\n }\n\n // Wrapper/delegated mode fallback: if the wrapper contains the active trigger,\n // treat this as re-entering that active trigger.\n if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {\n triggerNode = currentDomReference;\n }\n const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);\n const isOpen = store.select('open');\n const isInClosingTransition = isClosingRef.current?.() ?? store.select('transitionStatus') === 'ending';\n const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;\n const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;\n const isRestOnlyDelay = restMsValue > 0 && !openDelay;\n const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;\n const shouldOpen = !isOpen || isOverInactive;\n\n // Open immediately when moving between triggers while open, or during\n // a hover-driven close transition (including same-trigger re-entry).\n if (shouldOpenImmediately) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n return;\n }\n if (isRestOnlyDelay) {\n return;\n }\n if (openDelay) {\n instance.openChangeTimeout.start(openDelay, () => {\n if (shouldOpen && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n });\n } else if (shouldOpen) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n }\n }\n function onMouseLeave(event) {\n if (isClickLikeOpenEvent()) {\n clearPointerEvents();\n return;\n }\n cleanupMouseMoveHandler();\n const domReferenceElement = store.select('domReferenceElement');\n const doc = ownerDocument(domReferenceElement);\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n return;\n }\n if (handleCloseRef.current && handleCloseContextBase) {\n if (!store.select('open')) {\n instance.openChangeTimeout.clear();\n }\n const currentTrigger = triggerElementRef.current;\n instance.handler = handleCloseRef.current({\n ...handleCloseContextBase,\n tree,\n x: event.clientX,\n y: event.clientY,\n onClose() {\n clearPointerEvents();\n cleanupMouseMoveHandler();\n if (enabledRef.current && !isClickLikeOpenEvent() && currentTrigger === store.select('domReferenceElement')) {\n closeWithDelay(event, true);\n }\n }\n });\n doc.addEventListener('mousemove', instance.handler);\n instance.handler(event);\n return;\n }\n const shouldClose = instance.pointerType === 'touch' ? !contains(store.select('floatingElement'), event.relatedTarget) : true;\n if (shouldClose) {\n closeWithDelay(event);\n }\n }\n\n // Backup cancellation for Chrome's dropped `mouseleave` — see `guardStaleOpen`.\n function onMouseOut(event) {\n if (contains(trigger, event.relatedTarget)) {\n return; // moved within the trigger's own subtree\n }\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n }\n const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, 'mouseout', onMouseOut) : undefined;\n if (move) {\n return mergeCleanups(addEventListener(trigger, 'mousemove', onMouseEnter, {\n once: true\n }), addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }\n return mergeCleanups(addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);\n return React.useMemo(() => {\n if (!enabled) {\n return undefined;\n }\n function setPointerRef(event) {\n instance.pointerType = event.pointerType;\n }\n return {\n onPointerDown: setPointerRef,\n onPointerEnter: setPointerRef,\n onMouseMove(event) {\n const {\n nativeEvent\n } = event;\n const trigger = event.currentTarget;\n const currentDomReference = store.select('domReferenceElement');\n const currentOpen = store.select('open');\n const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {\n const floatingElement = store.select('floatingElement');\n if (floatingElement) {\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: trigger,\n floatingElement\n });\n }\n }\n const restMsValue = getRestMs(restMsRef.current);\n if (currentOpen && !isOverInactive || restMsValue === 0) {\n return;\n }\n if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {\n return;\n }\n instance.restTimeout.clear();\n function handleMouseMove() {\n instance.restTimeoutPending = false;\n\n // A delayed hover open should not override a click-like open that happened\n // while the hover delay was pending.\n if (isClickLikeOpenEvent()) {\n return;\n }\n const latestOpen = store.select('open');\n if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, nativeEvent, trigger));\n }\n }\n if (instance.pointerType === 'touch') {\n ReactDOM.flushSync(() => {\n handleMouseMove();\n });\n } else if (isOverInactive && currentOpen) {\n handleMouseMove();\n } else {\n instance.restTimeoutPending = true;\n instance.restTimeout.start(restMsValue, handleMouseMove);\n }\n }\n };\n }, [enabled, instance, isClickLikeOpenEvent, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);\n}","import { isElement } from '@floating-ui/utils/dom';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { contains, getTarget } from \"./utils/element.mjs\";\nimport { getNodeChildren } from \"./utils/nodes.mjs\";\n\n/* eslint-disable no-nested-ternary */\n\nconst CURSOR_SPEED_THRESHOLD = 0.1;\nconst CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;\nconst POLYGON_BUFFER = 0.5;\nfunction hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {\n return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;\n}\nfunction isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {\n let isInsideValue = false;\n if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {\n isInsideValue = !isInsideValue;\n }\n return isInsideValue;\n}\nfunction isInsideRect(pointX, pointY, rect) {\n return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;\n}\nfunction isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {\n const minX = Math.min(x1, x2);\n const maxX = Math.max(x1, x2);\n const minY = Math.min(y1, y2);\n const maxY = Math.max(y1, y2);\n return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;\n}\n/**\n * Generates a safe polygon area that the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nexport function safePolygon(options = {}) {\n const {\n blockPointerEvents = false\n } = options;\n const timeout = new Timeout();\n const fn = ({\n x,\n y,\n placement,\n elements,\n onClose,\n nodeId,\n tree\n }) => {\n const side = placement?.split('-')[0];\n let hasLanded = false;\n let lastX = null;\n let lastY = null;\n let lastCursorTime = typeof performance !== 'undefined' ? performance.now() : 0;\n function isCursorMovingSlowly(nextX, nextY) {\n const currentTime = performance.now();\n const elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return false;\n }\n const deltaX = nextX - lastX;\n const deltaY = nextY - lastY;\n const distanceSquared = deltaX * deltaX + deltaY * deltaY;\n const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return distanceSquared < thresholdSquared;\n }\n function close() {\n timeout.clear();\n onClose();\n }\n return function onMouseMove(event) {\n timeout.clear();\n const domReference = elements.domReference;\n const floating = elements.floating;\n if (!domReference || !floating || side == null || x == null || y == null) {\n return undefined;\n }\n const {\n clientX,\n clientY\n } = event;\n const target = getTarget(event);\n const isLeave = event.type === 'mouseleave';\n const isOverFloatingEl = contains(floating, target);\n const isOverReferenceEl = contains(domReference, target);\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return undefined;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n if (!isLeave) {\n hasLanded = true;\n return undefined;\n }\n }\n\n // Prevent overlapping floating element from being stuck in an open-close\n // loop: https://github.com/floating-ui/floating-ui/issues/1910\n if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {\n return undefined;\n }\n function hasOpenChildNode() {\n return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);\n }\n function closeIfNoOpenChild() {\n if (!hasOpenChildNode()) {\n close();\n }\n }\n\n // If any nested child is open, abort.\n if (hasOpenChildNode()) {\n return undefined;\n }\n const refRect = domReference.getBoundingClientRect();\n const rect = floating.getBoundingClientRect();\n const cursorLeaveFromRight = x > rect.right - rect.width / 2;\n const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n const isFloatingWider = rect.width > refRect.width;\n const isFloatingTaller = rect.height > refRect.height;\n const left = (isFloatingWider ? refRect : rect).left;\n const right = (isFloatingWider ? refRect : rect).right;\n const top = (isFloatingTaller ? refRect : rect).top;\n const bottom = (isFloatingTaller ? refRect : rect).bottom;\n\n // If the pointer is leaving from the opposite side, the \"buffer\" logic\n // creates a point where the floating element remains open, but should be\n // ignored.\n // A constant of 1 handles floating point rounding errors.\n if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {\n closeIfNoOpenChild();\n return undefined;\n }\n\n // Ignore when the cursor is within the rectangular trough between the\n // two elements. Since the triangle is created from the cursor point,\n // which can start beyond the ref element's edge, traversing back and\n // forth from the ref to the floating element can cause it to close. This\n // ensures it always remains open in that case.\n let isInsideTroughRect = false;\n switch (side) {\n case 'top':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);\n break;\n case 'bottom':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);\n break;\n case 'left':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);\n break;\n case 'right':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);\n break;\n default:\n }\n if (isInsideTroughRect) {\n return undefined;\n }\n if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {\n closeIfNoOpenChild();\n return undefined;\n }\n if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {\n closeIfNoOpenChild();\n return undefined;\n }\n let isInsidePolygon = false;\n switch (side) {\n case 'top':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y + POLYGON_BUFFER + 1;\n const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'bottom':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y - POLYGON_BUFFER;\n const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'left':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x + POLYGON_BUFFER + 1;\n const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);\n break;\n }\n case 'right':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x - POLYGON_BUFFER;\n const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);\n break;\n }\n default:\n }\n if (!isInsidePolygon) {\n closeIfNoOpenChild();\n } else if (!hasLanded) {\n timeout.start(40, closeIfNoOpenChild);\n }\n return undefined;\n };\n };\n\n // eslint-disable-next-line no-underscore-dangle\n fn.__options = {\n ...options,\n blockPointerEvents\n };\n return fn;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverRootContext.displayName = \"PopoverRootContext\";\nexport function usePopoverRootContext(optional) {\n const context = React.useContext(PopoverRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.' : _formatErrorMessage(47));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { NOOP } from '@base-ui/utils/empty';\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { NullStore } from \"../../utils/NullStore.mjs\";\nimport { attachPreventUnmountOnClose, createPopupFloatingRootContext, createInitialPopupStoreState, popupStoreSelectors, PopupTriggerMap, setPopupOpenState } from \"../../utils/popups/index.mjs\";\nimport { PATIENT_CLICK_THRESHOLD } from \"../../internals/constants.mjs\";\nconst selectors = {\n ...popupStoreSelectors,\n disabled: state => state.disabled,\n instantType: state => state.instantType,\n openMethod: state => state.openMethod,\n openChangeReason: state => state.openChangeReason,\n modal: state => state.modal,\n focusManagerModal: state => state.focusManagerModal,\n stickIfOpen: state => state.stickIfOpen,\n titleElementId: state => state.titleElementId,\n descriptionElementId: state => state.descriptionElementId,\n openOnHover: state => state.openOnHover,\n closeDelay: state => state.closeDelay,\n adaptiveOrigin: state => state.adaptiveOrigin\n};\n\n/**\n * The store view that detached handle-backed triggers read from. Both the real `PopoverStore` and\n * the inert fallback store satisfy it, so a trigger can read from whichever store the handle\n * currently exposes. Narrowed to the members a trigger actually uses — the trigger-data members plus\n * `setOpen` (called by the focus guards) — so the exposed surface can't bypass the open-change\n * pipeline; on the detached fallback store every one of these mutations is a no-op.\n */\n\nexport class PopoverStore extends ReactStore {\n constructor(initialState, floatingId, nested) {\n const triggerElements = new PopupTriggerMap();\n super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors);\n }\n setOpen = (nextOpen, eventDetails) => {\n const isHover = eventDetails.reason === REASONS.triggerHover;\n const isKeyboardClick = eventDetails.reason === REASONS.triggerPress && eventDetails.event.detail === 0;\n const isDismissClose = !nextOpen && (eventDetails.reason === REASONS.escapeKey || eventDetails.reason == null);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n const activeTriggerId = this.select('activeTriggerId');\n if (!nextOpen && eventDetails.reason === REASONS.closePress && eventDetails.trigger == null && activeTriggerId != null) {\n eventDetails.trigger = this.context.triggerElements.getById(activeTriggerId) ?? this.select('activeTriggerElement') ?? undefined;\n }\n this.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n const updatedState = {\n open: nextOpen,\n openChangeReason: eventDetails.reason\n };\n setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n this.update(updatedState);\n };\n if (isHover) {\n // Only allow \"patient\" clicks to close the popover if it's open.\n // If they clicked within 500ms of the popover opening, keep it open.\n this.set('stickIfOpen', true);\n this.context.stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {\n this.set('stickIfOpen', false);\n });\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n let instantType;\n if (isKeyboardClick) {\n instantType = 'click';\n } else if (isDismissClose) {\n instantType = 'dismiss';\n } else if (eventDetails.reason === REASONS.focusOut) {\n instantType = 'focus';\n }\n this.set('instantType', instantType);\n };\n}\n\n/**\n * Creates the inert fallback store used by detached handle-backed triggers while no\n * `Popover.Root` is attached. It preserves a popover-specific trigger registry in context so\n * detached triggers can register before migrating to the live root store. `setOpen` is a no-op\n * (matching the inert reads/writes of `NullStore`), so a trigger can hand the store to focus-guard\n * helpers that expect `setOpen` without it ever taking effect while detached.\n */\nexport function createNullPopoverStore() {\n const triggerElements = new PopupTriggerMap();\n const store = new NullStore(Object.freeze(createInitialState(undefined, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);\n return Object.assign(store, {\n setOpen: NOOP\n });\n}\nfunction createInitialState(initialState, triggerElements, floatingId, nested = false) {\n const state = {\n ...createInitialPopupStoreState(),\n disabled: false,\n modal: false,\n focusManagerModal: false,\n instantType: undefined,\n openMethod: null,\n openChangeReason: null,\n titleElementId: undefined,\n descriptionElementId: undefined,\n stickIfOpen: true,\n openOnHover: false,\n closeDelay: 0,\n adaptiveOrigin: undefined,\n ...initialState\n };\n if (state.open && initialState?.mounted === undefined) {\n state.mounted = true;\n }\n state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);\n return state;\n}\nfunction createInitialContext(triggerElements) {\n return {\n popupRef: /*#__PURE__*/React.createRef(),\n onOpenChange: undefined,\n onOpenChangeComplete: undefined,\n triggerFocusTargetRef: /*#__PURE__*/React.createRef(),\n beforeContentFocusGuardRef: /*#__PURE__*/React.createRef(),\n stickIfOpenTimeout: new Timeout(),\n triggerElements\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useDismiss, FloatingTree } from \"../../floating-ui-react/index.mjs\";\nimport { PopoverRootContext, usePopoverRootContext } from \"./PopoverRootContext.mjs\";\nimport { PopoverStore } from \"../store/PopoverStore.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { PopupHandleAttachment, useImplicitActiveTrigger, usePopupRootStore, useOpenStateTransitions, usePopupInteractionProps, usePopupRootSync } from \"../../utils/popups/index.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction PopoverRootComponent({\n props\n}) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n modal = false,\n handle,\n triggerId: triggerIdProp,\n defaultTriggerId: defaultTriggerIdProp = null\n } = props;\n const store = usePopoverRootStore(handle, {\n modal,\n open: defaultOpen,\n openProp,\n activeTriggerId: defaultTriggerIdProp,\n triggerIdProp\n });\n store.useControlledProp('openProp', openProp);\n store.useControlledProp('triggerIdProp', triggerIdProp);\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const payload = store.useState('payload');\n store.useContextCallback('onOpenChange', onOpenChange);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);\n usePopupRootSync(store, open);\n useImplicitActiveTrigger(store);\n const {\n forceUnmount\n } = useOpenStateTransitions(open, store, () => {\n store.update({\n stickIfOpen: true,\n openChangeReason: null\n });\n });\n store.useSyncedValues({\n modal\n });\n React.useEffect(() => {\n if (!open) {\n store.context.stickIfOpenTimeout.clear();\n }\n }, [store, open]);\n React.useImperativeHandle(props.actionsRef, () => ({\n unmount: forceUnmount,\n close: () => store.setOpen(false, createChangeEventDetails(REASONS.imperativeAction))\n }), [forceUnmount, store]);\n const shouldRenderInteractions = open || mounted;\n return /*#__PURE__*/_jsxs(PopoverRootContext.Provider, {\n value: store,\n children: [handle && /*#__PURE__*/_jsx(PopupHandleAttachment, {\n handle: handle,\n store: store\n }), shouldRenderInteractions && /*#__PURE__*/_jsx(PopoverInteractions, {\n store: store,\n modal: modal\n }), typeof children === 'function' ? children({\n payload\n }) : children]\n });\n}\n\n/**\n * Groups all parts of the popover.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport function PopoverRoot(props) {\n if (usePopoverRootContext(true)) {\n return /*#__PURE__*/_jsx(PopoverRootComponent, {\n props: props\n });\n }\n return /*#__PURE__*/_jsx(FloatingTree, {\n children: /*#__PURE__*/_jsx(PopoverRootComponent, {\n props: props\n })\n });\n}\nfunction usePopoverRootStore(handle, initialState) {\n // The store is owned by this Root instance and created exactly once. It is not tied to the handle:\n // the handle attaches to it, so swapping the handle re-attaches rather than recreating state.\n // Default values are only initial values; controlled values and root state are synced after creation.\n const store = usePopupRootStore((floatingId, nested) => new PopoverStore(initialState, floatingId, nested));\n\n // Popover-specific: dispose the patient-click timeout held in the store's context on unmount.\n React.useEffect(() => store.context.stickIfOpenTimeout.disposeEffect(), [store]);\n return store;\n}\nfunction PopoverInteractions({\n store,\n modal\n}) {\n const floatingRootContext = store.useState('floatingRootContext');\n const dismiss = useDismiss(floatingRootContext, {\n outsidePressEvent: {\n // Ensure `aria-hidden` on outside elements is removed immediately\n // on outside press when trapping focus.\n mouse: modal === 'trap-focus' ? 'sloppy' : 'intentional',\n touch: 'sloppy'\n }\n });\n\n // `useDismiss` is not given an `enabled` option, so it always returns both prop bags. Restore\n // the `EMPTY_OBJECT` fallbacks if that ever changes: the store fields are non-optional.\n // `dismiss.trigger` is always the same object as `dismiss.reference`.\n const triggerProps = dismiss.reference;\n // PopoverPopup already spreads `FOCUSABLE_POPUP_PROPS` directly, so the popup\n // props only need to carry the dismiss handlers.\n const popupProps = dismiss.floating;\n usePopupInteractionProps(store, {\n activeTriggerProps: triggerProps,\n inactiveTriggerProps: triggerProps,\n popupProps\n });\n return null;\n}","import { TransitionStatusDataAttributes, transitionStatusMapping } from \"../internals/stateAttributesMapping.mjs\";\nexport let CommonPopupDataAttributes = function (CommonPopupDataAttributes) {\n /**\n * Present when the popup is open.\n */\n CommonPopupDataAttributes[\"open\"] = \"data-open\";\n /**\n * Present when the popup is closed.\n */\n CommonPopupDataAttributes[\"closed\"] = \"data-closed\";\n /**\n * Present when the popup begins animating in.\n */\n CommonPopupDataAttributes[CommonPopupDataAttributes[\"startingStyle\"] = TransitionStatusDataAttributes.startingStyle] = \"startingStyle\";\n /**\n * Present when the popup is animating out.\n */\n CommonPopupDataAttributes[CommonPopupDataAttributes[\"endingStyle\"] = TransitionStatusDataAttributes.endingStyle] = \"endingStyle\";\n /**\n * Present when the anchor is hidden.\n */\n CommonPopupDataAttributes[\"anchorHidden\"] = \"data-anchor-hidden\";\n /**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type { 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\n CommonPopupDataAttributes[\"side\"] = \"data-side\";\n /**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\n CommonPopupDataAttributes[\"align\"] = \"data-align\";\n return CommonPopupDataAttributes;\n}({});\nexport let CommonTriggerDataAttributes = /*#__PURE__*/function (CommonTriggerDataAttributes) {\n /**\n * Present when the popup is open.\n */\n CommonTriggerDataAttributes[\"popupOpen\"] = \"data-popup-open\";\n /**\n * Present when a pressable trigger is pressed.\n */\n CommonTriggerDataAttributes[\"pressed\"] = \"data-pressed\";\n return CommonTriggerDataAttributes;\n}({});\n\n// Literal keys (instead of enum member references) keep the docs-only enums above\n// tree-shakeable: a runtime reference would retain the whole enum IIFE in every bundle.\nconst TRIGGER_HOOK = {\n 'data-popup-open': ''\n};\nconst PRESSABLE_TRIGGER_HOOK = {\n 'data-popup-open': '',\n 'data-pressed': ''\n};\nconst POPUP_OPEN_HOOK = {\n 'data-open': ''\n};\nconst POPUP_CLOSED_HOOK = {\n 'data-closed': ''\n};\nconst ANCHOR_HIDDEN_HOOK = {\n 'data-anchor-hidden': ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const pressableTriggerOpenStateMapping = {\n open(value) {\n if (value) {\n return PRESSABLE_TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const popupStateMapping = {\n open(value) {\n if (value) {\n return POPUP_OPEN_HOOK;\n }\n return POPUP_CLOSED_HOOK;\n },\n anchorHidden(value) {\n if (value) {\n return ANCHOR_HIDDEN_HOOK;\n }\n return null;\n }\n};\nexport const popupTransitionStateMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};","export const OPEN_DELAY = 300;","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { contains, getNextTabbable, getTabbableAfterElement, getTabbableBeforeElement, isOutsideEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * Minimal store interface required by the focus guard hook.\n * Both PopoverStore and MenuStore satisfy this interface.\n */\n\n/**\n * Provides focus guard handlers for popup triggers (Popover, Menu).\n *\n * When the popup is open, invisible focus guard elements are placed before and after\n * the trigger. These handlers close the popup and move focus to the appropriate\n * tabbable element when the guards receive focus (i.e. when the user tabs out).\n */\nexport function useTriggerFocusGuards(store, triggerElementRef) {\n const preFocusGuardRef = React.useRef(null);\n function handlePreFocusGuardFocus(event) {\n ReactDOM.flushSync(() => {\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent, event.currentTarget));\n });\n const previousTabbable = getTabbableBeforeElement(preFocusGuardRef.current);\n previousTabbable?.focus();\n }\n function handleFocusTargetFocus(event) {\n const positionerElement = store.select('positionerElement');\n if (positionerElement && isOutsideEvent(event, positionerElement)) {\n store.context.beforeContentFocusGuardRef.current?.focus();\n } else {\n ReactDOM.flushSync(() => {\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent, event.currentTarget));\n });\n let nextTabbable = getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current);\n while (nextTabbable !== null && contains(positionerElement, nextTabbable)) {\n const prevTabbable = nextTabbable;\n nextTabbable = getNextTabbable(nextTabbable);\n if (nextTabbable === prevTabbable) {\n break;\n }\n }\n nextTabbable?.focus();\n }\n }\n return {\n preFocusGuardRef,\n handlePreFocusGuardFocus,\n handleFocusTargetFocus\n };\n}","'use client';\n\nimport * as React from 'react';\n/**\n * Provides a cross-browser way to determine the type of the pointer used to click.\n * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.\n * Additionally, this implementation detects if the click was triggered by the keyboard.\n *\n * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.\n */\nexport function useEnhancedClickHandler(handler) {\n const lastClickInteractionTypeRef = React.useRef('');\n const handlePointerDown = React.useCallback(event => {\n if (event.defaultPrevented) {\n return;\n }\n lastClickInteractionTypeRef.current = event.pointerType;\n handler(event, event.pointerType);\n }, [handler]);\n const handleClick = React.useCallback(event => {\n // event.detail has the number of clicks performed on the element. 0 means it was triggered by the keyboard.\n if (event.detail === 0) {\n handler(event, 'keyboard');\n return;\n }\n if ('pointerType' in event) {\n // Chrome and Edge correctly use PointerEvent\n handler(event, event.pointerType);\n } else {\n handler(event, lastClickInteractionTypeRef.current);\n }\n lastClickInteractionTypeRef.current = '';\n }, [handler]);\n return {\n onClick: handleClick,\n onPointerDown: handlePointerDown\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useEnhancedClickHandler } from '@base-ui/utils/useEnhancedClickHandler';\nimport { platform } from '@base-ui/utils/platform';\nimport { useValueChanged } from \"../internals/useValueChanged.mjs\";\nexport function useOpenMethodTriggerProps(open, setOpenMethod) {\n const handleTriggerClick = useStableCallback((_, interactionType) => {\n const isOpen = typeof open === 'function' ? open() : open;\n if (!isOpen) {\n setOpenMethod(interactionType || (\n // On iOS Safari, the hitslop around touch targets means tapping outside an element's\n // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`\n // will be \"\" in that case.\n platform.os.ios ? 'touch' : ''));\n }\n });\n const {\n onClick,\n onPointerDown\n } = useEnhancedClickHandler(handleTriggerClick);\n return React.useMemo(() => ({\n onClick,\n onPointerDown\n }), [onClick, onPointerDown]);\n}\n\n/**\n * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.\n *\n * @param open The open state of the component.\n */\nexport function useOpenInteractionType(open) {\n const [openMethod, setOpenMethod] = React.useState(null);\n const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);\n useValueChanged(open, previousOpen => {\n if (previousOpen && !open) {\n setOpenMethod(null);\n }\n });\n return React.useMemo(() => ({\n openMethod,\n triggerProps\n }), [openMethod, triggerProps]);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useButton } from \"../../internals/use-button/useButton.mjs\";\nimport { triggerOpenStateMapping, pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { safePolygon, useClick, useHoverReferenceInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { OPEN_DELAY } from \"../utils/constants.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { usePopupHandleStore, useTriggerDataForwarding } from \"../../utils/popups/index.mjs\";\nimport { useTriggerFocusGuards } from \"../../utils/popups/useTriggerFocusGuards.mjs\";\nimport { useOpenMethodTriggerProps } from \"../../utils/useOpenInteractionType.mjs\";\n\n/**\n * A button that opens the popover.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const PopoverTrigger = /*#__PURE__*/React.forwardRef(function PopoverTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n handle,\n payload,\n openOnHover = false,\n delay = OPEN_DELAY,\n closeDelay = 0,\n id: idProp,\n ...elementProps\n } = componentProps;\n const rootStore = usePopoverRootContext(true);\n const handleStore = usePopupHandleStore(handle);\n const store = handleStore ?? rootStore;\n if (!store) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.' : _formatErrorMessage(74));\n }\n const thisTriggerId = useBaseUiId(idProp);\n const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);\n const floatingContext = store.useState('floatingRootContext');\n const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);\n const popupId = store.useState('triggerPopupId', thisTriggerId);\n const triggerElementRef = React.useRef(null);\n const {\n registerTrigger,\n isMountedByThisTrigger\n } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {\n payload,\n disabled,\n openOnHover,\n closeDelay\n });\n const openReason = store.useState('openChangeReason');\n const stickIfOpen = store.useState('stickIfOpen');\n const openMethod = store.useState('openMethod');\n const focusManagerModal = store.useState('focusManagerModal');\n const hoverProps = useHoverReferenceInteraction(floatingContext, {\n enabled: !disabled && openOnHover && (openMethod !== 'touch' || openReason !== REASONS.triggerPress),\n mouseOnly: true,\n move: false,\n handleClose: safePolygon(),\n restMs: delay,\n delay: {\n close: closeDelay\n },\n triggerElementRef,\n isActiveTrigger: isTriggerActive,\n isClosing: () => store.select('transitionStatus') === 'ending'\n });\n const click = useClick(floatingContext, {\n stickIfOpen\n });\n const interactionTypeProps = useOpenMethodTriggerProps(() => store.select('open'), interactionType => {\n store.set('openMethod', interactionType);\n });\n const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const stateAttributesMapping = {\n open(value) {\n if (value && openReason === REASONS.triggerPress) {\n return pressableTriggerOpenStateMapping.open(value);\n }\n return triggerOpenStateMapping.open(value);\n }\n };\n const {\n preFocusGuardRef,\n handlePreFocusGuardFocus,\n handleFocusTargetFocus\n } = useTriggerFocusGuards(store, triggerElementRef);\n const state = {\n disabled,\n open: isOpenedByThisTrigger\n };\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef],\n props: [click.reference, hoverProps, rootTriggerProps, interactionTypeProps, {\n [CLICK_TRIGGER_IDENTIFIER]: '',\n id: thisTriggerId,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpenedByThisTrigger,\n 'aria-controls': popupId\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n\n // A fragment with key is required to ensure that the `element` is mounted to the same DOM node\n // regardless of whether the focus guards are rendered or not.\n const keyedElement = /*#__PURE__*/_jsx(React.Fragment, {\n children: element\n }, thisTriggerId);\n if (isMountedByThisTrigger && !focusManagerModal) {\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(FocusGuard, {\n ref: preFocusGuardRef,\n onFocus: handlePreFocusGuardFocus\n }), keyedElement, /*#__PURE__*/_jsx(FocusGuard, {\n ref: store.context.triggerFocusTargetRef,\n onFocus: handleFocusTargetFocus\n })]\n });\n }\n return keyedElement;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverTrigger.displayName = \"PopoverTrigger\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverPortalContext.displayName = \"PopoverPortalContext\";\nexport function usePopoverPortalContext() {\n const value = React.useContext(PopoverPortalContext);\n if (value === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Popover.Portal> is missing.' : _formatErrorMessage(45));\n }\n return value;\n}","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { PopoverPortalContext } from \"./PopoverPortalContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const PopoverPortal = /*#__PURE__*/React.forwardRef(function PopoverPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const store = usePopoverRootContext();\n const mounted = store.useState('mounted');\n const shouldRender = mounted || keepMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(PopoverPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPortal.displayName = \"PopoverPortal\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverPositionerContext.displayName = \"PopoverPositionerContext\";\nexport function usePopoverPositionerContext() {\n const context = React.useContext(PopoverPositionerContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.' : _formatErrorMessage(46));\n }\n return context;\n}","import { clamp, evaluate, getAlignment, getAlignmentAxis, getAxisLength, getPaddingObject } from '@floating-ui/utils';\n/**\n * Fork of the original `arrow` middleware from Floating UI that allows\n * configuring the offset parent.\n */\nexport const baseArrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0,\n offsetParent = 'real'\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = offsetParent === 'real' ? await platform.getOffsetParent?.(element) : elements.floating;\n let clientSize = elements.floating[clientProp] || rects.floating[length];\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await platform.isElement?.(arrowOffsetParent))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n // eslint-disable-next-line no-nested-ternary\n const alignmentOffset = shouldAddOffset ? center < min ? center - min : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nexport const arrow = (options, deps) => ({\n ...baseArrow(options),\n options: [options, deps]\n});","export const hide = {\n name: 'hide',\n async fn(state) {\n const {\n width,\n height,\n x,\n y\n } = state.rects.reference;\n const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;\n // Mirrors Floating UI's `hide()` referenceHidden strategy. Floating UI injects\n // `detectOverflow` into the middleware platform before invoking middleware.\n const overflow = await state.platform.detectOverflow(state, {\n elementContext: 'reference'\n });\n const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;\n return {\n data: {\n referenceHidden: referenceHidden || anchorHidden\n }\n };\n }\n};","export const DEFAULT_SIDES = {\n sideX: 'left',\n sideY: 'top'\n};\n\n// Self-contained stand-in for Floating UI's `Middleware` type. Referencing the real type in\n// store state makes `tsc` declaration emit reference `Platform`/`detectOverflow` from\n// `@floating-ui/core` internals, which fails as non-portable (TS2883) in consuming builds.","'use client';\n\nimport * as React from 'react';\nimport { getSide, getAlignment, getSideAxis } from '@floating-ui/utils';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { autoUpdate, flip, limitShift, offset, shift as floatingShift, size } from \"../floating-ui-react/index.mjs\";\nimport { useBaseUIFloating } from \"../floating-ui-react/hooks/useFloating.mjs\";\nimport { useDirection } from \"./direction-context/DirectionContext.mjs\";\nimport { arrow } from \"../floating-ui-react/middleware/arrow.mjs\";\nimport { hide } from \"../utils/hideMiddleware.mjs\";\nimport { DEFAULT_SIDES } from \"../utils/adaptiveOriginConstants.mjs\";\nconst AVAILABLE_WIDTH_VAR = '--available-width';\nconst AVAILABLE_HEIGHT_VAR = '--available-height';\nfunction getLogicalSide(sideParam, renderedSide, isRtl) {\n const isLogicalSideParam = sideParam === 'inline-start' || sideParam === 'inline-end';\n const logicalRight = isRtl ? 'inline-start' : 'inline-end';\n const logicalLeft = isRtl ? 'inline-end' : 'inline-start';\n return {\n top: 'top',\n right: isLogicalSideParam ? logicalRight : 'right',\n bottom: 'bottom',\n left: isLogicalSideParam ? logicalLeft : 'left'\n }[renderedSide];\n}\nfunction getOffsetData(state, sideParam, isRtl) {\n const {\n rects,\n placement\n } = state;\n const data = {\n side: getLogicalSide(sideParam, getSide(placement), isRtl),\n align: getAlignment(placement) || 'center',\n anchor: {\n width: rects.reference.width,\n height: rects.reference.height\n },\n positioner: {\n width: rects.floating.width,\n height: rects.floating.height\n }\n };\n return data;\n}\n/**\n * Provides standardized anchor positioning behavior for floating elements. Wraps Floating UI's\n * `useFloating` hook.\n */\nexport function useAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useBaseUIFloating);\n}\nexport function useAnchorPositioningWithHook(params, useFloatingHook) {\n const {\n // Public parameters\n anchor,\n positionMethod = 'absolute',\n side: sideParam = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n collisionBoundary,\n collisionPadding: collisionPaddingParam = 5,\n sticky = false,\n arrowPadding = 5,\n disableAnchorTracking = false,\n inline: inlineMiddleware,\n // Private parameters\n keepMounted = false,\n floatingRootContext,\n mounted,\n collisionAvoidance,\n shift,\n nodeId,\n adaptiveOrigin,\n lazyFlip = false,\n externalTree\n } = params;\n const [mountSide, setMountSide] = React.useState(null);\n if (!mounted && mountSide !== null) {\n setMountSide(null);\n }\n const collisionAvoidanceSide = collisionAvoidance.side || 'flip';\n const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';\n const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';\n const shiftCrossAxis = shift?.crossAxis ?? false;\n const shiftRootBoundary = shift?.rootBoundary;\n const anchorFn = typeof anchor === 'function' ? anchor : undefined;\n const anchorFnCallback = useStableCallback(anchorFn);\n const anchorDep = anchorFn ? anchorFnCallback : anchor;\n const anchorValueRef = useValueAsRef(anchor);\n const mountedRef = useValueAsRef(mounted);\n const direction = useDirection();\n const isRtl = direction === 'rtl';\n const side = mountSide || {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'inline-end': isRtl ? 'left' : 'right',\n 'inline-start': isRtl ? 'right' : 'left'\n }[sideParam];\n const placement = align === 'center' ? side : `${side}-${align}`;\n let collisionPadding = collisionPaddingParam;\n if (typeof collisionPadding === 'number') {\n collisionPadding = {\n top: collisionPadding,\n right: collisionPadding,\n bottom: collisionPadding,\n left: collisionPadding\n };\n } else if (collisionPadding) {\n collisionPadding = {\n top: collisionPadding.top || 0,\n right: collisionPadding.right || 0,\n bottom: collisionPadding.bottom || 0,\n left: collisionPadding.left || 0\n };\n }\n\n // Create a bias to the preferred side.\n // On iOS, when the mobile software keyboard opens, the input is exactly centered\n // in the viewport, but this can cause it to flip to the top undesirably.\n // The bias is only applied to `flip()` so it doesn't shift the resting position\n // computed by `shift()` and `size()` away from the requested `collisionPadding`.\n const bias = 1;\n const biasTop = sideParam === 'bottom' ? bias : 0;\n const biasBottom = sideParam === 'top' ? bias : 0;\n const biasLeft = sideParam === 'right' ? bias : 0;\n const biasRight = sideParam === 'left' ? bias : 0;\n const commonCollisionProps = {\n boundary: collisionBoundary === 'clipping-ancestors' ? 'clippingAncestors' : collisionBoundary,\n padding: collisionPadding\n };\n\n // Using a ref assumes that the arrow element is always present in the DOM for the lifetime of the\n // popup. If this assumption ends up being false, we can switch to state to manage the arrow's\n // presence.\n const arrowRef = React.useRef(null);\n\n // Keep these reactive if they're not functions\n const sideOffsetRef = useValueAsRef(sideOffset);\n const alignOffsetRef = useValueAsRef(alignOffset);\n const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;\n const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;\n const middleware = [];\n if (inlineMiddleware) {\n middleware.push(inlineMiddleware);\n }\n middleware.push(offset(state => {\n const data = getOffsetData(state, sideParam, isRtl);\n const sideAxis = typeof sideOffsetRef.current === 'function' ? sideOffsetRef.current(data) : sideOffsetRef.current;\n const alignAxis = typeof alignOffsetRef.current === 'function' ? alignOffsetRef.current(data) : alignOffsetRef.current;\n return {\n mainAxis: sideAxis,\n crossAxis: alignAxis,\n alignmentAxis: alignAxis\n };\n }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));\n const shiftDisabled = collisionAvoidanceAlign === 'none' && collisionAvoidanceSide !== 'shift';\n const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === 'shift');\n const flipMiddleware = collisionAvoidanceSide === 'none' ? null : flip({\n ...commonCollisionProps,\n // Ensure the popup flips if it's been limited by its --available-height and it resizes.\n // Since the size() padding is smaller than the flip() padding, flip() will take precedence.\n padding: {\n top: collisionPadding.top + bias + biasTop,\n right: collisionPadding.right + bias + biasRight,\n bottom: collisionPadding.bottom + bias + biasBottom,\n left: collisionPadding.left + bias + biasLeft\n },\n mainAxis: !shiftCrossAxis && collisionAvoidanceSide === 'flip',\n crossAxis: collisionAvoidanceAlign === 'flip' ? 'alignment' : false,\n fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide\n });\n const shiftMiddleware = shiftDisabled ? null : floatingShift({\n ...commonCollisionProps,\n // Use the Layout Viewport to avoid shifting around when pinch-zooming.\n rootBoundary: shiftRootBoundary,\n mainAxis: collisionAvoidanceAlign !== 'none',\n crossAxis: crossAxisShiftEnabled,\n limiter: sticky || shiftCrossAxis ? undefined : limitShift(limitData => {\n if (!arrowRef.current) {\n return {};\n }\n const {\n width,\n height\n } = arrowRef.current.getBoundingClientRect();\n const sideAxis = getSideAxis(getSide(limitData.placement));\n const arrowSize = sideAxis === 'y' ? width : height;\n const offsetAmount = sideAxis === 'y' ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;\n return {\n offset: arrowSize / 2 + offsetAmount / 2\n };\n })\n }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);\n\n // https://floating-ui.com/docs/flip#combining-with-shift\n if (collisionAvoidanceSide === 'shift' || collisionAvoidanceAlign === 'shift' || align === 'center') {\n middleware.push(shiftMiddleware, flipMiddleware);\n } else {\n middleware.push(flipMiddleware, shiftMiddleware);\n }\n middleware.push(size({\n ...commonCollisionProps,\n apply({\n elements: {\n floating\n },\n availableWidth,\n availableHeight,\n rects\n }) {\n if (!mountedRef.current) {\n return;\n }\n const floatingStyle = floating.style;\n floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);\n floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);\n\n // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.\n const dpr = ownerWindow(floating).devicePixelRatio || 1;\n const {\n x,\n y,\n width,\n height\n } = rects.reference;\n const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;\n const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;\n floatingStyle.setProperty('--anchor-width', `${anchorWidth}px`);\n floatingStyle.setProperty('--anchor-height', `${anchorHeight}px`);\n }\n }), arrow(state => ({\n // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,\n // we'll create a fake element.\n element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),\n padding: arrowPadding,\n offsetParent: 'floating'\n }), [arrowPadding]), {\n name: 'transformOrigin',\n fn(state) {\n const {\n elements,\n middlewareData,\n placement: renderedPlacement,\n rects,\n y\n } = state;\n const currentRenderedSide = getSide(renderedPlacement);\n const currentRenderedAxis = getSideAxis(currentRenderedSide);\n const arrowEl = arrowRef.current;\n const arrowX = middlewareData.arrow?.x || 0;\n const arrowY = middlewareData.arrow?.y || 0;\n const arrowWidth = arrowEl?.clientWidth || 0;\n const arrowHeight = arrowEl?.clientHeight || 0;\n const transformX = arrowX + arrowWidth / 2;\n const transformY = arrowY + arrowHeight / 2;\n const shiftY = Math.abs(middlewareData.shift?.y || 0);\n const halfAnchorHeight = rects.reference.height / 2;\n const sideOffsetValue = typeof sideOffset === 'function' ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;\n const isOverlappingAnchor = shiftY > sideOffsetValue;\n const adjacentTransformOrigin = {\n top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,\n bottom: `${transformX}px ${-sideOffsetValue}px`,\n left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,\n right: `${-sideOffsetValue}px ${transformY}px`\n }[currentRenderedSide];\n const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y}px`;\n elements.floating.style.setProperty('--transform-origin', crossAxisShiftEnabled && currentRenderedAxis === 'y' && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);\n return {};\n }\n }, hide, adaptiveOrigin);\n useIsoLayoutEffect(() => {\n // Ensure positioning doesn't run initially for `keepMounted` elements that\n // aren't initially open.\n if (!mounted && floatingRootContext) {\n floatingRootContext.update({\n referenceElement: null,\n floatingElement: null,\n domReferenceElement: null,\n positionReference: null\n });\n }\n }, [mounted, floatingRootContext]);\n const autoUpdateOptions = React.useMemo(() => ({\n elementResize: !disableAnchorTracking && typeof ResizeObserver !== 'undefined',\n layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== 'undefined'\n }), [disableAnchorTracking]);\n const {\n refs,\n elements,\n x,\n y,\n middlewareData,\n update,\n placement: renderedPlacement,\n context,\n isPositioned,\n floatingStyles: originalFloatingStyles\n } = useFloatingHook({\n rootContext: floatingRootContext,\n open: keepMounted ? mounted : undefined,\n placement,\n middleware,\n strategy: positionMethod,\n whileElementsMounted: keepMounted ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),\n nodeId,\n externalTree\n });\n const {\n sideX,\n sideY\n } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;\n\n // Default to `fixed` when not positioned to prevent `autoFocus` scroll jumps.\n // This ensures the popup is inside the viewport initially before it gets positioned.\n const resolvedPosition = isPositioned ? positionMethod : 'fixed';\n const floatingStyles = React.useMemo(() => {\n let base;\n if (!isPositioned) {\n // Until a position for the current open is computed, ignore any coordinates retained from a\n // previous open (or from a pass that measured the hidden popup as 0x0). Rendering the\n // full-size popup at such stale coordinates can overflow the layout viewport, which makes\n // mobile Chrome zoom the page out and reflow everything the popup is anchored to.\n base = {\n position: resolvedPosition,\n top: 0,\n left: 0\n };\n } else if (adaptiveOrigin) {\n base = {\n position: resolvedPosition,\n [sideX]: x,\n [sideY]: y\n };\n } else {\n base = {\n ...originalFloatingStyles,\n position: resolvedPosition\n };\n }\n\n // Seed the available size vars so consumer `max-height: min(x, var(--available-height))` rules\n // resolve to a valid length on the first positioning pass, before `size()` writes the real\n // values. Without a fallback the unresolved `var()` invalidates the whole declaration, so the\n // popup is measured unconstrained while `flip()` picks its side, against the full content\n // height rather than the capped one. Seeded unconditionally (not only while `!isPositioned`):\n // the keys must stay present with a constant value so React's per-property style diff never\n // rewrites them after mount, preserving the px values `size()` sets imperatively. Moving them\n // into the `!isPositioned` branch makes React remove them once positioned, wiping `size()`'s\n // values and leaving the popup unconstrained.\n base[AVAILABLE_WIDTH_VAR] = '100vw';\n base[AVAILABLE_HEIGHT_VAR] = '100vh';\n if (!isPositioned) {\n base.opacity = 0;\n }\n return base;\n }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);\n const registeredPositionReferenceRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n const resolvedAnchor = typeof anchorValue === 'function' ? anchorValue() : anchorValue;\n const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;\n const finalAnchor = unwrappedElement || null;\n if (finalAnchor !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(finalAnchor);\n registeredPositionReferenceRef.current = finalAnchor;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n\n // Refs from parent components are set after useLayoutEffect runs and are available in useEffect.\n // Therefore, if the anchor is a ref, we need to update the position reference in useEffect.\n if (typeof anchorValue === 'function') {\n return;\n }\n if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(anchorValue.current);\n registeredPositionReferenceRef.current = anchorValue.current;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (keepMounted && mounted && elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);\n }\n return undefined;\n }, [keepMounted, mounted, elements, update, autoUpdateOptions]);\n const renderedSide = getSide(renderedPlacement);\n const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);\n const renderedAlign = getAlignment(renderedPlacement) || 'center';\n const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);\n\n // Locks the flip (makes it \"sticky\") so it doesn't prefer a given placement\n // and flips back lazily, not eagerly. Ideal for filtered lists that change\n // the size of the popup dynamically to avoid unwanted flipping when typing.\n useIsoLayoutEffect(() => {\n if (lazyFlip && mounted && isPositioned && renderedSide !== side) {\n setMountSide(renderedSide);\n }\n }, [lazyFlip, mounted, isPositioned, renderedSide, side]);\n const arrowStyles = React.useMemo(() => ({\n position: 'absolute',\n top: middlewareData.arrow?.y,\n left: middlewareData.arrow?.x\n }), [middlewareData.arrow]);\n const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;\n return React.useMemo(() => ({\n positionerStyles: floatingStyles,\n arrowStyles,\n arrowRef,\n arrowUncentered,\n side: logicalRenderedSide,\n align: renderedAlign,\n physicalSide: renderedSide,\n anchorHidden,\n refs,\n context,\n isPositioned,\n update\n }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update]);\n}\nfunction isRef(param) {\n return param != null && 'current' in param;\n}","import * as React from 'react';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop(props, ref) {\n const {\n cutout,\n ...otherProps\n } = props;\n let clipPath;\n if (cutout) {\n const rect = cutout.getBoundingClientRect();\n clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"presentation\"\n // Ensures Floating UI's outside press detection runs, as it considers\n // it an element that existed when the popup rendered.\n ,\n \"data-base-ui-inert\": \"\",\n ...otherProps,\n style: {\n position: 'fixed',\n inset: 0,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n clipPath\n }\n });\n});\nif (process.env.NODE_ENV !== \"production\") InternalBackdrop.displayName = \"InternalBackdrop\";","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { DISABLED_TRANSITIONS_STYLE } from \"./constants.mjs\";\nexport function getDisabledMountTransitionStyles(transitionStatus) {\n return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;\n}","'use client';\n\nimport { popupStateMapping } from \"./popupStateMapping.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../internals/getDisabledMountTransitionStyles.mjs\";\n/**\n * Renders the shared outer Positioner element used by popup components.\n * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.\n */\nexport function usePositioner(componentProps, state, {\n styles,\n transitionStatus,\n props,\n refs,\n hidden,\n inert = false\n}) {\n const style = {\n ...styles\n };\n if (inert) {\n style.pointerEvents = 'none';\n }\n return useRenderElement('div', componentProps, {\n state,\n ref: refs,\n props: [{\n role: 'presentation',\n hidden,\n style\n }, getDisabledMountTransitionStyles(transitionStatus), props],\n stateAttributesMapping: popupStateMapping\n });\n}","'use client';\n\nimport { isOverflowElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from \"./addEventListener.mjs\";\nimport { platform } from \"./platform/index.mjs\";\nimport { ownerDocument, ownerWindow } from \"./owner.mjs\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { Timeout } from \"./useTimeout.mjs\";\nimport { AnimationFrame } from \"./useAnimationFrame.mjs\";\nlet originalHtmlStyles = {};\nlet originalBodyStyles = {};\nlet originalHtmlScrollBehavior = '';\n\n// The viewport's overflow comes from <html> when it establishes its own scroll container, and\n// propagates from <body> otherwise. An `overflow` style on the other element doesn't lock the page.\nfunction getViewportScroller(html, body) {\n return isOverflowElement(html) ? html : body;\n}\nfunction isPageScrollLocked(win, html, body) {\n return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);\n}\nfunction hasInsetScrollbars(referenceElement) {\n if (typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const win = ownerWindow(doc);\n return win.innerWidth - doc.documentElement.clientWidth > 0;\n}\nfunction supportsStableScrollbarGutter(referenceElement) {\n const supported = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('scrollbar-gutter', 'stable');\n if (!supported || typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const scrollContainer = getViewportScroller(html, body);\n const originalScrollContainerOverflowY = scrollContainer.style.overflowY;\n const originalHtmlStyleGutter = html.style.scrollbarGutter;\n html.style.scrollbarGutter = 'stable';\n scrollContainer.style.overflowY = 'scroll';\n const before = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = 'hidden';\n const after = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = originalScrollContainerOverflowY;\n html.style.scrollbarGutter = originalHtmlStyleGutter;\n return before === after;\n}\nfunction preventScrollOverlayScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n\n // If an `overflow` style is present on <html>, we need to lock it, because a lock on <body>\n // won't have any effect.\n // But if <body> has an `overflow` style (like `overflow-x: hidden`), we need to lock it\n // instead, as sticky elements shift otherwise.\n const elementToLock = getViewportScroller(html, body);\n const originalElementToLockStyles = {\n overflowY: elementToLock.style.overflowY,\n overflowX: elementToLock.style.overflowX\n };\n Object.assign(elementToLock.style, {\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n return () => {\n Object.assign(elementToLock.style, originalElementToLockStyles);\n };\n}\nfunction preventScrollInsetScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n let scrollTop = 0;\n let scrollLeft = 0;\n let updateGutterOnly = false;\n const resizeFrame = AnimationFrame.create();\n\n // Pinch-zoom in Safari causes a shift. Just don't lock scroll if there's any pinch-zoom.\n if (platform.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {\n return () => {};\n }\n function lockScroll() {\n /* DOM reads: */\n\n const htmlStyles = win.getComputedStyle(html);\n const bodyStyles = win.getComputedStyle(body);\n const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || '';\n const hasBothEdges = htmlScrollbarGutterValue.includes('both-edges');\n const scrollbarGutterValue = hasBothEdges ? 'stable both-edges' : 'stable';\n scrollTop = html.scrollTop;\n scrollLeft = html.scrollLeft;\n originalHtmlStyles = {\n scrollbarGutter: html.style.scrollbarGutter,\n overflowY: html.style.overflowY,\n overflowX: html.style.overflowX\n };\n originalHtmlScrollBehavior = html.style.scrollBehavior;\n originalBodyStyles = {\n position: body.style.position,\n height: body.style.height,\n width: body.style.width,\n boxSizing: body.style.boxSizing,\n overflowY: body.style.overflowY,\n overflowX: body.style.overflowX,\n scrollBehavior: body.style.scrollBehavior\n };\n const isScrollableY = html.scrollHeight > html.clientHeight;\n const isScrollableX = html.scrollWidth > html.clientWidth;\n const hasConstantOverflowY = htmlStyles.overflowY === 'scroll' || bodyStyles.overflowY === 'scroll';\n const hasConstantOverflowX = htmlStyles.overflowX === 'scroll' || bodyStyles.overflowX === 'scroll';\n\n // Values can be negative in Firefox\n const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);\n const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);\n\n // Avoid shift due to the default <body> margin. This does cause elements to be clipped\n // with whitespace. Warn if <body> has margins?\n const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);\n const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);\n const elementToLock = getViewportScroller(html, body);\n updateGutterOnly = supportsStableScrollbarGutter(referenceElement);\n\n /*\n * DOM writes:\n * Do not read the DOM past this point!\n */\n\n if (updateGutterOnly) {\n html.style.scrollbarGutter = scrollbarGutterValue;\n elementToLock.style.overflowY = 'hidden';\n elementToLock.style.overflowX = 'hidden';\n return;\n }\n Object.assign(html.style, {\n scrollbarGutter: scrollbarGutterValue,\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n if (isScrollableY || hasConstantOverflowY) {\n html.style.overflowY = 'scroll';\n }\n if (isScrollableX || hasConstantOverflowX) {\n html.style.overflowX = 'scroll';\n }\n Object.assign(body.style, {\n position: 'relative',\n height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',\n width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',\n boxSizing: 'border-box',\n // Assign the longhands that `cleanup` restores, so nothing is left behind.\n overflowY: 'hidden',\n overflowX: 'hidden',\n scrollBehavior: 'unset'\n });\n body.scrollTop = scrollTop;\n body.scrollLeft = scrollLeft;\n html.setAttribute('data-base-ui-scroll-locked', '');\n html.style.scrollBehavior = 'unset';\n }\n function cleanup() {\n Object.assign(html.style, originalHtmlStyles);\n Object.assign(body.style, originalBodyStyles);\n if (!updateGutterOnly) {\n html.scrollTop = scrollTop;\n html.scrollLeft = scrollLeft;\n html.removeAttribute('data-base-ui-scroll-locked');\n html.style.scrollBehavior = originalHtmlScrollBehavior;\n }\n }\n function handleResize() {\n cleanup();\n resizeFrame.request(lockScroll);\n }\n lockScroll();\n const unsubscribeResize = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n cleanup();\n // Sometimes this cleanup can run after test teardown because it is called\n // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling\n // `removeEventListener` when it is no longer available in tests.\n if (typeof win.removeEventListener === 'function') {\n unsubscribeResize();\n }\n };\n}\nclass ScrollLocker {\n lockCount = 0;\n restore = null;\n timeoutLock = Timeout.create();\n timeoutUnlock = Timeout.create();\n acquire(referenceElement) {\n this.lockCount += 1;\n if (this.lockCount === 1 && this.restore === null) {\n this.timeoutLock.start(0, () => this.lock(referenceElement));\n }\n return this.release;\n }\n release = () => {\n this.lockCount -= 1;\n if (this.lockCount === 0 && this.restore) {\n this.timeoutUnlock.start(0, this.unlock);\n }\n };\n unlock = () => {\n if (this.lockCount === 0 && this.restore) {\n this.restore?.();\n this.restore = null;\n }\n };\n lock(referenceElement) {\n if (this.lockCount === 0 || this.restore !== null) {\n return;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n\n // The page is already locked, either by the site author or by a non-Base UI overlay that\n // hasn't cleaned up yet. Leave it alone and wait for the lock to clear before taking over,\n // otherwise we'd snapshot the locked state and restore it after our own lock is released.\n if (isPageScrollLocked(win, html, body)) {\n const observer = new win.MutationObserver(() => {\n if (isPageScrollLocked(win, html, body)) {\n return;\n }\n observer.disconnect();\n this.restore = null;\n this.lock(referenceElement);\n });\n\n // Watch every attribute: locks are applied through inline styles, classes, or attributes\n // paired with a stylesheet (`data-scroll-locked` in react-remove-scroll, for example).\n const options = {\n attributes: true\n };\n observer.observe(html, options);\n observer.observe(body, options);\n this.restore = () => observer.disconnect();\n return;\n }\n const hasOverlayScrollbars = platform.os.ios || !hasInsetScrollbars(referenceElement);\n\n // On iOS, scroll locking does not work if the navbar is collapsed. Due to numerous\n // side effects and bugs that arise on iOS, it must be researched extensively before\n // being enabled to ensure it doesn't cause the following issues:\n // - Textboxes must scroll into view when focused, nor cause a glitchy scroll animation.\n // - The navbar must not force itself into view and cause layout shift.\n // - Scroll containers must not flicker upon closing a popup when it has an exit animation.\n this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);\n }\n}\nconst SCROLL_LOCKER = new ScrollLocker();\n\n/**\n * Locks the scroll of the document when enabled.\n *\n * @param enabled - Whether to enable the scroll lock.\n * @param referenceElement - Element to use as a reference for lock calculations.\n */\nexport function useScrollLock(enabled = true, referenceElement = null) {\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n return SCROLL_LOCKER.acquire(referenceElement);\n }, [enabled, referenceElement]);\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\n\n// Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.\n// This hook re-enables scroll lock only when the popup is effectively full-width.\n// Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side\n// padding still locks scroll, since that leaves too little outside space for a reliable swipe.\nconst VIEWPORT_WIDTH_TOLERANCE_PX = 20;\n\n/**\n * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when\n * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively\n * viewport-sized.\n */\nexport function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {\n const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);\n useIsoLayoutEffect(() => {\n if (!enabled || !touchOpen || positionerElement == null) {\n setTouchOpenShouldLockScroll(false);\n return;\n }\n const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;\n const popupWidth = positionerElement.offsetWidth;\n setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);\n }, [enabled, touchOpen, positionerElement]);\n useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);\n}","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { FloatingNode, useFloatingNodeId } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { PopoverPositionerContext } from \"./PopoverPositionerContext.mjs\";\nimport { useAnchorPositioning } from \"../../internals/useAnchorPositioning.mjs\";\nimport { usePopoverPortalContext } from \"../portal/PopoverPortalContext.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { POPUP_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { useAnimationsFinished } from \"../../internals/useAnimationsFinished.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { useAnchoredPopupScrollLock } from \"../../utils/useAnchoredPopupScrollLock.mjs\";\n\n/**\n * Positions the popover against the trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const PopoverPositioner = /*#__PURE__*/React.forwardRef(function PopoverPositioner(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n anchor,\n // `useAnchorPositioning` applies the same defaults to the undefined values; the names\n // remain destructured to exclude the props from `elementProps`.\n positionMethod,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding,\n arrowPadding,\n sticky,\n disableAnchorTracking = false,\n collisionAvoidance = POPUP_COLLISION_AVOIDANCE,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const keepMounted = usePopoverPortalContext();\n const nodeId = useFloatingNodeId();\n const floatingRootContext = store.useState('floatingRootContext');\n const mounted = store.useState('mounted');\n const open = store.useState('open');\n const openReason = store.useState('openChangeReason');\n const triggerElement = store.useState('activeTriggerElement');\n const modal = store.useState('modal');\n const openMethod = store.useState('openMethod');\n const positionerElement = store.useState('positionerElement');\n const instantType = store.useState('instantType');\n const transitionStatus = store.useState('transitionStatus');\n const adaptiveOrigin = store.useState('adaptiveOrigin');\n const prevTriggerElementRef = React.useRef(null);\n const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);\n const positioning = useAnchorPositioning({\n anchor,\n floatingRootContext,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking,\n keepMounted,\n nodeId,\n collisionAvoidance,\n adaptiveOrigin\n });\n const domReference = floatingRootContext.useState('domReferenceElement');\n\n // When the current trigger element changes, enable transitions on the\n // positioner temporarily\n useIsoLayoutEffect(() => {\n const currentTriggerElement = domReference;\n const prevTriggerElement = prevTriggerElementRef.current;\n if (currentTriggerElement) {\n prevTriggerElementRef.current = currentTriggerElement;\n }\n if (prevTriggerElement && currentTriggerElement && currentTriggerElement !== prevTriggerElement) {\n store.set('instantType', undefined);\n const ac = new AbortController();\n runOnceAnimationsFinish(() => {\n store.set('instantType', 'trigger-change');\n }, ac.signal);\n return () => {\n ac.abort();\n };\n }\n return undefined;\n }, [domReference, runOnceAnimationsFinish, store]);\n const trueModalNonHover = modal === true && openReason !== REASONS.triggerHover;\n useAnchoredPopupScrollLock(open && trueModalNonHover, openMethod === 'touch', positionerElement, triggerElement);\n const setPositionerElement = store.useStateSetter('positionerElement');\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n instant: instantType\n };\n const element = usePositioner(componentProps, state, {\n styles: positioning.positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n return /*#__PURE__*/_jsxs(PopoverPositionerContext.Provider, {\n value: positioning,\n children: [mounted && trueModalNonHover && /*#__PURE__*/_jsx(InternalBackdrop, {\n inert: inertValue(!open),\n cutout: triggerElement\n }), /*#__PURE__*/_jsx(FloatingNode, {\n id: nodeId,\n children: element\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPositioner.displayName = \"PopoverPositioner\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ToolbarRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ToolbarRootContext.displayName = \"ToolbarRootContext\";\nexport function useToolbarRootContext(optional) {\n const context = React.useContext(ToolbarRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : _formatErrorMessage(69));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport const ClosePartContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ClosePartContext.displayName = \"ClosePartContext\";\nexport function useClosePartCount() {\n const [closePartCount, setClosePartCount] = React.useState(0);\n const register = useStableCallback(() => {\n setClosePartCount(count => count + 1);\n return () => {\n setClosePartCount(count => Math.max(0, count - 1));\n };\n });\n const context = React.useMemo(() => ({\n register\n }), [register]);\n return {\n context,\n hasClosePart: closePartCount > 0\n };\n}\nexport function useClosePartRegistration() {\n const context = React.useContext(ClosePartContext);\n useIsoLayoutEffect(() => {\n return context?.register();\n }, [context]);\n}","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { FloatingFocusManager, useHoverFloatingInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { usePopoverPositionerContext } from \"../positioner/PopoverPositionerContext.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { COMPOSITE_KEYS } from \"../../internals/composite/composite.mjs\";\nimport { useToolbarRootContext } from \"../../toolbar/root/ToolbarRootContext.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\nimport { ClosePartContext, useClosePartCount } from \"../../utils/closePart.mjs\";\nimport { FOCUSABLE_POPUP_PROPS, createDefaultInitialFocus } from \"../../utils/popups/index.mjs\";\n\n/**\n * A container for the popover contents.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const PopoverPopup = /*#__PURE__*/React.forwardRef(function PopoverPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n initialFocus,\n finalFocus,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const positioner = usePopoverPositionerContext();\n const insideToolbar = useToolbarRootContext(true) != null;\n const {\n context: closePartContext,\n hasClosePart\n } = useClosePartCount();\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const instantType = store.useState('instantType');\n const transitionStatus = store.useState('transitionStatus');\n const popupProps = store.useState('popupProps');\n const titleId = store.useState('titleElementId');\n const descriptionId = store.useState('descriptionElementId');\n const modal = store.useState('modal');\n const mounted = store.useState('mounted');\n const openReason = store.useState('openChangeReason');\n const activeTriggerElement = store.useState('activeTriggerElement');\n const floatingContext = store.useState('floatingRootContext');\n const floatingId = floatingContext.useState('floatingId');\n const disabled = store.useState('disabled');\n const openOnHover = store.useState('openOnHover');\n const closeDelay = store.useState('closeDelay');\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete?.(true);\n }\n }\n });\n useHoverFloatingInteraction(floatingContext, {\n enabled: openOnHover && !disabled,\n closeDelay\n });\n const resolvedInitialFocus = initialFocus === undefined ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;\n const focusManagerModal = modal !== false && hasClosePart;\n store.useSyncedValue('focusManagerModal', focusManagerModal);\n const setPopupElement = store.useStateSetter('popupElement');\n const state = {\n open,\n side: positioner.side,\n align: positioner.align,\n instant: instantType,\n transitionStatus\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, store.context.popupRef, setPopupElement],\n props: [popupProps, {\n id: floatingId,\n role: 'dialog',\n ...FOCUSABLE_POPUP_PROPS,\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n onKeyDown(event) {\n if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {\n event.stopPropagation();\n }\n }\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping: popupTransitionStateMapping\n });\n return /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingContext,\n openInteractionType: openMethod,\n modal: focusManagerModal,\n disabled: !mounted || openReason === REASONS.triggerHover,\n initialFocus: resolvedInitialFocus,\n returnFocus: finalFocus,\n restoreFocus: \"popup\",\n previousFocusableElement: isHTMLElement(activeTriggerElement) ? activeTriggerElement : undefined,\n nextFocusableElement: store.context.triggerFocusTargetRef,\n beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,\n children: /*#__PURE__*/_jsx(ClosePartContext.Provider, {\n value: closePartContext,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPopup.displayName = \"PopoverPopup\";","/**\n * Browser half: a toolbar button in the composer trailing row, and the panel\n * it opens. The trigger keeps ContextMeter's chrome (28×28 ghost button,\n * pill radius, hover wash, 14px layers glyph, Tooltip 200ms); the panel\n * itself is a Base UI Popover with enter/exit animation and proper focus\n * management, anchored `side=top align=end` to the trigger.\n *\n * Component strategy: interactive behavior comes from @base-ui/react —\n * Switch for toggles, Collapsible for disclosures,\n * Tabs for the three capability sections, Popover for the shell, Input for\n * the always-visible filter. We write only token skins. Base UI is bundled per-plugin (Plan A):\n * it is a devDependency because tsdown auto-externalizes `dependencies`, and\n * the browser has no node_modules to resolve a leaked require.\n *\n * Information architecture: three sections become tabs (a 320px-wide stacked\n * list forced scrolling past whole sections to reach the next). While the\n * filter query is active the tabs collapse into one flat, fully-expanded\n * result list — a match can come from a description, so hidden detail would\n * make \"why did this row match\" unanswerable.\n *\n * Colors/typography come from the host's `--dsw-*` design tokens with hex\n * fallbacks so the panel never renders unstyled while a token is absent;\n * chips tint via color-mix on the same tokens, so dark mode stays free.\n */\nimport type { McpServerEntry, SkillEntry, SkillLoadState, ToolEntry } from '../contract.js';\nimport { subscribe, getSnapshot, toggle, close, refresh, reset, setCapability } from './store.js';\nimport { filterPayload } from './filter.js';\nimport { MCP_TOOL_ROOT_CLASS, ROW_HEADER_CLASS, ROW_ROOT_CLASS, resolveDisclosure } from './disclosure.js';\nimport { LOCALE_NS, registerLocale } from './locale.js';\nimport type { LocaleService } from './locale.js';\nimport { PANEL_CSS, TOK } from './styles.js';\nimport { capabilitySwitch } from './switch.js';\nimport { PresetToolSection } from './preset-section.js';\nimport { resetPresetTools } from './preset-store.js';\n\nconst ROUTE = '/api/capability-panel';\n\n// React comes through the module loader's `require`, which resolves the HOST's\n// copy — the runtime calls `apply(ctx, config)`, never `apply(ctx, react)`.\n// tsdown keeps this import external so no second React instance is bundled.\nimport * as React from 'react';\n// Same story for primitives: the module system resolves it to the host graph's\n// row (every shipped UI bundle requires it the same way), keeping Tooltip's\n// theme and i18n context singular. tsdown must NOT bundle it.\nimport {\n IconChevronRightOutline14,\n IconContextInjectionOutline16,\n IconSendOutline14,\n IconSearchOutline16,\n Tooltip,\n} from '@deepseek-ai/dsh-client-ui-primitives';\n// Base UI's `react`/`react/jsx-runtime` imports stay external and resolve to\n// the host instance, exactly like our own (verified against shipped bundles).\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { Input } from '@base-ui/react/input';\nimport { Popover } from '@base-ui/react/popover';\nimport { Tabs } from '@base-ui/react/tabs';\n\ninterface SlotContext {\n readonly slots: {\n inject(name: string, callback: () => (() => void) | void): void;\n register(spec: Record<string, unknown>, component: unknown): () => void;\n };\n /** Cordis lifecycle/event verb, on the dynamic facade's whitelist. */\n on(event: 'connection/reset', listener: () => void): void;\n effect(factory: () => (() => void) | void, label?: string): void;\n /**\n * The host's locale runtime (dsh-client-locale), a hard inject like every\n * shipped UI bundle: dictionaries register into it, and its revision\n * observable re-renders the panel on a language switch.\n */\n readonly locale: LocaleService;\n}\n\ninterface DockProps {\n readonly sessionId?: string;\n /** InputZone owner prop: the live input snapshot (we only read the draft). */\n readonly input?: { readonly draft?: string };\n /**\n * Standard prop published by ui-conversation's input kit. The panel only\n * fills the draft — submitting stays with the user (Enter / send button).\n */\n readonly inputActions?: {\n setDraft(text: string): void;\n };\n}\n\n/** The host's React, typed loosely because its identity must stay the host's. */\ntype ReactLike = {\n createElement(this: void, type: unknown, props?: unknown, ...children: unknown[]): unknown;\n useState<T>(initial: T): [T, (next: T | ((prev: T) => T)) => void];\n useRef<T>(initial: T): { current: T };\n useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, get: () => T): T;\n useEffect(effect: () => void | (() => void), deps?: readonly unknown[]): void;\n};\n\n/**\n * Order by how much the reader needs to act on it: what fell out of context\n * first, then what is in it, then the rest.\n */\nconst STATE_ORDER: Record<SkillLoadState, number> = { evicted: 0, pruned: 1, loaded: 2, unloaded: 3 };\n\nfunction sortSkills(skills: readonly SkillEntry[]): SkillEntry[] {\n return [...skills].sort(\n (a, b) => STATE_ORDER[a.state] - STATE_ORDER[b.state] || a.name.localeCompare(b.name),\n );\n}\n\nexport function apply(ctx: SlotContext): void {\n const react = React as unknown as ReactLike;\n const h = react.createElement;\n\n // Panel copy follows the host's language switch: dictionaries register into\n // the shared locale runtime, and `t` reads the active locale per call.\n ctx.effect(() => registerLocale(ctx.locale), 'capability-panel: dictionaries');\n const t = ctx.locale.bind(LOCALE_NS);\n // uSES channel over the locale revision: a language switch re-renders the\n // panel even though `t` itself is a stable reference.\n const subscribeLocale = (fn: () => void): (() => void) => ctx.locale.subscribe(fn);\n const getLocaleSnapshot = (): { readonly active: string; readonly revision: number } => ctx.locale.getSnapshot();\n\n // A host restart drops every fact the panel shows; ui-skill clears its\n // caches on the same event. The store's reset also invalidates in-flight\n // answers from the dead connection.\n ctx.on('connection/reset', () => {\n reset();\n resetPresetTools();\n });\n\n // Pseudo-class states can't be expressed inline: one small stylesheet for\n // hover, focus-visible, enter/exit animation, the tabs skin, collapsible\n // height animation, and row-level content-visibility. Colors stay on the\n // same --dsw-* tokens the inline styles use. Lifecycle follows the\n // workspace rule: ctx.effect + data-plugin tag, so HMR/unload removes it\n // and a fresh apply can update the content.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {};\n const style = document.createElement('style');\n style.dataset.plugin = 'dsh-capability-panel';\n style.textContent = PANEL_CSS;\n document.head.appendChild(style);\n return () => { style.remove(); };\n }, 'capability-panel: stylesheet');\n\n /** Host iconography: the panel inspects what lands in the session's context. */\n const layersIcon = (size: number) => h(IconContextInjectionOutline16, { size });\n\n /** Magnifier sitting inside the filter input. */\n const searchIcon = (size: number) => h(IconSearchOutline16, { size });\n\n /** Paper plane: the row action lands the command in the composer,\n * ready for the user's own Enter. */\n const insertIcon = (size: number) => h(IconSendOutline14, { size });\n\n ctx.slots.inject('settings.section', () =>\n ctx.slots.register(\n { name: 'settings.section', id: 'capability-panel', order: 25, label: () => t('preset.nav') },\n () => h(PresetToolSection, { t, subscribeLocale, getLocaleSnapshot }),\n ),\n );\n\n ctx.slots.inject('conversation.input.right', () =>\n ctx.slots.register({ name: 'conversation.input.right', id: 'capability-panel', order: 1000 }, (props: DockProps) => {\n const snap = react.useSyncExternalStore(subscribe, getSnapshot);\n // Subscribed for the re-render, not the value: `t` reads the active\n // locale at call time, so a revision bump is all the panel needs.\n react.useSyncExternalStore(subscribeLocale, getLocaleSnapshot);\n // Per-row detail expansion, keyed so a reordered list keeps each row's\n // state. While a filter query is active every visible row is forced\n // open so the text it matched on shows without a second click.\n const [expanded, setExpanded] = react.useState<Record<string, boolean>>({});\n const [query, setQuery] = react.useState('');\n const [tab, setTab] = react.useState('skills');\n const sessionId = props.sessionId ?? null;\n\n // Refetch when the panel opens rather than polling: the answer is only\n // interesting while someone is looking at it.\n react.useEffect(() => {\n if (snap.open) void refresh(sessionId);\n }, [snap.open, sessionId]);\n\n // The store owns the open flag (it outlives this component); the\n // Popover is controlled by it and reports its own dismissal intents\n // (outside press, Escape) back through this sync.\n const syncOpen = (open: boolean) => {\n const current = getSnapshot().open;\n if (open && !current) toggle();\n else if (!open && current) close();\n };\n\n // One canonical query drives matching, clear affordance, Escape, and the\n // filtered layout. The old split (`trim()` here, raw query elsewhere)\n // made a spaces-only value look simultaneously filtered and unfiltered.\n const normalizedQuery = query.trim();\n const filtering = normalizedQuery !== '';\n const payload = snap.payload;\n const skillSourceLabel = (skill: SkillEntry): string => {\n const key = `source.${skill.source}`;\n const translated = t(key);\n return translated === key ? skill.source : translated;\n };\n const openSourceFolder = (source: string) => {\n if (sessionId === null) return;\n void fetch(`${ROUTE}/open-folder`, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ sessionId, source }),\n }).then(async (response) => {\n if (!response.ok) {\n const detail = await response.text();\n console.warn(`[capability-panel] cannot open source folder (${response.status}): ${detail}`);\n }\n }).catch((error: unknown) => {\n console.warn('[capability-panel] open source folder request failed', error);\n });\n };\n /**\n * Middle ellipsis for long path labels: both ends carry the meaning\n * (`~/…` context, the tail directory), the middle is the expendable\n * part. The full path stays in the hover tooltip.\n */\n const ellipsizeMiddle = (text: string, max = 42): string => {\n if (text.length <= max) return text;\n const head = Math.ceil((max - 1) / 2);\n const tail = Math.floor((max - 1) / 2);\n return `${text.slice(0, head)}…${text.slice(text.length - tail)}`;\n };\n /**\n * Section header for a source group, rendered as a labeled rule:\n * `── 📁 ~/.agents/skills (4) ────────────`. Label rule: preset-bundled\n * entries name their preset; every other group shows its real directory\n * (host-abbreviated `~`/cwd-relative, middle-ellipsized when long), and\n * only groups without a filesystem location fall back to the translated\n * source name. `groupKey` is the grouping identity; `rawSource` is what\n * the open-folder route resolves by.\n */\n const sourceSectionHeader = (groupKey: string, rawSource: string, count: number, first: boolean, path?: string, openable = false) => {\n const label = groupKey.startsWith('preset:')\n ? groupKey.slice(7)\n : path !== undefined\n ? ellipsizeMiddle(path)\n : groupKey === 'host' ? t('source.host') : skillSourceLabel({ source: groupKey } as SkillEntry);\n const rule = (grow: boolean) => h('span', {\n style: grow\n ? { flex: '1', height: '1px', background: TOK.borderStrong }\n : { flex: 'none', width: '16px', height: '1px', background: TOK.borderStrong },\n });\n return h(\n 'div',\n {\n key: `source:${groupKey}`,\n className: 'ci-source-header',\n style: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n margin: first ? '0 0 2px' : '10px 0 2px',\n },\n },\n rule(false),\n h(\n 'span',\n {\n style: {\n flex: 'none',\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n cursor: openable ? 'pointer' : 'default',\n },\n title: openable ? t('source.openFolder', { source: path ?? label }) : undefined,\n onClick: openable ? () => { openSourceFolder(rawSource); } : undefined,\n },\n openable\n ? h(\n 'span',\n {\n className: 'ci-folder-icon',\n style: {\n display: 'inline-grid',\n placeItems: 'center',\n opacity: 0,\n transition: 'opacity 0.15s',\n },\n },\n // Minimal folder SVG, 12×12.\n h(\n 'svg',\n { width: '12', height: '12', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': '2', 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },\n h('path', { d: 'M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z' }),\n ),\n )\n : null,\n `${label} (${count})`,\n ),\n rule(true),\n );\n };\n /** Group items by source, preserving order within each group. */\n const groupBySource = <T>(items: readonly T[], getSource: (item: T) => string): [string, T[]][] => {\n const groups = new Map<string, T[]>();\n const order: string[] = [];\n for (const item of items) {\n const source = getSource(item);\n const bucket = groups.get(source);\n if (bucket) bucket.push(item);\n else { groups.set(source, [item]); order.push(source); }\n }\n return order.map((source) => [source, groups.get(source)!]);\n };\n const view = payload === null ? null : filterPayload(payload, normalizedQuery, (skill) => t(`state.${skill.state}`), skillSourceLabel);\n const skills = view === null ? [] : sortSkills(view.skills);\n const mcp = view?.mcp ?? [];\n const systemTools = view?.systemTools ?? [];\n const blocked = payload?.blocked ?? {};\n const totals = {\n skills: payload?.skills.length ?? 0,\n mcp: payload?.mcp.length ?? 0,\n systemTools: payload?.systemTools.length ?? 0,\n };\n const totalAll = totals.skills + totals.mcp + totals.systemTools;\n\n const setOpen = (key: string, open: boolean) => {\n setExpanded((prev) => ({ ...prev, [key]: open }));\n };\n\n /**\n * Stable pill geometry for every skill state: green means loaded, blue\n * means pruned (head/tail still visible), neutral means unloaded, amber\n * means evicted, and the independent red pill records blocked attempts\n * after a capability was disabled.\n */\n const chip = (text: string, color: string) =>\n h(\n 'span',\n {\n style: {\n flex: '0 0 auto',\n fontSize: '11px',\n lineHeight: '16px',\n padding: '1px 7px',\n borderRadius: '999px',\n color,\n background: `color-mix(in srgb, ${color} 14%, transparent)`,\n fontVariantNumeric: 'tabular-nums',\n whiteSpace: 'nowrap',\n },\n },\n text,\n );\n\n // A blocked attempt is the strongest signal a toggle gives: the agent\n // still reached for the capability after the user turned it off.\n const blockedChip = (count: number) => (count > 0 ? chip(t('blocked.count', { count }), TOK.error) : null);\n\n const metaText = (text: string) =>\n h(\n 'span',\n {\n style: {\n flex: '0 0 auto',\n fontSize: '11px',\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n whiteSpace: 'nowrap',\n },\n },\n text,\n );\n\n // Skill state always occupies the same pill-shaped visual slot. Color,\n // not geometry, communicates meaning: loaded is green, pruned is the\n // informational blue of a partially visible result, unloaded stays\n // neutral, and evicted is amber because it may need attention.\n const stateMeta = (skill: SkillEntry) => {\n const text = t(`state.${skill.state}`) + (skill.loadCount > 1 ? ` ×${skill.loadCount}` : '');\n const color =\n skill.state === 'loaded'\n ? TOK.success\n : skill.state === 'pruned'\n ? TOK.info\n : skill.state === 'evicted'\n ? TOK.warn\n : TOK.textTertiary;\n return chip(text, color);\n };\n\n // Base UI Switch renders the button with role/aria-checked wired; we\n // keep the track sizing and token colors.\n const switchControl = (kind: 'skill' | 'mcp-server' | 'mcp-tool' | 'system-tool', name: string, enabled: boolean) =>\n capabilitySwitch({\n checked: enabled,\n disabled: sessionId === null,\n busy: snap.loading,\n label: t(enabled ? 'action.disable' : 'action.enable', { name }),\n onCheckedChange: (checked) => {\n if (sessionId !== null) void setCapability(sessionId, kind, name, checked);\n },\n });\n\n /** Right chevron the disclosure CSS rotates 90° when expanded. */\n const chevronIcon = h(IconChevronRightOutline14, { size: 12 });\n\n const groupLabel = (text: string, first: boolean) =>\n h(\n 'div',\n {\n key: `group:${text}`,\n style: {\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n margin: first ? '0 0 2px' : '12px 0 2px',\n },\n },\n text,\n );\n\n const nameText = (text: string, sourceLabel?: string) =>\n h(\n 'span',\n {\n className: 'ci-name',\n style: {\n flex: '1 1 auto',\n wordBreak: 'break-all',\n color: TOK.textPrimary,\n fontWeight: 500,\n },\n },\n text,\n sourceLabel !== undefined\n ? h(\n 'span',\n {\n style: {\n color: TOK.textTertiary,\n fontWeight: 400,\n fontSize: '11px',\n marginLeft: '2px',\n },\n },\n `· ${sourceLabel}`,\n )\n : null,\n );\n\n /** The trigger's accessible name, localized with its subject. */\n const disclosureAria = (\n subject: string,\n detailKey: 'detail.description' | 'detail.tools',\n disclosure: { open: boolean; disabled: boolean },\n ) => {\n const detail = t(detailKey);\n if (disclosure.disabled) return t('disclosure.pinned', { subject, detail });\n return disclosure.open\n ? t('disclosure.collapse', { subject, detail })\n : t('disclosure.expand', { subject, detail });\n };\n\n /**\n * Shared disclosure row for Skills, MCP tools, and System tools. The\n * trigger owns only chevron + label; trailing actions remain independent\n * buttons and never toggle the description.\n */\n const disclosureRow = (\n key: string,\n enabled: boolean,\n label: string,\n description: string | undefined,\n actions: readonly unknown[],\n className = ROW_ROOT_CLASS,\n sourceLabel?: string,\n ) => {\n const hasDescription = description !== undefined && description !== '';\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n const ariaLabel = disclosureAria(label, 'detail.description', disclosure);\n if (!hasDescription) {\n return h(\n 'div',\n {\n key,\n className,\n style: { opacity: enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h('span', { style: { width: '18px', flex: 'none' } }),\n nameText(label, sourceLabel),\n ...actions,\n ),\n );\n }\n return h(\n Collapsible.Root,\n {\n key,\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setOpen(key, open); },\n className,\n style: { opacity: enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger',\n disabled: disclosure.disabled,\n 'aria-label': ariaLabel,\n },\n h('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n nameText(label, sourceLabel),\n ),\n ...actions,\n ),\n h(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n h('div', { className: 'ci-description' }, description),\n ),\n );\n };\n\n /**\n * Put a skill's slash command into the composer — never auto-submit:\n * whether to send is the user's call (Enter). A non-empty draft is\n * appended to, never replaced. Works for disabled skills too: the\n * disable shadow keeps userInvocable: true by design.\n */\n const insertCommand = (name: string) => {\n const actions = props.inputActions;\n if (actions === undefined) return;\n const draft = props.input?.draft ?? '';\n actions.setDraft(draft.trim() === '' ? `/${name} ` : `${draft} /${name} `);\n close();\n };\n\n const insertButton = (name: string) =>\n h(\n 'button',\n {\n type: 'button',\n className: 'ci-iconbtn ci-send',\n 'aria-label': t('action.insert', { name }),\n disabled: props.inputActions === undefined,\n onClick: () => { insertCommand(name); },\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '20px',\n height: '20px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: props.inputActions === undefined ? 'not-allowed' : 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n insertIcon(12),\n );\n\n const skillRow = (skill: SkillEntry) =>\n disclosureRow(`skill:${skill.name}`, skill.enabled, skill.name, skill.description, [\n stateMeta(skill),\n insertButton(skill.name),\n blockedChip(blocked[skill.name] ?? 0),\n switchControl('skill', skill.name, skill.enabled),\n ], ROW_ROOT_CLASS);\n\n const mcpToolRow = (tool: McpServerEntry['tools'][number], serverEnabled: boolean) =>\n disclosureRow(`mcp-tool:${tool.name}`, tool.enabled, tool.label, tool.description, [\n blockedChip(blocked[tool.name] ?? 0),\n serverEnabled ? switchControl('mcp-tool', tool.name, tool.enabled) : null,\n ], MCP_TOOL_ROOT_CLASS);\n\n const serverRow = (server: McpServerEntry) => {\n const serverBlocked = server.tools.reduce((sum, tool) => sum + (blocked[tool.name] ?? 0), 0);\n const key = `mcp:${server.server}`;\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n const ariaLabel = disclosureAria(server.server, 'detail.tools', disclosure);\n // The server root owns state and the panel; only its header owns hover\n // feedback, so nested tool hover never paints the whole server.\n return h(\n Collapsible.Root,\n {\n key,\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setOpen(key, open); },\n style: { opacity: server.enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h(\n Collapsible.Trigger,\n {\n className: 'ci-server-trigger',\n disabled: disclosure.disabled,\n 'aria-label': ariaLabel,\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '18px',\n height: '18px',\n padding: 0,\n border: 'none',\n borderRadius: '4px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: disclosure.disabled ? 'default' : 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n h('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n ),\n nameText(server.server),\n metaText(server.tools.length === 1 ? t('server.tool.one') : t('server.tools', { count: server.tools.length })),\n blockedChip(serverBlocked),\n switchControl('mcp-server', server.server, server.enabled),\n ),\n h(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n h(\n 'div',\n {\n style: {\n marginTop: '2px',\n marginLeft: '4px',\n paddingLeft: '8px',\n borderLeft: `2px solid ${TOK.border}`,\n },\n },\n // One tool per row; each description is a second-level disclosure\n // using the same hover/chevron language as Skills and System tools.\n ...server.tools.map((tool) => mcpToolRow(tool, server.enabled)),\n ),\n ),\n );\n };\n\n const systemRow = (tool: ToolEntry) =>\n disclosureRow(`sys:${tool.name}`, tool.enabled, tool.label, tool.description, [\n blockedChip(blocked[tool.name] ?? 0),\n // run_code is the reserved Code Mode transport: the registry\n // refuses to restrict it, so no switch.\n tool.reserved === true ? null : switchControl('system-tool', tool.name, tool.enabled),\n ]);\n\n const emptyNote = (text: string) =>\n h('div', { key: `empty:${text}`, style: { color: TOK.textTertiary, padding: '8px 2px' } }, text);\n\n\n const notices = [\n snap.loading && payload === null\n ? h('div', { key: 'loading', 'aria-live': 'polite', style: { color: TOK.textTertiary, padding: '4px 0' } }, t('status.loading'))\n : null,\n // A transport failure must not be mistaken for an empty catalog.\n snap.error !== null\n ? h(\n 'div',\n { key: 'error', 'aria-live': 'polite', style: { color: TOK.error, padding: '4px 0' } },\n t('status.error', { error: snap.error }),\n )\n : null,\n // Partial reads are reported, so a short list is never silently wrong.\n // The host note itself stays English (diagnostic payload, keyed by the\n // raw note); the visible label around it is localized.\n payload?.degraded !== undefined\n ? h(\n 'div',\n { key: 'degraded', style: { color: TOK.warn, padding: '2px 0' } },\n ...payload.degraded.map((note) => h('div', { key: note }, t('degraded.item', { note }))),\n )\n : null,\n ];\n\n // Filtered: one flat, fully expanded result list. Otherwise: tabs.\n const body = filtering\n ? [\n view !== null && view.total === 0 ? emptyNote(t('empty.match')) : null,\n skills.length > 0 ? groupLabel(t('group.skills', { shown: skills.length, total: totals.skills }), true) : null,\n ...skills.map(skillRow),\n mcp.length > 0 ? groupLabel(t('group.mcp', { shown: mcp.length, total: totals.mcp }), skills.length === 0) : null,\n ...mcp.map(serverRow),\n systemTools.length > 0\n ? groupLabel(t('group.system', { shown: systemTools.length, total: totals.systemTools }), skills.length === 0 && mcp.length === 0)\n : null,\n ...systemTools.map(systemRow),\n ]\n : [\n h(\n Tabs.Root,\n {\n key: 'tabs',\n value: tab,\n onValueChange: (value: string) => { setTab(value); },\n style: { marginTop: '2px' },\n },\n h(\n Tabs.List,\n { 'aria-label': t('tabs.aria'), className: 'ci-tabs', style: { marginBottom: '6px' } },\n h(Tabs.Tab, { value: 'skills', className: 'ci-tab' }, `${t('tab.skills')} ${totals.skills}`),\n h(Tabs.Tab, { value: 'mcp', className: 'ci-tab' }, `${t('tab.mcp')} ${totals.mcp}`),\n h(Tabs.Tab, { value: 'system', className: 'ci-tab', 'aria-label': t('tab.system.aria', { count: totals.systemTools }) }, `${t('tab.system')} ${totals.systemTools}`),\n ),\n h(\n Tabs.Panel,\n { value: 'skills' },\n skills.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.skills'))\n : h('div', {}, ...groupBySource(skills, (s) => s.group ?? s.source).flatMap(([groupKey, items], i) => [\n sourceSectionHeader(groupKey, items[0]!.source, items.length, i === 0, items.find((item) => item.path !== undefined)?.path, items.some((item) => item.path !== undefined)),\n ...items.map(skillRow),\n ])),\n ),\n h(\n Tabs.Panel,\n { value: 'mcp' },\n mcp.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.mcp'))\n : h('div', {}, ...groupBySource(mcp, (s) => s.source === undefined || s.source === 'host' ? 'host' : `preset:${s.source}`).flatMap(([groupKey, items], i) => [\n sourceSectionHeader(groupKey, items[0]!.source ?? 'host', items.length, i === 0, items.find((item) => item.path !== undefined)?.path, true),\n ...items.map(serverRow),\n ])),\n ),\n h(\n Tabs.Panel,\n { value: 'system' },\n systemTools.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.system'))\n : h('div', {}, ...systemTools.map(systemRow)),\n ),\n ),\n ];\n\n return h(\n Popover.Root,\n { open: snap.open, onOpenChange: syncOpen },\n // The ContextMeter trigger's chrome, verbatim: 28×28, pill radius,\n // secondary label color, hover-only wash.\n h(\n Tooltip,\n { label: t('trigger.tooltip'), side: 'top', delayMs: 200, disabled: snap.open },\n h(\n Popover.Trigger,\n {\n className: 'ci-trigger',\n 'aria-label': t('trigger.tooltip'),\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '28px',\n height: '28px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textSecondary,\n cursor: 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n layersIcon(14),\n ),\n ),\n h(\n Popover.Portal,\n {},\n h(\n Popover.Positioner,\n { side: 'top', align: 'end', sideOffset: 8, collisionPadding: 8, style: { zIndex: 100 } },\n h(\n Popover.Popup,\n {\n className: 'ci-panel',\n 'aria-label': t('panel.aria'),\n style: {\n boxSizing: 'border-box',\n width: '480px',\n maxHeight: 'min(60vh, var(--available-height, 60vh))',\n overflowY: 'auto',\n padding: '10px 12px',\n background: TOK.menuBg,\n color: TOK.textSecondary,\n border: `1px solid ${TOK.menuBorder}`,\n borderRadius: '12px',\n boxShadow: TOK.menuShadow,\n fontFamily: TOK.fontFamily,\n fontSize: '12px',\n lineHeight: '20px',\n cursor: 'default',\n },\n },\n\n // Header: the filter is always one keystroke away — opening the\n // panel lands focus in this input (first focusable in the popup),\n // so no toggle stands between the user and narrowing the list.\n h(\n 'div',\n { style: { marginBottom: '6px' } },\n h(\n 'div',\n { style: { display: 'flex', alignItems: 'center', gap: '6px' } },\n h(\n 'div',\n { style: { position: 'relative', flex: '1 1 auto', display: 'flex', alignItems: 'center' } },\n h(\n 'span',\n {\n style: {\n position: 'absolute',\n left: '8px',\n color: TOK.textTertiary,\n display: 'grid',\n pointerEvents: 'none',\n },\n },\n searchIcon(12),\n ),\n h(Input, {\n className: 'ci-filter',\n value: query,\n placeholder: t('filter.placeholder'),\n 'aria-label': t('filter.aria'),\n // Not a credential field: keep password managers and the\n // spellchecker out of it.\n autoComplete: 'off',\n spellCheck: false,\n name: 'ci-filter',\n onChange: (event: { target: { value: string } }) => { setQuery(event.target.value); },\n onKeyDown: (event: { key: string; stopPropagation: () => void }) => {\n // With a query, Escape clears it and the panel stays\n // open; empty, it bubbles up and closes the panel.\n if (event.key !== 'Escape' || !filtering) return;\n event.stopPropagation();\n setQuery('');\n },\n style: {\n flex: '1 1 auto',\n minWidth: 0,\n height: '26px',\n boxSizing: 'border-box',\n padding: '0 8px 0 26px',\n border: `1px solid ${TOK.border}`,\n borderRadius: '6px',\n background: TOK.bgBase,\n color: TOK.textPrimary,\n font: 'inherit',\n outline: 'none',\n },\n }),\n ),\n filtering\n ? h(\n 'button',\n {\n type: 'button',\n onClick: () => { setQuery(''); },\n className: 'ci-iconbtn',\n 'aria-label': t('filter.clear'),\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '20px',\n height: '20px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: 'pointer',\n flex: 'none',\n font: 'inherit',\n fontSize: '14px',\n lineHeight: 1,\n },\n },\n '×',\n )\n : null,\n ),\n filtering\n ? h(\n 'div',\n {\n 'aria-live': 'polite',\n style: { marginTop: '4px', color: TOK.textTertiary, fontVariantNumeric: 'tabular-nums' },\n },\n t('filter.count', { shown: view?.total ?? 0, total: totalAll }),\n )\n : null,\n ),\n\n ...notices,\n ...body,\n ),\n ),\n ),\n );\n }),\n );\n}\n\nexport const inject = ['slots', 'locale'];\n"],"x_google_ignoreList":[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,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AqB;CACrB,uBAAuB;CACvB,qBAAqB;CACrB,sBAAsB;CACtB,gBAAgB;CAChB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,uBAAuB;CACvB,mBAAmB;CACnB,mBAAmB;CACnB,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,iBAAiB;CACjB,sBAAsB;CACtB,yBAAyB;CACzB,kBAAkB;CAClB,mBAAmB;CACnB,sBAAsB;CACtB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,iBAAiB;CACjB,qBAAqB;CACtB;;;;;;AAqBD,SAAgB,eAAe,QAAmC;CAChE,MAAM,YAAY,OAAO,SAAS,WAAW,MAAM,GAAG;CACtD,MAAM,YAAY,OAAO,SAAS,WAAW,MAAM,GAAG;AACtD,cAAa;AACX,aAAW;AACX,aAAW;;;;;;ACjKf,MAAa,MAAM;CACjB,aAAa;CACb,eAAe;CACf,cAAc;CACd,QAAQ;CAER,cAAc;CACd,UAAU;CACV,WAAW;CACX,aAAa;CACb,YAAY;CACZ,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,YACE;CACF,SAAS;CACT,MAAM;CACN,OAAO;CAGP,MAAM;CACP;AAED,MAAa,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACD,CAAC,KAAK,KAAK;;;;AC1FZ,SAAgB,cAAc,EAC5B,YACA,SAAS,aACT,MACA,QAAQ,WACP;CAED,MAAM,EACJ,SAAS,iBACPC,MAAM,OAAO,eAAe,OA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UAAyC;AAAE,aAAS,MAAM,OAAO,MAAM;;GAClF,YAAY,UAAwD;AAGlE,QAAI,MAAM,QAAQ,YAAY,CAAC,UAAW;AAC1C,UAAM,iBAAiB;AACvB,aAAS,GAAG;;GAEd,OAAO;IACL,MAAM;IACN,UAAU;IACV,QAAQ;IACR,WAAW;IACX,SAAS;IACT,QAAQ,aAAa,IAAI;IACzB,cAAc;IACd,YAAY,IAAI;IAChB,OAAO,IAAI;IACX,MAAM;IACN,SAAS;IACV;GACF,CAAC,CACH,EACD,YACI,EACE,UACA;GACE,MAAM;GACN,eAAe;AAAE,aAAS,GAAG;;GAC7B,WAAW;GACX,cAAc,EAAE,eAAe;GAC/B,OAAO;IACL,SAAS;IACT,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,OAAO,IAAI;IACX,QAAQ;IACR,MAAM;IACN,MAAM;IACN,UAAU;IACV,YAAY;IACb;GACF,EACD,IACD,GACD,KACL,EACD,YACI,EACE,OACA;GACE,aAAa;GACb,OAAO;IAAE,WAAW;IAAO,OAAO,IAAI;IAAc,oBAAoB;IAAgB;GACzF,EACD,EAAE,gBAAgB;GAAE,OAAO,MAAM,SAAS;GAAG,OAAO;GAAU,CAAC,CAChE,GACD,KACL,EAED,GAAG,SACH,GAAG,KACJ,CACF,CACF,CACF;GACD,CACH;;AAGH,MAAa,SAAS,CAAC,SAAS,SAAS"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["isRecord","tools: McpToolEntry[]","out: Record<string, number>","skills: SkillEntry[]","mcp: McpServerEntry[]","systemTools: ToolEntry[]","degraded: string[] | undefined","INITIAL_STATE: InspectorState","store","ROUTE","epoch","mutationQueue: Promise<void>","requestPayload","body: unknown","patch: Partial<InspectorState> | undefined","skills: LabeledSkill[]","zh: Record<string, string>","en: Record<string, string>","React","React","index","React","formatErrorMessage","React","result","stateAttributesMapping","React","_formatErrorMessage","React","React","getComputedStyle","React","_formatErrorMessage","React","disabled","ownerWindow","React","disabled","React","_formatErrorMessage","stateAttributesMapping","React","_formatErrorMessage","React","React","React","React","React","SwitchRoot","disabled","React","element","REASONS.none","SwitchThumb","React","Switch.Root","Switch.Thumb","EMPTY","index","React","React","REASONS.triggerPress","disabled","React","_formatErrorMessage","TransitionStatusDataAttributes","CollapsiblePanelDataAttributes","CollapsibleTriggerDataAttributes","triggerOpenStateMapping","baseMapping","CollapsibleRoot","React","stateAttributesMapping","triggerOpenStateMapping","CollapsibleTrigger","React","getDimensions","REASONS.none","ownerWindow","CollapsiblePanelCssVars","CollapsiblePanel","platform","platform.os.android","platform.env.jsdom","index","getComputedStyle","getComputedStyle","index","FieldControl","disabled","React","REASONS.none","Input","Field.Control","React","React","register","index","React","_formatErrorMessage","TabsRoot","React","REASONS.missing","REASONS.initial","REASONS.disabled","React","index","register","index","React","disabled","React","_formatErrorMessage","TabsTab","React","disabled","index","REASONS.none","React","is","objectIs","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","getSnapshot","subscribe","useSyncExternalStore$1","shim","TabsPanel","React","index","EMPTY_ARRAY","React","index","React","React","TabsList","React","React","Collapsible.Root","Collapsible.Trigger","Collapsible.Panel","tools: PresetToolRow[]","skills: PresetSkillRow[]","presets: PresetToolEntry[]","mcp: PresetMcpServer[]","INITIAL: PresetToolState","queue: Promise<void>","max","order: string[]","React","IconFolderClose16","toggle","state","groups: React.ReactElement[]","Collapsible.Root","Collapsible.Trigger","IconRefreshOutline14","Collapsible.Panel","Menu","IconChevronDownOutline14","Tabs.Root","Tabs.List","Tabs.Tab","FocusGuard","React","platform.screenReader.voiceOver","platform.engine.webkit","attr","React","FloatingPortal","REASONS.focusOut","index","React","ownerWindow","store","React","disabled","REASONS.focusOut","REASONS.triggerHover","REASONS.outsidePress","platform.engine.webkit","REASONS.triggerPress","store","React","toggle","isClickLikeOpenEvent","store","outsidePress","React","REASONS.triggerPress","escapeKey","REASONS.escapeKey","platform.engine.webkit","getComputedStyle","isRTL","REASONS.outsidePress","unsubscribe","detectOverflow","platform","computePosition","reset","flip","placements","sides","side","placement","overflow","offset","shift","limitShift","size","apply","refresh","update","offset","offset$1","shift","shift$1","flip","flip$1","size","size$1","limitShift","limitShift$1","useLayoutEffect","noop","React","platform","update","data","useSyncExternalStore","getSnapshot","subscribe","store","React","didChange","index","selectors","store","React","selectors","React","store","store","React","REASONS.none","React","store","React","usePosition","store","store","isClickLikeOpenEvent","isClickLikeOpenEventShared","close","REASONS.triggerHover","isInsideEnabledTrigger","store","React","isClickLikeOpenEvent","isClickLikeOpenEventShared","REASONS.triggerHover","isInsideEnabledTrigger","close","React","_formatErrorMessage","REASONS.triggerHover","REASONS.triggerPress","REASONS.escapeKey","REASONS.closePress","REASONS.focusOut","store","REASONS.imperativeAction","CommonPopupDataAttributes","React","REASONS.focusOut","store","React","platform.os.ios","React","PopoverTrigger","store","_formatErrorMessage","React","disabled","REASONS.triggerPress","stateAttributesMapping","React","_formatErrorMessage","PopoverPortal","React","_formatErrorMessage","platform","min","max","offset","React","shift","floatingShift","ownerWindow","x","y","renderedPlacement","middlewareData","update","InternalBackdrop","ownerWindow","platform.engine.webkit","platform.os.ios","React","PopoverPositioner","store","React","REASONS.triggerHover","React","_formatErrorMessage","React","register","PopoverPopup","store","disabled","REASONS.triggerHover","STATE_ORDER: Record<SkillLoadState, number>","react","React","IconContextInjectionOutline16","IconSearchOutline16","IconSendOutline14","IconRefreshOutline14","size","ellipsizeMiddle","max","IconFolderClose16","order: string[]","chevronIcon","IconChevronRightOutline14","disclosureRow","Collapsible.Root","Collapsible.Trigger","Collapsible.Panel","Tabs.Root","Tabs.List","Tabs.Tab","Tabs.Panel","Popover.Root","Tooltip","Popover.Trigger","Popover.Portal","Popover.Positioner","Popover.Popup"],"sources":["../src/wire.ts","../src/client/store.ts","../src/client/filter-core.ts","../src/client/filter.ts","../src/client/disclosure.ts","../src/client/locale.ts","../src/client/styles.ts","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useControlled.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useRefWithInit.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useMergedRefs.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/visuallyHidden.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/empty.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/formatErrorMessage.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/reactVersion.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/getReactElementRef.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/mergeObjects.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveClassName.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveStyle.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/merge-props/mergeProps.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useRenderElement.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/safeReact.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useId.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useBaseUiId.mjs","../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useStableCallback.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/owner.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/use-button/useButton.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-constants/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/form-context/FormContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/reason-parts.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useValueChanged.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/root/SwitchRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs","../src/client/switch.ts","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useOnMount.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useAnimationFrame.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useTransitionStatus.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/addEventListener.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useValueAsRef.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/resolveRef.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useAnimationsFinished.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/shared.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/os.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/engine.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/screen-reader.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/platform/env.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/shadowDom.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/element.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/event.mjs","../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useTimeout.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/field/control/FieldControl.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/input/Input.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/root/TabsRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/list/TabsListContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/tab/TabsTab.mjs","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/shim/index.js","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/inertValue.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/isElementDisabled.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/composite.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/tabs/list/TabsList.mjs","../src/client/disclosure-row.ts","../src/client/preset-filter.ts","../src/preset-wire.ts","../src/client/preset-store.ts","../src/client/preset-section.ts","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/mergeCleanups.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/FocusGuard.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingTreeStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs","../node_modules/.pnpm/@floating-ui+core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../node_modules/.pnpm/@floating-ui+react-dom@2.1.9_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../node_modules/.pnpm/use-sync-external-store@1.6.0_react@18.3.1/node_modules/use-sync-external-store/shim/with-selector.js","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/fastHooks.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/useStore.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/Store.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/store/ReactStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/store.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/root/PopoverRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/store/PopoverStore.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/root/PopoverRoot.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popupStateMapping.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/utils/constants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/popups/useTriggerFocusGuards.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useEnhancedClickHandler.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useOpenInteractionType.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/trigger/PopoverTrigger.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/portal/PopoverPortalContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/portal/PopoverPortal.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/positioner/PopoverPositionerContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/hideMiddleware.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/useAnchorPositioning.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/InternalBackdrop.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/usePositioner.mjs","../node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/useScrollLock.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/positioner/PopoverPositioner.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/toolbar/root/ToolbarRootContext.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/utils/closePart.mjs","../node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@18.3.31_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/popover/popup/PopoverPopup.mjs","../src/client/index.ts"],"sourcesContent":["/**\n * Runtime guards for the wire contract.\n *\n * `contract.ts` stays types-only; this module is its runtime half. The host\n * validates every service boundary read (failures land in `degraded`), so the\n * client must not bare-cast `response.json()` either — a host/client version\n * skew (client hot-reloads, host needs a restart) is exactly when shapes\n * diverge, and a rejected payload must read as an error, not as \"no skills\".\n */\nimport type { InspectorPayload, McpServerEntry, McpToolEntry, SkillEntry, ToolEntry } from './contract.js';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\nconst optString = (value: unknown): string | undefined => (typeof value === 'string' ? value : undefined);\n\nfunction parseSkillEntry(value: unknown): SkillEntry | null {\n if (!isRecord(value) || typeof value['name'] !== 'string') return null;\n const state = value['state'];\n if (state !== 'loaded' && state !== 'pruned' && state !== 'evicted' && state !== 'unloaded') return null;\n if (typeof value['enabled'] !== 'boolean' || typeof value['loadCount'] !== 'number') return null;\n if (typeof value['source'] !== 'string' || typeof value['provider'] !== 'string') return null;\n const description = optString(value['description']);\n const path = optString(value['path']);\n const group = optString(value['group']);\n return {\n name: value['name'],\n state,\n enabled: value['enabled'],\n loadCount: value['loadCount'],\n source: value['source'],\n provider: value['provider'],\n ...(description === undefined ? {} : { description }),\n ...(path === undefined ? {} : { path }),\n ...(group === undefined ? {} : { group }),\n };\n}\n\nfunction parseToolEntry(value: unknown): ToolEntry | null {\n if (!isRecord(value) || typeof value['name'] !== 'string' || typeof value['label'] !== 'string') return null;\n if (typeof value['enabled'] !== 'boolean') return null;\n const description = optString(value['description']);\n return {\n name: value['name'],\n label: value['label'],\n enabled: value['enabled'],\n ...(description === undefined ? {} : { description }),\n ...(value['reserved'] === true ? { reserved: true } : {}),\n };\n}\n\nfunction parseMcpToolEntry(value: unknown): McpToolEntry | null {\n return parseToolEntry(value);\n}\n\nfunction parseMcpServerEntry(value: unknown): McpServerEntry | null {\n if (!isRecord(value) || typeof value['server'] !== 'string' || typeof value['enabled'] !== 'boolean') return null;\n if (!Array.isArray(value['tools'])) return null;\n const tools: McpToolEntry[] = [];\n for (const tool of value['tools']) {\n const parsed = parseMcpToolEntry(tool);\n if (parsed === null) return null;\n tools.push(parsed);\n }\n const source = optString(value['source']);\n const path = optString(value['path']);\n return {\n server: value['server'],\n enabled: value['enabled'],\n tools,\n ...(source === undefined ? {} : { source }),\n ...(path === undefined ? {} : { path }),\n ...(value['unavailable'] === true ? { unavailable: true } : {}),\n ...(value['reconnectable'] === true ? { reconnectable: true } : {}),\n };\n}\n\nfunction parseBlocked(value: unknown): Record<string, number> | null {\n if (!isRecord(value)) return null;\n const out: Record<string, number> = {};\n for (const [key, count] of Object.entries(value)) {\n if (typeof count !== 'number') return null;\n out[key] = count;\n }\n return out;\n}\n\n/** Parse one wire payload; null means the shape is not ours (version skew). */\nexport function parseInspectorPayload(value: unknown): InspectorPayload | null {\n if (!isRecord(value)) return null;\n const sessionId = value['sessionId'];\n if (sessionId !== null && typeof sessionId !== 'string') return null;\n if (!Array.isArray(value['skills']) || !Array.isArray(value['mcp']) || !Array.isArray(value['systemTools'])) {\n return null;\n }\n const skills: SkillEntry[] = [];\n for (const skill of value['skills']) {\n const parsed = parseSkillEntry(skill);\n if (parsed === null) return null;\n skills.push(parsed);\n }\n const mcp: McpServerEntry[] = [];\n for (const server of value['mcp']) {\n const parsed = parseMcpServerEntry(server);\n if (parsed === null) return null;\n mcp.push(parsed);\n }\n const systemTools: ToolEntry[] = [];\n for (const tool of value['systemTools']) {\n const parsed = parseToolEntry(tool);\n if (parsed === null) return null;\n systemTools.push(parsed);\n }\n const blocked = parseBlocked(value['blocked']);\n if (blocked === null) return null;\n const degradedRaw = value['degraded'];\n let degraded: string[] | undefined;\n if (degradedRaw !== undefined) {\n if (!Array.isArray(degradedRaw) || degradedRaw.some((note) => typeof note !== 'string')) return null;\n degraded = degradedRaw as string[];\n }\n return {\n sessionId,\n skills,\n mcp,\n systemTools,\n blocked,\n ...(degraded === undefined ? {} : { degraded }),\n };\n}\n","import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';\nimport type { InspectorPayload } from '../contract.js';\nimport { parseInspectorPayload } from '../wire.js';\n\nexport interface InspectorState {\n readonly open: boolean;\n readonly loading: boolean;\n readonly payload: InspectorPayload | null;\n /** Transport-level failure, distinct from `payload.degraded` (partial reads). */\n readonly error: string | null;\n}\n\nconst INITIAL_STATE: InspectorState = { open: false, loading: false, payload: null, error: null };\nconst store = createSnapshotStore<InspectorState>(INITIAL_STATE);\n\nexport const subscribe = (listener: () => void): (() => void) => store.subscribe(listener);\n/** Reference-stable while nothing changed, as useSyncExternalStore requires. */\nexport const getSnapshot = (): InspectorState => store.getSnapshot();\n\nexport function toggle(): void {\n const snapshot = store.getSnapshot();\n store.set({ ...snapshot, open: !snapshot.open });\n}\n\nexport function close(): void {\n const snapshot = store.getSnapshot();\n if (snapshot.open) store.set({ ...snapshot, open: false });\n}\n\n/**\n * Surface an action failure (e.g. a rejected reload) in the panel's existing\n * error slot, without clobbering the payload or loading state.\n */\nexport function reportActionError(message: string): void {\n store.set({ ...store.getSnapshot(), error: message });\n}\n\nconst ROUTE = '/api/capability-panel';\n\n/**\n * Reads and writes have different ordering domains. A newer refresh supersedes\n * an older refresh, but it cannot invalidate a user's mutation response.\n * `mutationVersion` changes at both ends of a write, so a GET overlapping a\n * mutation cannot commit a possibly pre-write snapshot. `epoch` invalidates\n * every answer from a dead connection.\n */\nlet epoch = 0;\nlet refreshSeq = 0;\nlet mutationVersion = 0;\nlet activeRequests = 0;\nlet mutationQueue: Promise<void> = Promise.resolve();\n\nfunction beginRequest(): number {\n activeRequests += 1;\n const snapshot = store.getSnapshot();\n store.set({ ...snapshot, loading: true, error: null });\n return epoch;\n}\n\nfunction finishRequest(requestEpoch: number, patch?: Partial<InspectorState>): void {\n if (requestEpoch !== epoch) return;\n activeRequests -= 1;\n if (patch === undefined && activeRequests > 0) return;\n store.set({ ...store.getSnapshot(), ...patch, loading: activeRequests > 0 });\n}\n\nasync function requestPayload(sessionId: string | null, init?: RequestInit): Promise<InspectorPayload> {\n const query = sessionId === null ? '' : `?session=${encodeURIComponent(sessionId)}`;\n const response = await fetch(`${ROUTE}${query}`, { credentials: 'same-origin', ...init });\n if (!response.ok) {\n let detail = '';\n try {\n const body: unknown = await response.json();\n if (body !== null && typeof body === 'object' && typeof (body as { error?: unknown }).error === 'string') {\n detail = `: ${(body as { error: string }).error}`;\n }\n } catch {\n // A non-JSON error still has a useful HTTP status.\n }\n throw new Error(`HTTP ${response.status}${detail}`);\n }\n const payload = parseInspectorPayload(await response.json());\n if (payload === null) throw new Error('unexpected payload shape (host/client version skew?)');\n return payload;\n}\n\nexport async function refresh(sessionId: string | null): Promise<void> {\n const requestEpoch = beginRequest();\n const mine = ++refreshSeq;\n const mutationAtStart = mutationVersion;\n let patch: Partial<InspectorState> | undefined;\n try {\n const payload = await requestPayload(sessionId);\n if (requestEpoch === epoch && mine === refreshSeq && mutationAtStart === mutationVersion) {\n patch = { payload, error: null };\n }\n } catch (error) {\n if (requestEpoch === epoch && mine === refreshSeq && mutationAtStart === mutationVersion) {\n // Keep the last good payload visible: stale data plus an explicit error is\n // safer than an empty panel that falsely reads as \"no capabilities\".\n patch = { error: error instanceof Error ? error.message : String(error) };\n }\n } finally {\n finishRequest(requestEpoch, patch);\n }\n}\n\nexport function setCapability(\n sessionId: string,\n kind: 'skill' | 'mcp-server' | 'mcp-tool' | 'system-tool',\n name: string,\n enabled: boolean,\n): Promise<void> {\n const requestEpoch = beginRequest();\n mutationVersion += 1;\n const run = async (): Promise<void> => {\n let patch: Partial<InspectorState> | undefined;\n try {\n const payload = await requestPayload(sessionId, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ kind, name, enabled }),\n });\n if (requestEpoch === epoch) patch = { payload, error: null };\n } catch (error) {\n if (requestEpoch === epoch) patch = { error: error instanceof Error ? error.message : String(error) };\n } finally {\n if (requestEpoch === epoch) mutationVersion += 1;\n finishRequest(requestEpoch, patch);\n }\n };\n // The queue tail is normalized below, so it is always fulfilled here.\n const result = mutationQueue.then(run);\n // run absorbs transport failures into the store, so the queue stays fulfilled.\n mutationQueue = result;\n return result;\n}\n\nexport function reset(): void {\n epoch += 1;\n refreshSeq += 1;\n mutationVersion += 1;\n activeRequests = 0;\n mutationQueue = Promise.resolve();\n store.set(INITIAL_STATE);\n}\n","/**\n * Panel text filter as a pure function over a capability set, so the matching\n * rules are unit-testable without a DOM and each component stays a projection.\n *\n * Matching rules (case-insensitive substring, query trimmed):\n * - skill: name, description, or `stateLabel` (the localized load-state pill\n * text the row shows — searching the visible \"已截断/truncated\" finds the\n * skills wearing it);\n * - MCP server: server name keeps ALL of its tools (the match is the server's\n * identity); otherwise only the matching tools survive and a server with no\n * surviving tools drops out;\n * - system tool: label, full name, or description.\n *\n * Both panels share this one implementation rather than a copy each. They are\n * required to behave identically under the same query -- two scopes of one\n * feature -- and a copy maintained by hand is how that requirement quietly\n * stops being true.\n *\n * Each caller keeps its own payload types: the generics below name only the\n * fields matching reads, so a skill carrying `state` and one carrying\n * `project` both satisfy them and neither shape leaks into the other panel.\n */\n\n/** The fields a skill row is matched on. */\nexport interface MatchableSkill {\n readonly name: string;\n readonly description?: string;\n /**\n * Localized state pill text, supplied by the caller that owns the locale.\n * Optional so the settings panel (whose rows have no state) stays valid.\n */\n readonly stateLabel?: string;\n /** Localized source label, for matching the origin chip text. */\n readonly sourceLabel?: string;\n}\n\n/** The fields a tool row is matched on, for system tools and MCP tools alike. */\nexport interface MatchableTool {\n readonly name: string;\n readonly label: string;\n readonly description?: string;\n}\n\n/** An MCP server and the tools nested under it. */\nexport interface MatchableServer<Tool extends MatchableTool> {\n readonly server: string;\n readonly tools: readonly Tool[];\n /** Server source label, for matching the origin chip text. */\n readonly source?: string;\n}\n\nexport interface Capabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n> {\n readonly skills: readonly Skill[];\n readonly mcp: readonly Server[];\n readonly systemTools: readonly Tool[];\n}\n\nexport interface FilteredCapabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n> {\n readonly skills: readonly Skill[];\n readonly mcp: readonly Server[];\n readonly systemTools: readonly Tool[];\n /** Visible top-level rows (skill + server + system tool), for the summary. */\n readonly total: number;\n}\n\nconst hit = (query: string, fields: readonly (string | undefined)[]): boolean =>\n fields.some((field) => field !== undefined && field.toLowerCase().includes(query));\n\nexport function filterCapabilities<\n Skill extends MatchableSkill,\n Tool extends MatchableTool,\n Server extends MatchableServer<Tool>,\n>(source: Capabilities<Skill, Tool, Server>, rawQuery: string): FilteredCapabilities<Skill, Tool, Server> {\n const query = rawQuery.trim().toLowerCase();\n if (query === '') {\n return {\n skills: source.skills,\n mcp: source.mcp,\n systemTools: source.systemTools,\n total: source.skills.length + source.mcp.length + source.systemTools.length,\n };\n }\n const skills = source.skills.filter((skill) => hit(query, [skill.name, skill.description, skill.stateLabel, skill.sourceLabel]));\n const mcp = source.mcp.flatMap((server) => {\n if (hit(query, [server.server, server.source])) return [server];\n const tools = server.tools.filter((tool) => hit(query, [tool.label, tool.name, tool.description]));\n return tools.length > 0 ? [{ ...server, tools }] : [];\n });\n const systemTools = source.systemTools.filter((tool) =>\n hit(query, [tool.label, tool.name, tool.description]),\n );\n return { skills, mcp, systemTools, total: skills.length + mcp.length + systemTools.length };\n}\n","/**\n * The composer panel's text filter. The rules live in `filter-core.ts` and are\n * shared with the settings panel; this module fixes them to the session wire\n * types and adds the one field only this panel has: the localized load-state\n * pill, so a query can match what the row visibly says (已截断/truncated).\n */\nimport { filterCapabilities } from './filter-core.js';\nimport type { FilteredCapabilities } from './filter-core.js';\nimport type { InspectorPayload, McpServerEntry, SkillEntry, ToolEntry } from '../contract.js';\n\ntype LabeledSkill = SkillEntry & { readonly stateLabel?: string; readonly sourceLabel?: string };\n\nexport type FilteredPayload = FilteredCapabilities<LabeledSkill, ToolEntry, McpServerEntry>;\n\nexport function filterPayload(\n payload: InspectorPayload,\n rawQuery: string,\n // Default matches the raw state key, so 'pruned' finds pruned rows even\n // before a locale is wired in.\n stateLabel: (skill: SkillEntry) => string = (skill) => skill.state,\n sourceLabel: (skill: SkillEntry) => string = (skill) => skill.source,\n): FilteredPayload {\n // Blank query returns the payload's own rows untouched — the panel's\n // rendering relies on that reference identity to skip work.\n if (rawQuery.trim() === '') return filterCapabilities(payload, rawQuery);\n const skills: LabeledSkill[] = payload.skills.map((skill) => ({ ...skill, stateLabel: stateLabel(skill), sourceLabel: sourceLabel(skill) }));\n return filterCapabilities({ ...payload, skills }, rawQuery);\n}\n","export interface DisclosureState {\n readonly open: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Resolve one controlled disclosure's visible and interactive state.\n * Filtering deliberately preserves the user's stored preference while forcing\n * matching detail open; the disabled trigger prevents a no-feedback toggle.\n * Labels are the caller's job — they go through the locale translate function.\n */\nexport function resolveDisclosure(expanded: boolean, filtering: boolean): DisclosureState {\n if (filtering) {\n return { open: true, disabled: true };\n }\n return { open: expanded, disabled: false };\n}\n\n/** Shared geometry and hover classes used by every capability header. */\nexport const ROW_ROOT_CLASS = '';\nexport const MCP_TOOL_ROOT_CLASS = 'ci-toolrow';\nexport const ROW_HEADER_CLASS = 'ci-row-head';\n","/**\n * Panel copy, bilingual. Chinese is the authoring language; English is the\n * fallback the host's locale runtime consults after the active locale misses\n * a key (and the locale a browser naming neither shipped language lands on).\n *\n * The dictionaries register into the host's locale service (`ctx.locale`)\n * under this plugin's own namespace, so the panel follows the same language\n * switch as the rest of the UI. Templates interpolate `{name}` placeholders.\n *\n * tests/client/locale.spec.ts pins the two dictionaries to identical key sets\n * and checks every key the component looks up exists in both.\n */\n\nexport const LOCALE_NS = 'capability-panel';\n\nexport const zh: Record<string, string> = {\n 'state.loaded': '已加载',\n 'state.pruned': '已截断',\n 'state.evicted': '已挤出',\n 'state.unloaded': '未加载',\n 'blocked.count': '拦截 ×{count}',\n 'action.enable': '开启 {name}',\n 'action.disable': '关闭 {name}',\n 'action.insert': '把 /{name} 填入输入框',\n 'server.tools': '{count} 工具',\n 'server.tool.one': '1 个工具',\n // Honest wording only: the panel can prove \"declared\" and \"no tools\n // registered right now\". It cannot observe connection state (dsh's MCP\n // client keeps that in a closure), so it must not claim \"offline\",\n // \"connecting\", or a failure reason. A dropped-but-retrying server also\n // keeps its tools listed, so even tool-presence is not a liveness proof.\n 'server.unavailable': '无已注册工具',\n 'server.unavailableHint': '宿主配置里声明了这个服务器,但它当前没有注册任何工具。原因无法从面板判定(服务未启动、正在重连、或本就没有工具都可能)。若它是个本地按需服务,先把程序开起来。',\n 'action.reload': '重载 {name}',\n 'action.reload.label': '重载',\n 'action.reload.ing': '正在重载 {name}…',\n 'action.reloadHint': '重新加载该服务器的插件实例(等同一次热重载):会断开并重连。对 stdio 类型的服务,这会重启其子进程。',\n 'action.reload.failed': '重载 {name} 失败:{error}',\n 'status.loading': '读取中…',\n 'status.error': '读取失败:{error}(可尝试刷新页面;宿主改动需重启 dsh 后生效)',\n 'empty.match': '无匹配项',\n 'empty.skills': '无可用技能',\n 'empty.mcp': '无 MCP 服务器',\n 'empty.system': '无系统工具',\n 'group.skills': '技能 ({shown}/{total})',\n 'group.mcp': 'MCP ({shown}/{total})',\n 'group.system': '系统工具 ({shown}/{total})',\n 'tab.all': '全部',\n 'tab.skills': '技能',\n 'tab.mcp': 'MCP',\n 'tab.system': '工具',\n 'tab.system.aria': '系统工具 {count}',\n 'tabs.aria': '能力分区',\n 'trigger.tooltip': '会话上下文:技能、MCP 与工具',\n 'panel.aria': '会话上下文',\n 'filter.placeholder': '筛选名称或描述…',\n 'filter.aria': '筛选技能与工具',\n 'filter.clear': '清空筛选',\n 'filter.count': '匹配 {shown} / {total} 项',\n 'footer.feedback': '反馈问题',\n 'footer.feedbackHint': '在 GitHub 上打开能力面板的 issue 页',\n 'disclosure.expand': '展开 {subject} 的{detail}',\n 'disclosure.collapse': '收起 {subject} 的{detail}',\n 'disclosure.pinned': '{subject} 的{detail}(筛选时保持展开)',\n 'detail.description': '描述',\n 'detail.tools': '工具',\n 'preset.nav': '能力面板',\n 'preset.title': '能力面板',\n 'preset.intro': '设置每个 Agent preset 的默认能力集合,之后新建或恢复的会话会继承它。输入框里的「会话上下文」只改当前会话,并随该会话在重启后恢复。',\n 'preset.projectSkill': '当前项目',\n 'preset.kindAria': '按类别筛选',\n 'preset.readonly': '当前设置存储不可写;你可以查看工具,但无法保存微调。',\n 'preset.choose': 'Agent preset',\n 'preset.empty': '没有可用的 Agent preset。',\n 'preset.noTools': '这个 preset 没有可用能力。',\n 'preset.reserved': '{name} 是保留的传输通道,不能关闭。',\n 'preset.broken': '这个 preset 无法组装会话:{reason}。修好它之后才能列出工具。',\n 'degraded.item': '⚠ 部分读取失败:{note}',\n 'source.project-dsh': '项目 .dsh',\n 'source.project-agents': '项目 agent',\n 'source.runtime': '运行时',\n 'source.user-dsh': '用户 .dsh',\n 'source.user-agents': '用户 agent',\n 'source.custom': '自定义',\n 'source.bundled': '内置',\n 'source.host': '全局',\n 'source.preset': '预设',\n 'source.openFolder': '在文件管理器中打开 {source}',\n};\n\nexport const en: Record<string, string> = {\n 'state.loaded': 'loaded',\n 'state.pruned': 'truncated',\n 'state.evicted': 'evicted',\n 'state.unloaded': 'not loaded',\n 'blocked.count': 'blocked ×{count}',\n 'action.enable': 'Enable {name}',\n 'action.disable': 'Disable {name}',\n 'action.insert': 'Insert /{name} into the composer',\n 'server.tools': '{count} tools',\n 'server.tool.one': '1 tool',\n // Honest wording only: the panel can prove \"declared\" and \"no tools\n // registered right now\". It cannot observe connection state (dsh's MCP\n // client keeps that in a closure), so it must not claim \"offline\",\n // \"connecting\", or a failure reason. A dropped-but-retrying server also\n // keeps its tools listed, so even tool-presence is not a liveness proof.\n 'server.unavailable': 'no tools registered',\n 'server.unavailableHint': 'This host declares the server, but it currently registers no tools. The panel cannot tell why (service not started, mid-reconnect, or genuinely tool-less are all possible). If it is a local on-demand service, start its program first.',\n 'action.reload': 'Reload {name}',\n 'action.reload.label': 'Reload',\n 'action.reload.ing': 'Reloading {name}…',\n 'action.reloadHint': 'Reload this server’s plugin instance (equivalent to one hot reload): it disconnects and reconnects. For a stdio service this restarts its child process.',\n 'action.reload.failed': 'Failed to reload {name}: {error}',\n 'status.loading': 'Loading…',\n 'status.error': 'Failed to load: {error} (try refreshing the page; host changes take effect after a dsh restart)',\n 'empty.match': 'No matches',\n 'empty.skills': 'No skills available',\n 'empty.mcp': 'No MCP servers',\n 'empty.system': 'No system tools',\n 'group.skills': 'Skills ({shown}/{total})',\n 'group.mcp': 'MCP ({shown}/{total})',\n 'group.system': 'System tools ({shown}/{total})',\n 'tab.all': 'All',\n 'tab.skills': 'Skills',\n 'tab.mcp': 'MCP',\n 'tab.system': 'Tools',\n 'tab.system.aria': 'System tools, {count}',\n 'tabs.aria': 'Capability sections',\n 'trigger.tooltip': 'Session context: skills, MCP & tools',\n 'panel.aria': 'Session context',\n 'filter.placeholder': 'Filter by name or description…',\n 'filter.aria': 'Filter skills and tools',\n 'filter.clear': 'Clear filter',\n 'filter.count': '{shown} / {total} matched',\n 'footer.feedback': 'Report an issue',\n 'footer.feedbackHint': 'Open the capability panel’s issues on GitHub',\n 'disclosure.expand': 'Expand {detail} for {subject}',\n 'disclosure.collapse': 'Collapse {detail} for {subject}',\n 'disclosure.pinned': '{detail} for {subject} (kept open while filtering)',\n 'detail.description': 'description',\n 'detail.tools': 'tools',\n 'preset.nav': 'Capability Panel',\n 'preset.title': 'Capability Panel',\n 'preset.intro': 'Choose the default capabilities each agent preset starts from; sessions created or resumed afterward inherit it. The composer\\'s Session context changes only the current session, and stays with it across restarts.',\n 'preset.projectSkill': 'this project',\n 'preset.kindAria': 'Filter by category',\n 'preset.readonly': 'Settings storage is read-only. You can inspect tools, but changes cannot be saved.',\n 'preset.choose': 'Agent preset',\n 'preset.empty': 'No agent presets are available.',\n 'preset.noTools': 'This preset exposes no capabilities.',\n 'preset.reserved': '{name} is a reserved transport and cannot be disabled.',\n 'preset.broken': 'This preset cannot compose a session: {reason}. Fix it before its tools can be listed.',\n 'degraded.item': '⚠ Partial read failed: {note}',\n 'source.project-dsh': 'project .dsh',\n 'source.project-agents': 'project agent',\n 'source.runtime': 'runtime',\n 'source.user-dsh': 'user .dsh',\n 'source.user-agents': 'user agent',\n 'source.custom': 'custom',\n 'source.bundled': 'bundled',\n 'source.host': 'global',\n 'source.preset': 'preset',\n 'source.openFolder': 'Open {source} in file manager',\n};\n\n/**\n * The slice of the host locale service this plugin uses. The full runtime\n * (dsh-client-locale) resolves the active locale per read and falls back to\n * `en` on a missing key, so a translate function is all the panel needs.\n */\nexport interface LocaleService {\n register(ns: string, locale: string, dict: Record<string, string>): () => void;\n bind(ns: string): (key: string, params?: Record<string, unknown>) => string;\n subscribe(fn: () => void): () => void;\n getSnapshot(): { readonly active: string; readonly revision: number };\n}\n\nexport type Translate = (key: string, params?: Record<string, unknown>) => string;\n\n/**\n * Register both dictionaries as one effect: the single-locale form is the\n * documented entry for namespaces outside the host's compile-time merge\n * table, and the returned disposers release both on unload.\n */\nexport function registerLocale(locale: LocaleService): () => void {\n const disposeZh = locale.register(LOCALE_NS, 'zh', zh);\n const disposeEn = locale.register(LOCALE_NS, 'en', en);\n return () => {\n disposeZh();\n disposeEn();\n };\n}\n","export const TOK = {\n textPrimary: 'var(--dsw-alias-label-primary, #0f1115)',\n textSecondary: 'var(--dsw-alias-label-secondary, #61666b)',\n textTertiary: 'var(--dsw-alias-label-tertiary, #81858c)',\n border: 'var(--dsw-alias-border-l1, rgba(0,0,0,.04))',\n /** Hairline rules that must stay visible (the host menu footer divider's token). */\n borderStrong: 'var(--dsw-alias-border-l2, rgba(0,0,0,.1))',\n switchOn: 'var(--dsw-alias-state-business-primary, #4176e6)',\n switchOff: 'var(--dsw-alias-border-l2, rgba(0,0,0,.1))',\n switchThumb: 'var(--dsw-alias-bg-layer-1, #ffffff)',\n switchEase: 'var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1))',\n menuBg: 'var(--dsw-specific-menu, #ffffff)',\n menuBorder: 'var(--dsw-alias-border-inverted, rgba(0,0,0,.1))',\n menuShadow: 'var(--dsw-shadow-lv3, 0 12px 32px rgba(0,0,0,.22))',\n bgBase: 'var(--dsw-alias-bg-base, #ffffff)',\n fontFamily:\n 'var(--dsw-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", \"Helvetica Neue\", Helvetica, Arial, sans-serif)',\n success: 'var(--dsw-alias-state-success-primary, #22c55e)',\n warn: 'var(--dsw-alias-state-warn-primary, #f59e0b)',\n error: 'var(--dsw-alias-state-error-primary, #ec1313)',\n /** Informational accent (e.g. a pruned-but-visible skill), decoupled from\n * the Switch track token so restyling one does not recolor the other. */\n info: 'var(--dsw-alias-state-business-primary, #4176e6)',\n} as const;\n\nexport const PANEL_CSS = [\n '.ci-trigger:focus-visible,.ci-switch:focus-visible,.ci-iconbtn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:999px}',\n '.ci-disclosure-trigger:focus-visible,.ci-server-trigger:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:4px}',\n '.ci-tab:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px;border-radius:6px}',\n '.ci-trigger:hover,.ci-iconbtn:hover,.ci-server-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06))}',\n '.ci-switch:hover:not(:disabled){filter:brightness(1.12)}',\n '.ci-row-head{display:flex;align-items:center;gap:8px;padding:6px 8px;margin:0 -8px;border-radius:8px}',\n '.ci-row-head:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06))}',\n '.ci-row-head .ci-send{opacity:0;transition:opacity .12s}',\n '.ci-row-head:hover .ci-send,.ci-row-head:focus-within .ci-send{opacity:1}',\n '.ci-filter:focus{border-color:var(--dsw-alias-state-business-primary,#4176e6)}',\n '.ci-filter:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:0}',\n '.ci-filter::placeholder{color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-panel{transform-origin:var(--transform-origin);transition:opacity .14s var(--ds-ease-in-out,ease),transform .14s var(--ds-ease-in-out,ease)}',\n '.ci-panel[data-starting-style],.ci-panel[data-ending-style]{opacity:0;transform:scale(.96) translateY(4px)}',\n '.ci-collapse{height:var(--collapsible-panel-height);transition:height .14s var(--ds-ease-in-out,ease);overflow:hidden}',\n '.ci-collapse[data-starting-style],.ci-collapse[data-ending-style]{height:0}',\n '.ci-toolrow{content-visibility:auto;contain-intrinsic-size:auto 30px}',\n '.ci-disclosure-trigger{min-width:0;display:flex;align-items:center;gap:6px;flex:1 1 auto;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}',\n '.ci-disclosure-trigger:disabled,.ci-server-trigger:disabled{cursor:default}',\n '.ci-disclosure-trigger:hover .ci-name{color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-description{padding:3px 0 0 24px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858c);word-break:break-word}',\n '.ci-chevron{display:grid;place-items:center;width:18px;height:18px;flex:none;color:var(--dsw-alias-label-tertiary,#81858c);border-radius:4px}',\n '.ci-chevron svg{transition:transform .12s var(--ds-ease-in-out,ease)}',\n '.ci-server-trigger[aria-expanded=\"true\"] .ci-chevron svg,.ci-disclosure-trigger[aria-expanded=\"true\"] .ci-chevron svg{transform:rotate(90deg)}',\n '.ci-tabs{display:flex;gap:2px;padding:2px;border-radius:8px;background:var(--dsw-alias-bg-base,#ffffff);border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.04))}',\n '.ci-tab{flex:1;height:24px;border:none;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#61666b);font:inherit;font-size:12px;line-height:1;cursor:pointer;font-variant-numeric:tabular-nums;padding:0 4px}',\n '.ci-tab:hover{color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-tab[data-active]{background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#0f1115);box-shadow:0 1px 2px rgba(0,0,0,.08)}',\n '.ci-preset-section{max-width:720px;color:var(--dsw-alias-label-secondary,#61666b)}',\n '.ci-settings-title{margin:0 0 6px;color:var(--dsw-alias-label-primary,#0f1115);font-size:18px;line-height:26px}',\n '.ci-settings-intro,.ci-settings-description,.ci-settings-note{margin:0 0 16px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-settings-note{padding:10px 12px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));border-radius:8px}',\n '.ci-preset-toolbar{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin:10px 0}',\n '.ci-preset-filter{flex:1 1 220px;min-width:180px;height:34px;box-sizing:border-box;padding:0 10px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.1));border-radius:8px;background-color:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#0f1115);font:inherit;font-weight:400}',\n '.ci-preset-part{margin:18px 0 0}',\n '.ci-preset-part:first-of-type{margin-top:10px}',\n // Section titles read as real headings (primary, 14px semibold) so they\n // stand clearly above the subtle ruled source dividers beneath them.\n '.ci-preset-part-title{margin:0;font-size:14px;font-weight:600;line-height:22px;color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-preset-badge{display:inline-block;margin-left:6px;padding:1px 6px;line-height:1.5;border-radius:999px;font-size:11px;font-weight:500;vertical-align:middle;background-color:var(--dsw-alias-bg-fill-2,rgba(0,0,0,.05));color:var(--dsw-alias-label-tertiary,#81858c)}',\n '.ci-preset-group{padding:0}',\n '.ci-preset-server-trigger{display:flex;align-items:center;gap:8px;flex:1;min-width:0;background:none;border:none;padding:0;text-align:left;font:inherit;color:inherit;cursor:pointer}',\n '.ci-preset-server-trigger:disabled{cursor:default}',\n '.ci-preset-group .ci-preset-tool-list{margin:0;padding-left:26px}',\n '.ci-preset-picker-label{display:grid;gap:6px;color:var(--dsw-alias-label-primary,#0f1115);font-weight:600}',\n // The preset picker's trigger follows the host model selector exactly: a\n // borderless pill, secondary label, soft hover fill, ring on keyboard focus.\n '.ci-preset-picker-trigger{height:28px;display:flex;align-items:center;gap:4px;padding:0 4px 0 8px;border:none;border-radius:24px;background:transparent;color:var(--dsw-alias-label-secondary,#61666b);font-size:13px;font-weight:500;line-height:20px;cursor:pointer;outline:none;max-width:280px}',\n '.ci-preset-picker-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06))}',\n '.ci-preset-picker-trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3,rgba(0,0,0,.16))}',\n '.ci-preset-picker-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}',\n '.ci-preset-picker-chevron{color:var(--dsw-alias-label-caption,#81858c);flex:none;display:inline-grid;place-items:center;transition:transform .12s}',\n '.ci-preset-picker-chevron-open{transform:rotate(180deg)}',\n '.ci-settings-subtitle{margin:0 0 6px;color:var(--dsw-alias-label-primary,#0f1115);font-size:14px;line-height:22px}',\n // Settings rows speak the composer panel's row language: compact padding,\n // a rounded hover background (`.ci-row-head` supplies both), and NO\n // hairline per row — groups separate through the source dividers alone.\n '.ci-preset-tool-list{list-style:none;margin:0;padding:0}',\n '.ci-preset-tool-row{display:flex;align-items:center;gap:16px}',\n '.ci-preset-tool-copy{display:grid;min-width:0;flex:1}',\n '.ci-preset-tool-name{color:var(--dsw-alias-label-primary,#0f1115);font-weight:600;overflow-wrap:anywhere}',\n '.ci-preset-tool-description{color:var(--dsw-alias-label-tertiary,#81858c);line-height:18px;overflow-wrap:anywhere}',\n '.ci-preset-item{list-style:none}',\n '.ci-preset-disclosure{display:block}',\n // Matches the chevron column so a row without a description still lines up\n // with the rows that have one.\n '.ci-preset-spacer{width:18px;flex:none}',\n '.ci-preset-detail{padding:0 0 10px 24px;color:var(--dsw-alias-label-tertiary,#81858c);line-height:18px;overflow-wrap:anywhere}',\n '.ci-preset-kinds{margin:0 0 4px}',\n '.ci-preset-kinds .ci-tabs{display:inline-flex}',\n '.ci-preset-kinds .ci-tab{flex:0 0 auto;padding:0 12px}',\n // Folder icon on source section headers: invisible until hover.\n '.ci-source-header:hover .ci-folder-icon{opacity:1 !important}',\n // The reconnect affordance for a declared-but-offline MCP server: a\n // persistent bordered control (never hover-only), with a spinning glyph\n // while the restart is in flight so the click visibly \"does something\".\n '.ci-reconnect{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--dsw-alias-border-l2,rgba(0,0,0,.14));background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-secondary,#61666b);border-radius:8px;padding:3px 9px;font-size:12px;line-height:1.4;cursor:pointer;font-family:inherit;flex:none}',\n '.ci-reconnect:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06));color:var(--dsw-alias-label-primary,#0f1115)}',\n '.ci-reconnect:disabled{opacity:.7;cursor:default}',\n '.ci-reconnect:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:1px}',\n '.ci-reconnect-glyph{display:inline-grid;place-items:center;width:12px;height:12px}',\n '.ci-reconnect-busy .ci-reconnect-glyph{animation:ci-reconnect-spin .8s linear infinite}',\n '@keyframes ci-reconnect-spin{to{transform:rotate(360deg)}}',\n '@media (prefers-reduced-motion: reduce){.ci-reconnect-busy .ci-reconnect-glyph{animation:none}}',\n // Source divider rows inside a settings list: labels, not data rows.\n '.ci-source-divider{list-style:none}',\n // Panel foot feedback link: quiet tertiary text, primary on hover/focus.\n '.ci-feedback-link{display:inline-flex;align-items:center;gap:4px;color:var(--dsw-alias-label-tertiary,#8a8f98);font-size:12px;line-height:18px;text-decoration:none;cursor:pointer}',\n '.ci-feedback-link:hover{color:var(--dsw-alias-label-primary,#0f1115);text-decoration:underline}',\n '.ci-feedback-link:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:2px;border-radius:3px}',\n '.ci-feedback-icon{display:inline-grid;place-items:center;flex:none}',\n '@media (prefers-reduced-motion: reduce){.ci-thumb,.ci-panel,.ci-collapse,.ci-chevron svg{transition:none !important}}',\n].join('\\n');\n","'use client';\n\n// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes, dependency arrays are intentionally ignored\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { error } from \"./error.mjs\";\nexport function useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = React.useRef(controlled !== undefined);\n const [valueState, setValue] = React.useState(defaultProp);\n const value = isControlled ? controlled : valueState;\n if (process.env.NODE_ENV !== 'production') {\n React.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n error([`A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = React.useRef(defaultProp);\n React.useEffect(() => {\n if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {\n error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [defaultProp]);\n }\n const setValueIfUncontrolled = React.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\nfunction serializeToDevModeString(input) {\n let nextId = 0;\n const seen = new WeakMap();\n try {\n const result = JSON.stringify(input, function replacer(key, value) {\n if (key === '_owner' && this != null && typeof this === 'object' && '$$typeof' in this) {\n return undefined;\n }\n if (typeof value === 'bigint') {\n return `__bigint__:${value}`;\n }\n if (value !== null && typeof value === 'object') {\n const id = seen.get(value);\n if (id !== undefined) {\n return `__object__:${id}`;\n }\n seen.set(value, nextId);\n nextId += 1;\n }\n return value;\n });\n return result ?? `__top__:${typeof input}`;\n } catch {\n return '__unserializable__';\n }\n}","'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}","import { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n // Legacy ref with no attach-time cleanup: detach by calling it with `null`.\n // It returns nothing; React 19 cleanups are handled in the branch above.\n void ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nconst noop = () => {};\nexport const useIsoLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : noop;","const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};","export function NOOP() {}\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});","/**\n * Creates a formatErrorMessage function with a custom URL and prefix.\n * @param baseUrl - The base URL for the error page (e.g., 'https://base-ui.com/production-error')\n * @param prefix - The prefix for the error message (e.g., 'Base UI')\n * @returns A function that formats error messages with the given URL and prefix\n */\nexport function createFormatErrorMessage(baseUrl, prefix) {\n return function formatErrorMessage(code, ...args) {\n const url = new URL(baseUrl);\n url.searchParams.set('code', code.toString());\n args.forEach(arg => url.searchParams.append('args[]', arg));\n return `${prefix} error #${code}; visit ${url} for the full message.`;\n };\n}\n\n/**\n * WARNING: Don't import this directly. It's imported by the code generated by\n * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`\n * constructors to ensure the plugin works as expected. Supported patterns include:\n * throw new Error('My message');\n * throw new Error(`My message: ${foo}`);\n * throw new Error(`My message: ${foo}` + 'another string');\n * ...\n */\nconst formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');\nexport default formatErrorMessage;","import * as React from 'react';\nconst majorVersion = parseInt(React.version, 10);\nexport function isReactVersionAtLeast(reactVersionToCheck) {\n return majorVersion >= reactVersionToCheck;\n}","import * as React from 'react';\nimport { isReactVersionAtLeast } from \"./reactVersion.mjs\";\n\n/**\n * Extracts the `ref` from a React element, handling different React versions.\n */\nexport function getReactElementRef(element) {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n return null;\n }\n const reactElement = element;\n const propsWithRef = reactElement.props;\n return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;\n}","export function mergeObjects(a, b) {\n if (a && !b) {\n return a;\n }\n if (!a && b) {\n return b;\n }\n if (a || b) {\n return {\n ...a,\n ...b\n };\n }\n return undefined;\n}","export function getStateAttributesProps(state, customMapping) {\n const props = {};\n\n /* eslint-disable-next-line guard-for-in */\n for (const key in state) {\n const value = state[key];\n if (customMapping?.hasOwnProperty(key)) {\n const customProps = customMapping[key](value);\n if (customProps != null) {\n Object.assign(props, customProps);\n }\n continue;\n }\n if (value === true) {\n props[`data-${key.toLowerCase()}`] = '';\n } else if (value) {\n props[`data-${key.toLowerCase()}`] = value.toString();\n }\n }\n return props;\n}","/**\n * If the provided className is a string, it will be returned as is.\n * Otherwise, the function will call the className function with the state as the first argument.\n *\n * @param className\n * @param state\n */\nexport function resolveClassName(className, state) {\n return typeof className === 'function' ? className(state) : className;\n}","/**\n * If the provided style is an object, it will be returned as is.\n * Otherwise, the function will call the style function with the state as the first argument.\n *\n * @param style\n * @param state\n */\nexport function resolveStyle(style, state) {\n return typeof style === 'function' ? style(state) : style;\n}","import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useMergedRefs, useMergedRefsN } from '@base-ui/utils/useMergedRefs';\nimport { getReactElementRef } from '@base-ui/utils/getReactElementRef';\nimport { mergeObjects } from '@base-ui/utils/mergeObjects';\nimport { warn } from '@base-ui/utils/warn';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getStateAttributesProps } from \"./getStateAttributesProps.mjs\";\nimport { resolveClassName } from \"../utils/resolveClassName.mjs\";\nimport { resolveStyle } from \"../utils/resolveStyle.mjs\";\nimport { mergeProps, mergePropsN, mergeClassNames } from \"../merge-props/index.mjs\";\nimport { createElement as _createElement } from \"react\";\n/**\n * Renders a Base UI element.\n *\n * @param element The default HTML element to render. Can be overridden by the `render` prop.\n * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored.\n * @param params Additional parameters for rendering the element.\n */\nexport function useRenderElement(element, componentProps, params = {}) {\n const renderProp = componentProps.render;\n const outProps = useRenderElementProps(componentProps, params);\n if (params.enabled === false) {\n return null;\n }\n const state = params.state ?? EMPTY_OBJECT;\n return evaluateRenderProp(element, renderProp, outProps, state);\n}\n\n/**\n * Computes render element final props.\n */\nfunction useRenderElementProps(componentProps, params = {}) {\n const {\n className: classNameProp,\n style: styleProp,\n render: renderProp\n } = componentProps;\n const {\n state = EMPTY_OBJECT,\n ref,\n props,\n stateAttributesMapping,\n enabled = true\n } = params;\n const className = enabled ? resolveClassName(classNameProp, state) : undefined;\n const style = enabled ? resolveStyle(styleProp, state) : undefined;\n const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;\n const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;\n\n // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.\n // This prevents potential TypeError when setting ref, className, or style properties,\n // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.\n const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;\n\n // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,\n // switching between them at runtime is safe. If this assertion fails, React will\n // throw at runtime anyway.\n // This also skips the `useMergedRefs` call on the server, which is fine because\n // refs are not used on the server side.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (typeof document !== 'undefined') {\n if (!enabled) {\n // Called only to keep the hook order stable when disabled; the merged ref is unused.\n void useMergedRefs(null, null);\n } else if (Array.isArray(ref)) {\n outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);\n } else {\n outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);\n }\n }\n if (!enabled) {\n return EMPTY_OBJECT;\n }\n if (className !== undefined) {\n outProps.className = mergeClassNames(outProps.className, className);\n }\n if (style !== undefined) {\n outProps.style = mergeObjects(outProps.style, style);\n }\n return outProps;\n}\nfunction resolveRenderFunctionProps(props) {\n if (Array.isArray(props)) {\n return mergePropsN(props);\n }\n return mergeProps(undefined, props);\n}\n\n// The symbol React uses internally for lazy components\n// https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31\n//\n// TODO delete once https://github.com/react/react/issues/32392 is fixed\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\nconst COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;\nconst LOWERCASE_CHARACTER_PATTERN = /[a-z]/;\nfunction evaluateRenderProp(element, render, props, state) {\n if (render) {\n if (typeof render === 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warnIfRenderPropLooksLikeComponent(render);\n }\n return render(props, state);\n }\n const mergedProps = mergeProps(props, render.props);\n mergedProps.ref = props.ref;\n let newElement = render;\n // Workaround for https://github.com/react/react/issues/32392\n // This works because the toArray() logic unwrap lazy element type in\n // https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/react/src/ReactChildren.js#L186\n if (newElement?.$$typeof === REACT_LAZY_TYPE) {\n const children = React.Children.toArray(render);\n newElement = children[0];\n }\n\n // There is a high number of indirections, the error message thrown by React.cloneElement() is\n // hard to use for developers, this logic provides a better context.\n //\n // Our general guideline is to never change the control flow depending on the environment.\n // However, React.cloneElement() throws if React.isValidElement() is false,\n // so we can throw before with custom message.\n if (process.env.NODE_ENV !== 'production') {\n if (! /*#__PURE__*/React.isValidElement(newElement)) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(['Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.', 'A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.', 'https://base-ui.com/r/invalid-render-prop'].join('\\n'));\n }\n }\n return /*#__PURE__*/React.cloneElement(newElement, mergedProps);\n }\n if (element) {\n if (typeof element === 'string') {\n return renderTag(element, props);\n }\n }\n // Unreachable, but the typings on `useRenderElement` need to be reworked\n // to annotate it correctly.\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: Render element or function are not defined.' : _formatErrorMessage(8));\n}\nfunction warnIfRenderPropLooksLikeComponent(renderFn) {\n const functionName = renderFn.name;\n if (functionName.length === 0) {\n return;\n }\n if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {\n return;\n }\n if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {\n return;\n }\n warn(`The \\`render\\` prop received a function named \\`${functionName}\\` that starts with an uppercase letter.`, 'This usually means a React component was passed directly as `render={Component}`.', 'Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.', 'If this is an intentional render callback, rename it to start with a lowercase letter.', 'Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.', 'https://base-ui.com/r/invalid-render-prop');\n}\nfunction renderTag(Tag, props) {\n if (Tag === 'button') {\n return /*#__PURE__*/_createElement(\"button\", {\n type: \"button\",\n ...props,\n key: props.key\n });\n }\n if (Tag === 'img') {\n return /*#__PURE__*/_createElement(\"img\", {\n alt: \"\",\n ...props,\n key: props.key\n });\n }\n return /*#__PURE__*/React.createElement(Tag, props);\n}","import * as React from 'react';\n\n/**\n * A clone of the React namespace for reading APIs that may be missing in older\n * supported React versions. Bundlers can rewrite direct `React.someNewApi`\n * reads into named imports, which breaks React 17. Reading from this cloned\n * object keeps those lookups optional.\n *\n * @see https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\n */\nexport const SafeReact = {\n ...React\n};","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from \"./safeReact.mjs\";\nlet globalId = 0;\n\n// TODO React 17: Remove `useGlobalId` once React 17 support is removed\nfunction useGlobalId(idOverride, prefix = 'mui') {\n const [defaultId, setDefaultId] = React.useState(idOverride);\n const id = idOverride || defaultId;\n React.useEffect(() => {\n if (defaultId == null) {\n // Fallback to this default id when possible.\n // Use the incrementing value for client-side rendering only.\n // We can't use it server-side.\n // If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem\n globalId += 1;\n setDefaultId(`${prefix}-${globalId}`);\n }\n }, [defaultId, prefix]);\n return id;\n}\nconst maybeReactUseId = SafeReact.useId;\n\n/**\n *\n * @example <div id={useId()} />\n * @param idOverride\n * @returns {string}\n */\nexport function useId(idOverride, prefix) {\n // React.useId() is only available from React 17.0.0.\n if (maybeReactUseId !== undefined) {\n const reactId = maybeReactUseId();\n return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);\n }\n\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.\n return useGlobalId(idOverride, prefix);\n}","'use client';\n\nimport { useId } from '@base-ui/utils/useId';\n\n/**\n * Wraps `useId` and prefixes generated `id`s with `base-ui-`\n * @param {string | undefined} idOverride overrides the generated id when provided\n * @returns {string | undefined}\n */\nexport function useBaseUiId(idOverride) {\n return useId(idOverride, 'base-ui');\n}","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';\n}\nfunction isTableElement(element) {\n return /^(table|td|th)$/.test(getNodeName(element));\n}\nfunction isTopLayer(element) {\n try {\n if (element.matches(':popover-open')) {\n return true;\n }\n } catch (_e) {\n // no-op\n }\n try {\n return element.matches(':modal');\n } catch (_e) {\n return false;\n }\n}\nconst willChangeRe = /transform|translate|scale|rotate|perspective|filter/;\nconst containRe = /paint|layout|strict|content/;\nconst isNotNone = value => !!value && value !== 'none';\nlet isWebKitValue;\nfunction isContainingBlock(elementOrCss) {\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (isWebKitValue == null) {\n isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');\n }\n return isWebKitValue;\n}\nfunction isLastTraversableNode(node) {\n return /^(html|body|#document)$/.test(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return (node.ownerDocument || node).body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n } else {\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n }\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","'use client';\n\nimport { SafeReact } from \"./safeReact.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst useInsertionEffect = SafeReact.useInsertionEffect;\nconst useSafeInsertionEffect =\n// React 17 doesn't have useInsertionEffect.\nuseInsertionEffect &&\n// Preact replaces useInsertionEffect with useLayoutEffect and fires too late.\nuseInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : fn => fn();\n/**\n * Stabilizes the function passed so it's always the same between renders.\n *\n * The function becomes non-reactive to any values it captures.\n * It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.\n *\n * The function must only be called inside effects and event handlers, never during render (which throws an error).\n *\n * This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.\n */\nexport function useStableCallback(callback) {\n const stable = useRefWithInit(createStableCallback).current;\n stable.next = callback;\n useSafeInsertionEffect(stable.effect);\n return stable.trampoline;\n}\nfunction createStableCallback() {\n const stable = {\n next: undefined,\n callback: assertNotCalled,\n trampoline: (...args) => stable.callback?.(...args),\n effect: () => {\n stable.callback = stable.next;\n }\n };\n return stable;\n}\nfunction assertNotCalled() {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw /* minify-error-disabled */new Error('Base UI: Cannot call an event handler while rendering.');\n }\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CompositeRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CompositeRootContext.displayName = \"CompositeRootContext\";\nexport function useCompositeRootContext(optional = false) {\n const context = React.useContext(CompositeRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : _formatErrorMessage(16));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nexport function useFocusableWhenDisabled(parameters) {\n const {\n focusableWhenDisabled,\n disabled,\n composite = false,\n tabIndex: tabIndexProp = 0,\n isNativeButton\n } = parameters;\n const isFocusableComposite = composite && focusableWhenDisabled !== false;\n const isNonFocusableComposite = composite && focusableWhenDisabled === false;\n\n // we can't explicitly assign `undefined` to any of these props because it\n // would otherwise prevent subsequently merged props from setting them\n const props = React.useMemo(() => {\n const additionalProps = {\n // allow Tabbing away from focusableWhenDisabled elements\n onKeyDown(event) {\n if (disabled && focusableWhenDisabled && event.key !== 'Tab') {\n event.preventDefault();\n }\n }\n };\n if (!composite) {\n additionalProps.tabIndex = tabIndexProp;\n if (!isNativeButton && disabled) {\n additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;\n }\n }\n if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {\n additionalProps['aria-disabled'] = disabled;\n }\n if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {\n additionalProps.disabled = disabled;\n }\n return additionalProps;\n }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);\n return {\n props\n };\n}","export { getWindow as ownerWindow } from '@floating-ui/utils/dom';\nexport function ownerDocument(node) {\n return node?.ownerDocument || document;\n}","import { ownerWindow } from '@base-ui/utils/owner';\n/**\n * Dispatches a constructed click on the target so it carries the source event's\n * modifier state, which `click()` always reports as unpressed. Like `click()`,\n * the untrusted click still runs native activation behavior (form submission,\n * link navigation).\n * `detail` defaults to 0 (the native convention for keyboard-generated clicks);\n * pass `detail: 1` when the click represents a mouse gesture so consumers keying\n * off `detail === 0` don't classify it as a keyboard activation.\n */\nexport function dispatchClickWithModifiers(target, sourceEvent, {\n detail = 0\n} = {}) {\n target.dispatchEvent(new (ownerWindow(target).PointerEvent)('click', {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n shiftKey: sourceEvent.shiftKey,\n ctrlKey: sourceEvent.ctrlKey,\n altKey: sourceEvent.altKey,\n metaKey: sourceEvent.metaKey\n }));\n}","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { error } from '@base-ui/utils/error';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { makeEventPreventable, mergeProps } from \"../../merge-props/index.mjs\";\nimport { useCompositeRootContext } from \"../composite/root/CompositeRootContext.mjs\";\nimport { useFocusableWhenDisabled } from \"../../utils/useFocusableWhenDisabled.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nexport function useButton(parameters = {}) {\n const {\n disabled = false,\n focusableWhenDisabled,\n tabIndex = 0,\n native: isNativeButton = true,\n composite: compositeProp\n } = parameters;\n const elementRef = React.useRef(null);\n const compositeRootContext = useCompositeRootContext(true);\n const isCompositeItem = compositeProp ?? compositeRootContext !== undefined;\n const {\n props: focusableWhenDisabledProps\n } = useFocusableWhenDisabled({\n focusableWhenDisabled,\n disabled,\n composite: isCompositeItem,\n tabIndex,\n isNativeButton\n });\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n const isButtonTag = isButtonElement(elementRef.current);\n if (isNativeButton) {\n if (!isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a native <button> because the ' + '`nativeButton` prop is true. Rendering a non-<button> removes native button ' + 'semantics, which can impact forms and accessibility. Use a real <button> in the ' + '`render` prop, or set `nativeButton` to `false`.';\n error(`${message}${ownerStackMessage}`);\n }\n } else if (isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a non-<button> because the `nativeButton` ' + 'prop is false. Rendering a <button> keeps native behavior while Base UI applies ' + 'non-native attributes and handlers, which can add unintended extra attributes (such ' + 'as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set ' + '`nativeButton` to `true`.';\n error(`${message}${ownerStackMessage}`);\n }\n }, [isNativeButton]);\n }\n\n // handles a disabled composite button rendering another button, e.g.\n // <Toolbar.Button disabled render={<Menu.Trigger />} />\n // the `disabled` prop needs to pass through 2 `useButton`s then finally\n // delete the `disabled` attribute from DOM\n const updateDisabled = React.useCallback(() => {\n const element = elementRef.current;\n if (!isButtonElement(element)) {\n return;\n }\n if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === undefined && element.disabled) {\n element.disabled = false;\n }\n }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);\n useIsoLayoutEffect(updateDisabled, [updateDisabled]);\n const getButtonProps = React.useCallback((externalProps = {}) => {\n const {\n onClick: externalOnClick,\n onMouseDown: externalOnMouseDown,\n onKeyUp: externalOnKeyUp,\n onKeyDown: externalOnKeyDown,\n onPointerDown: externalOnPointerDown,\n ...otherExternalProps\n } = externalProps;\n return mergeProps({\n onClick(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnClick?.(event);\n },\n onMouseDown(event) {\n if (!disabled) {\n externalOnMouseDown?.(event);\n }\n },\n onKeyDown(event) {\n if (disabled) {\n return;\n }\n makeEventPreventable(event);\n externalOnKeyDown?.(event);\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const isCurrentTarget = event.target === event.currentTarget;\n const currentTarget = event.currentTarget;\n const isButton = isButtonElement(currentTarget);\n const isLink = !isNativeButton && isValidLinkElement(currentTarget);\n const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);\n const isEnterKey = event.key === 'Enter';\n const isSpaceKey = event.key === ' ';\n const role = currentTarget.getAttribute('role');\n const isTextNavigationRole = role?.startsWith('menuitem') || role === 'option' || role === 'gridcell';\n if (isCurrentTarget && isCompositeItem && isSpaceKey) {\n if (event.defaultPrevented && isTextNavigationRole) {\n return;\n }\n event.preventDefault();\n\n // Only a native-mode item that isn't a real <button> is excluded.\n if (!isNativeButton || isButton) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n return;\n }\n\n // Keyboard accessibility for native and non-native elements.\n if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {\n // Space activates links on keyup (`role=\"button\"` semantics, matching the\n // composite path); prevent the page scroll Space would otherwise trigger.\n // Enter is left to the browser's native link activation.\n if (isCurrentTarget && isLink && isSpaceKey) {\n event.preventDefault();\n }\n return;\n }\n\n // Match native buttons: preventing the keydown's default cancels activation.\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n if (isEnterKey) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n },\n onKeyUp(event) {\n if (disabled) {\n return;\n }\n\n // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed\n // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0\n makeEventPreventable(event);\n externalOnKeyUp?.(event);\n if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === ' ') {\n event.preventDefault();\n return;\n }\n if (event.baseUIHandlerPrevented) {\n return;\n }\n\n // Keyboard accessibility for non interactive elements.\n // Match native buttons: preventing the keyup's default cancels Space activation.\n // Limitation: unlike a native <button>, a prevented *keydown* cannot cancel the\n // activation — no state is kept between keydown and keyup, so we can't tell\n // whether the keydown was prevented or even happened on this element.\n if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === ' ') {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(event.currentTarget, event);\n }\n },\n onPointerDown(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnPointerDown?.(event);\n }\n }, isNativeButton ? {\n type: 'button'\n } : {\n role: 'button'\n }, focusableWhenDisabledProps, otherExternalProps);\n }, [disabled, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);\n const buttonRef = useStableCallback(element => {\n elementRef.current = element;\n updateDisabled();\n });\n return {\n getButtonProps,\n buttonRef\n };\n}\nfunction isButtonElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'BUTTON';\n}\nfunction isValidLinkElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'A' && Boolean(elem.href);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SwitchRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SwitchRootContext.displayName = \"SwitchRootContext\";\nexport function useSwitchRootContext() {\n const context = React.useContext(SwitchRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>.' : _formatErrorMessage(63));\n }\n return context;\n}","export const DEFAULT_VALIDITY_STATE = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: null,\n valueMissing: false\n};\nexport const DEFAULT_FIELD_STATE_ATTRIBUTES = {\n valid: null,\n touched: false,\n dirty: false,\n filled: false,\n focused: false\n};\nexport const DEFAULT_FIELD_ROOT_STATE = {\n disabled: false,\n ...DEFAULT_FIELD_STATE_ATTRIBUTES\n};\nexport const fieldValidityMapping = {\n valid(value) {\n if (value === null) {\n return null;\n }\n if (value) {\n return {\n 'data-valid': ''\n };\n }\n return {\n 'data-invalid': ''\n };\n }\n};","import { fieldValidityMapping } from \"../internals/field-constants/constants.mjs\";\nexport const stateAttributesMapping = {\n ...fieldValidityMapping,\n checked(value) {\n if (value) {\n return {\n 'data-checked': ''\n };\n }\n return {\n 'data-unchecked': ''\n };\n }\n};","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { NOOP } from \"../noop.mjs\";\nimport { DEFAULT_FIELD_ROOT_STATE, DEFAULT_VALIDITY_STATE } from \"../field-constants/constants.mjs\";\nexport const DEFAULT_FIELD_ROOT_CONTEXT = {\n invalid: undefined,\n name: undefined,\n validityData: {\n state: DEFAULT_VALIDITY_STATE,\n errors: [],\n error: '',\n value: '',\n initialValue: null\n },\n setValidityData: NOOP,\n disabled: undefined,\n setTouched: NOOP,\n setDirty: NOOP,\n setFilled: NOOP,\n setFocused: NOOP,\n validationMode: 'onSubmit',\n shouldValidateOnChange: () => false,\n state: DEFAULT_FIELD_ROOT_STATE,\n registerFieldControl: NOOP,\n validation: {\n getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,\n inputRef: {\n current: null\n },\n registeredInputs: new Map(),\n registerInput: NOOP,\n getInputControl: () => null,\n commit: async () => {},\n change: NOOP\n }\n};\nexport const FieldRootContext = /*#__PURE__*/React.createContext(DEFAULT_FIELD_ROOT_CONTEXT);\nif (process.env.NODE_ENV !== \"production\") FieldRootContext.displayName = \"FieldRootContext\";\nexport function useFieldRootContext(optional = true) {\n const context = React.useContext(FieldRootContext);\n if (context.setValidityData === NOOP && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.' : _formatErrorMessage(28));\n }\n return context;\n}","'use client';\n\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useFieldRootContext } from \"../field-root-context/FieldRootContext.mjs\";\nexport function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {\n const {\n registerFieldControl\n } = useFieldRootContext();\n const sourceRef = useRefWithInit(() => Symbol());\n\n // Re-register without unregistering first: re-registration with the same id updates the\n // form's fields Map entry in place, while a delete + re-add would move the field to the\n // end of the Map every time its value changes.\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n if (!enabled) {\n registerFieldControl(source, undefined);\n return;\n }\n const registration = {\n controlRef,\n getValue: getFormValueOverride,\n id,\n name,\n value\n };\n registerFieldControl(source, registration);\n }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n return () => {\n registerFieldControl(source, undefined);\n };\n }, [registerFieldControl, sourceRef]);\n}","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\nexport const FormContext = /*#__PURE__*/React.createContext({\n elementRef: {\n current: null\n },\n formRef: {\n current: {\n fields: new Map()\n }\n },\n errors: {},\n clearErrors: NOOP,\n validationMode: 'onSubmit',\n submitAttemptedRef: {\n current: false\n }\n});\nif (process.env.NODE_ENV !== \"production\") FormContext.displayName = \"FormContext\";\nexport function useFormContext() {\n return React.useContext(FormContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\n/**\n * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\\\n * with an accessible name (label) and description.\n */\nexport const LabelableContext = /*#__PURE__*/React.createContext({\n controlId: undefined,\n registerControlId: NOOP,\n labelId: undefined,\n setLabelId: NOOP,\n messageIds: [],\n setMessageIds: NOOP,\n getDescriptionProps: externalProps => externalProps\n});\nif (process.env.NODE_ENV !== \"production\") LabelableContext.displayName = \"LabelableContext\";\nexport function useLabelableContext() {\n return React.useContext(LabelableContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../useBaseUiId.mjs\";\nexport function useAriaLabelledBy(explicitAriaLabelledBy, labelId, labelSourceRef, enableFallback = true, labelSourceId) {\n const [fallbackAriaLabelledBy, setFallbackAriaLabelledBy] = React.useState();\n const generatedLabelId = useBaseUiId(labelSourceId ? `${labelSourceId}-label` : undefined);\n const ariaLabelledBy = explicitAriaLabelledBy ?? labelId ?? fallbackAriaLabelledBy;\n\n // Fallback for <span> controls labelled by wrapping/sibling native <label>.\n // Run after every commit so DOM association changes (e.g. label mount/unmount)\n // are reflected even when props/state deps are unchanged.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(() => {\n const nextAriaLabelledBy = explicitAriaLabelledBy || labelId || !enableFallback ? undefined : getAriaLabelledBy(labelSourceRef.current, generatedLabelId);\n if (fallbackAriaLabelledBy !== nextAriaLabelledBy) {\n setFallbackAriaLabelledBy(nextAriaLabelledBy);\n }\n });\n return ariaLabelledBy;\n}\nfunction getAriaLabelledBy(labelSource, generatedLabelId) {\n const label = findAssociatedLabel(labelSource);\n if (!label) {\n return undefined;\n }\n if (!label.id && generatedLabelId) {\n label.id = generatedLabelId;\n }\n return label.id || undefined;\n}\nfunction findAssociatedLabel(labelSource) {\n if (!labelSource) {\n return undefined;\n }\n\n // Fast path before the expensive `.labels` read.\n const parent = labelSource.parentElement;\n if (parent && parent.tagName === 'LABEL') {\n return parent;\n }\n const controlId = labelSource.id;\n if (controlId) {\n const nextSibling = labelSource.nextElementSibling;\n if (nextSibling && nextSibling.htmlFor === controlId) {\n return nextSibling;\n }\n }\n const labels = labelSource.labels;\n return labels && labels[0];\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { NOOP } from \"../noop.mjs\";\nimport { useBaseUiId } from \"../useBaseUiId.mjs\";\nimport { useLabelableContext } from \"./LabelableContext.mjs\";\nexport function useLabelableId(params = {}) {\n const {\n id,\n implicit = false,\n controlRef\n } = params;\n const {\n controlId,\n registerControlId\n } = useLabelableContext();\n const defaultId = useBaseUiId(id);\n const controlIdForEffect = implicit ? controlId : undefined;\n const controlSourceRef = useRefWithInit(() => Symbol());\n const hasRegisteredRef = React.useRef(false);\n const hadExplicitIdRef = React.useRef(id != null);\n const unregisterControlId = useStableCallback(() => {\n if (!hasRegisteredRef.current || registerControlId === NOOP) {\n return;\n }\n hasRegisteredRef.current = false;\n registerControlId(controlSourceRef.current, undefined);\n });\n useIsoLayoutEffect(() => {\n if (registerControlId === NOOP) {\n return undefined;\n }\n let nextId;\n if (implicit) {\n const elem = controlRef?.current;\n if (isElement(elem) && elem.closest('label') != null) {\n nextId = id ?? null;\n } else {\n nextId = controlIdForEffect ?? defaultId;\n }\n } else if (id != null) {\n hadExplicitIdRef.current = true;\n nextId = id;\n } else if (hadExplicitIdRef.current) {\n nextId = defaultId;\n } else {\n unregisterControlId();\n return undefined;\n }\n if (nextId === undefined) {\n unregisterControlId();\n return undefined;\n }\n hasRegisteredRef.current = true;\n registerControlId(controlSourceRef.current, nextId);\n return undefined;\n }, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);\n React.useEffect(() => {\n return unregisterControlId;\n }, [unregisterControlId]);\n return controlId ?? defaultId;\n}","export const none = 'none';\nexport const triggerPress = 'trigger-press';\nexport const triggerHover = 'trigger-hover';\nexport const triggerFocus = 'trigger-focus';\nexport const outsidePress = 'outside-press';\nexport const itemPress = 'item-press';\nexport const closePress = 'close-press';\nexport const linkPress = 'link-press';\nexport const clearPress = 'clear-press';\nexport const chipRemovePress = 'chip-remove-press';\nexport const trackPress = 'track-press';\nexport const incrementPress = 'increment-press';\nexport const decrementPress = 'decrement-press';\nexport const inputChange = 'input-change';\nexport const inputClear = 'input-clear';\nexport const inputBlur = 'input-blur';\nexport const inputPaste = 'input-paste';\nexport const inputPress = 'input-press';\nexport const focusOut = 'focus-out';\nexport const escapeKey = 'escape-key';\nexport const closeWatcher = 'close-watcher';\nexport const listNavigation = 'list-navigation';\nexport const keyboard = 'keyboard';\nexport const pointer = 'pointer';\nexport const drag = 'drag';\nexport const wheel = 'wheel';\nexport const scrub = 'scrub';\nexport const cancelOpen = 'cancel-open';\nexport const siblingOpen = 'sibling-open';\nexport const disabled = 'disabled';\nexport const missing = 'missing';\nexport const initial = 'initial';\nexport const imperativeAction = 'imperative-action';\nexport const swipe = 'swipe';\nexport const windowResize = 'window-resize';","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { REASONS } from \"./reasons.mjs\";\n\n/**\n * Maps a change `reason` string to the corresponding native event type.\n */\n\n/**\n * Details of custom change events emitted by Base UI components.\n */\n\n/**\n * Details of custom generic events emitted by Base UI components.\n */\n\n/**\n * Creates a Base UI event details object with the given reason and utilities\n * for preventing Base UI's internal event handling.\n */\nexport function createChangeEventDetails(reason, event, trigger, customProperties) {\n let canceled = false;\n let allowPropagation = false;\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n cancel() {\n canceled = true;\n },\n allowPropagation() {\n allowPropagation = true;\n },\n get isCanceled() {\n return canceled;\n },\n get isPropagationAllowed() {\n return allowPropagation;\n },\n trigger,\n ...custom\n };\n return details;\n}\nexport function createGenericEventDetails(reason, event, customProperties) {\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n ...custom\n };\n return details;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport function useValueChanged(value, onChange) {\n const valueRef = React.useRef(value);\n const onChangeCallback = useStableCallback(onChange);\n useIsoLayoutEffect(() => {\n if (valueRef.current !== value) {\n onChangeCallback(valueRef.current);\n }\n valueRef.current = value;\n }, [value, onChangeCallback]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { SwitchRootContext } from \"./SwitchRootContext.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\n\n/**\n * Represents the switch itself.\n * Renders a `<span>` element and a hidden `<input>` beside.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(componentProps, forwardedRef) {\n const {\n checked: checkedProp,\n className,\n defaultChecked,\n 'aria-labelledby': ariaLabelledByProp,\n form,\n id: idProp,\n inputRef: externalInputRef,\n name: nameProp,\n nativeButton = false,\n onCheckedChange,\n readOnly = false,\n required = false,\n disabled: disabledProp = false,\n render,\n uncheckedValue,\n value,\n style,\n ...elementProps\n } = componentProps;\n const {\n clearErrors\n } = useFormContext();\n const {\n state: fieldState,\n setTouched,\n setDirty,\n validityData,\n setFilled,\n setFocused,\n validationMode,\n disabled: fieldDisabled,\n name: fieldName,\n validation\n } = useFieldRootContext();\n const {\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const inputRef = React.useRef(null);\n const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);\n const switchRef = React.useRef(null);\n const id = useBaseUiId();\n const controlId = useLabelableId({\n id: idProp,\n implicit: false,\n controlRef: switchRef\n });\n const hiddenInputId = nativeButton ? undefined : controlId;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n useRegisterFieldControl(switchRef, id, checked, undefined, !disabled, nameProp);\n useIsoLayoutEffect(() => {\n if (inputRef.current) {\n setFilled(inputRef.current.checked);\n }\n }, [setFilled]);\n useValueChanged(checked, () => {\n clearErrors(name);\n setDirty(checked !== validityData.initialValue);\n setFilled(checked);\n validation.change(checked);\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId);\n const rootProps = {\n id: nativeButton ? controlId : id,\n role: 'switch',\n 'aria-checked': checked,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': ariaLabelledBy,\n onFocus() {\n if (!disabled) {\n setFocused(true);\n }\n },\n onBlur() {\n const element = inputRef.current;\n if (!element || disabled) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(element.checked);\n }\n },\n onClick(event) {\n if (readOnly || disabled) {\n return;\n }\n event.preventDefault();\n const input = inputRef.current;\n if (!input) {\n return;\n }\n dispatchClickWithModifiers(input, event);\n }\n };\n const inputProps = {\n ...validation.getValidationProps(disabled),\n checked,\n disabled,\n form,\n id: hiddenInputId,\n name,\n required,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n type: 'checkbox',\n 'aria-hidden': true,\n ref: handleInputRef,\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n if (readOnly) {\n event.preventDefault();\n return;\n }\n const nextChecked = event.currentTarget.checked;\n const eventDetails = createChangeEventDetails(REASONS.none, event.nativeEvent);\n onCheckedChange?.(nextChecked, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setCheckedState(nextChecked);\n },\n onClick(event) {\n // The click dispatched from the root's `onClick` is an implementation detail\n // and must not reach ancestors, which already receive the original click.\n event.stopPropagation();\n },\n onFocus() {\n switchRef.current?.focus();\n },\n // React <19 sets an empty value if `undefined` is passed explicitly\n // To avoid this, we only set the value if it's defined\n ...(value !== undefined ? {\n value\n } : EMPTY_OBJECT)\n };\n const state = React.useMemo(() => ({\n ...fieldState,\n checked,\n disabled,\n readOnly,\n required\n }), [fieldState, checked, disabled, readOnly, required]);\n const element = useRenderElement('span', componentProps, {\n state,\n ref: [forwardedRef, switchRef, buttonRef],\n props: [rootProps, elementProps, getButtonProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsxs(SwitchRootContext.Provider, {\n value: state,\n children: [element, !checked && name && uncheckedValue !== undefined && /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: uncheckedValue,\n disabled: disabled\n }), /*#__PURE__*/_jsx(\"input\", {\n ...inputProps,\n suppressHydrationWarning: true\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchRoot.displayName = \"SwitchRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useSwitchRootContext } from \"../root/SwitchRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\n\n/**\n * The movable part of the switch that indicates whether the switch is on or off.\n * Renders a `<span>`.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nexport const SwitchThumb = /*#__PURE__*/React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const state = useSwitchRootContext();\n return useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n stateAttributesMapping,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchThumb.displayName = \"SwitchThumb\";","import * as React from 'react';\nimport { Switch } from '@base-ui/react/switch';\nimport { TOK } from './styles.js';\n\nexport interface CapabilitySwitchOptions {\n readonly checked: boolean;\n readonly disabled: boolean;\n /** Dim the control while a write is in flight. */\n readonly busy: boolean;\n /** Accessible name; the caller translates it. */\n readonly label: string;\n readonly onCheckedChange: (checked: boolean) => void;\n}\n\n/**\n * The capability switch, in one place for both panels.\n *\n * The two panels each had their own copy, and the copies had already drifted:\n * the thumb was a circle in one and a pill in the other, with different\n * transition durations and shadows. Nobody noticed, which is the point --\n * \"how a control looks\" belongs to the design system, while \"what a row is\n * made of\" belongs to each panel, so only the latter is written twice.\n */\nexport function capabilitySwitch(options: CapabilitySwitchOptions): React.ReactElement {\n const inert = options.disabled || options.busy;\n return React.createElement(\n Switch.Root,\n {\n className: 'ci-switch',\n checked: options.checked,\n disabled: inert,\n 'aria-label': options.label,\n onCheckedChange: options.onCheckedChange,\n style: {\n position: 'relative',\n width: '32px',\n height: '18px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: options.checked ? TOK.switchOn : TOK.switchOff,\n cursor: inert ? 'not-allowed' : 'pointer',\n opacity: options.busy ? 0.65 : 1,\n flex: '0 0 auto',\n },\n },\n React.createElement(Switch.Thumb, {\n className: 'ci-thumb',\n style: {\n display: 'block',\n width: '14px',\n height: '14px',\n margin: '2px',\n borderRadius: '999px',\n background: TOK.switchThumb,\n boxShadow: '0 1px 2px rgba(0,0,0,.22)',\n transform: options.checked ? 'translateX(14px)' : 'translateX(0)',\n transition: `transform .12s ${TOK.switchEase}`,\n },\n }),\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY } from \"./empty.mjs\";\n\n/**\n * A React.useEffect equivalent that runs once, when the component is mounted.\n */\nexport function useOnMount(fn) {\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array\n /* eslint-disable react-hooks/exhaustive-deps */\n React.useEffect(fn, EMPTY_ARRAY);\n /* eslint-enable react-hooks/exhaustive-deps */\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\n/** Unlike `setTimeout`, rAF doesn't guarantee a positive integer return value, so we can't have\n * a monomorphic `uint` type with `0` meaning empty.\n * See warning note at:\n * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#return_value */\nconst EMPTY = null;\nlet LAST_RAF = globalThis.requestAnimationFrame;\nclass Scheduler {\n /* This implementation uses an array as a backing data-structure for frame callbacks.\n * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it\n * never calls the native `cancelAnimationFrame` if there are no frames left. This can\n * be much more efficient if there is a call pattern that alterns as\n * \"request-cancel-request-cancel-…\".\n * But in the case of \"request-request-…-cancel-cancel-…\", it leaves the final animation\n * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */\n\n callbacks = [];\n callbacksCount = 0;\n nextId = 1;\n startId = 1;\n isScheduled = false;\n tick = timestamp => {\n this.isScheduled = false;\n const currentCallbacks = this.callbacks;\n const currentCallbacksCount = this.callbacksCount;\n\n // Update these before iterating, callbacks could call `requestAnimationFrame` again.\n this.callbacks = [];\n this.callbacksCount = 0;\n this.startId = this.nextId;\n if (currentCallbacksCount > 0) {\n for (let i = 0; i < currentCallbacks.length; i += 1) {\n currentCallbacks[i]?.(timestamp);\n }\n }\n };\n request(fn) {\n const id = this.nextId;\n this.nextId += 1;\n this.callbacks.push(fn);\n this.callbacksCount += 1;\n\n /* In a test environment with fake timers, a fake `requestAnimationFrame` can be called\n * but there's no guarantee that the animation frame will actually run before the fake\n * timers are teared, which leaves `isScheduled` set, but won't run our `tick()`. */\n const didRAFChange = process.env.NODE_ENV !== 'production' && LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);\n if (!this.isScheduled || didRAFChange) {\n requestAnimationFrame(this.tick);\n this.isScheduled = true;\n }\n return id;\n }\n cancel(id) {\n const index = id - this.startId;\n if (index < 0 || index >= this.callbacks.length) {\n return;\n }\n this.callbacks[index] = null;\n this.callbacksCount -= 1;\n }\n}\nlet scheduler = new Scheduler();\n\n/**\n * Replaces the shared scheduler and drops all pending animation frame callbacks.\n *\n * For test environments only. The scheduler is process-global, so a callback scheduled in one test\n * but never run (e.g. requested under fake timers that were torn down before the frame fired) would\n * otherwise survive into a later test and run there against stale state. Call between tests to drop\n * such leftovers.\n */\nexport function resetAnimationFrameScheduler() {\n const previous = scheduler;\n scheduler = new Scheduler();\n // Continue the id sequence so `cancel()` calls from `AnimationFrame` instances created before the\n // reset cannot cancel callbacks scheduled after it.\n scheduler.nextId = previous.nextId;\n scheduler.startId = previous.nextId;\n // A frame requested before the reset may still be pending and holds the previous scheduler's\n // `tick`; empty its queue in place so that frame runs nothing when it eventually fires.\n previous.callbacks = [];\n previous.callbacksCount = 0;\n}\nexport class AnimationFrame {\n static create() {\n return new AnimationFrame();\n }\n static request(fn) {\n return scheduler.request(fn);\n }\n static cancel(id) {\n return scheduler.cancel(id);\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n request(fn) {\n this.cancel();\n this.currentId = scheduler.request(() => {\n this.currentId = EMPTY;\n fn();\n });\n }\n cancel = () => {\n if (this.currentId !== EMPTY) {\n scheduler.cancel(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.cancel;\n };\n}\n\n/**\n * A `requestAnimationFrame` with automatic cleanup and guard.\n */\nexport function useAnimationFrame() {\n const timeout = useRefWithInit(AnimationFrame.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\n/**\n * Provides a status string for CSS animations.\n * @param open - a boolean that determines if the element is open.\n * @param enableIdleState - a boolean that enables the `'idle'` state between `'starting'` and `'ending'`\n */\nexport function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {\n const [transitionStatus, setTransitionStatus] = React.useState(open && enableIdleState ? 'idle' : undefined);\n const [mounted, setMounted] = React.useState(open);\n if (open && !mounted) {\n setMounted(true);\n setTransitionStatus('starting');\n }\n if (!open && mounted && transitionStatus !== 'ending' && !deferEndingState) {\n setTransitionStatus('ending');\n }\n if (!open && !mounted && transitionStatus === 'ending') {\n setTransitionStatus(undefined);\n }\n useIsoLayoutEffect(() => {\n if (!open && mounted && transitionStatus !== 'ending' && deferEndingState) {\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('ending');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }\n return undefined;\n }, [open, mounted, transitionStatus, deferEndingState]);\n useIsoLayoutEffect(() => {\n if (!open || enableIdleState) {\n return undefined;\n }\n const frame = AnimationFrame.request(() => {\n // Avoid `flushSync` here due to Firefox.\n // See https://github.com/mui/base-ui/pull/3424\n setTransitionStatus(undefined);\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open]);\n useIsoLayoutEffect(() => {\n if (!open || !enableIdleState) {\n return undefined;\n }\n if (open && mounted && transitionStatus !== 'idle') {\n setTransitionStatus('starting');\n }\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('idle');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open, mounted, transitionStatus]);\n return {\n mounted,\n setMounted,\n transitionStatus\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nexport function useCollapsibleRoot(parameters) {\n const {\n open: openParam,\n defaultOpen,\n onOpenChange,\n disabled\n } = parameters;\n const [open, setOpen] = useControlled({\n controlled: openParam,\n default: defaultOpen,\n name: 'Collapsible',\n state: 'open'\n });\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open, true, true);\n const defaultPanelId = useBaseUiId();\n // `undefined` uses the initial generated fallback; `null` means the panel unmounted.\n const [registeredPanelId, setPanelIdState] = React.useState();\n const panelId = registeredPanelId === null ? undefined : registeredPanelId ?? defaultPanelId;\n const handleTrigger = useStableCallback(event => {\n const nextOpen = !open;\n const eventDetails = createChangeEventDetails(REASONS.triggerPress, event.nativeEvent);\n onOpenChange(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpen(nextOpen);\n });\n return React.useMemo(() => ({\n defaultPanelId,\n disabled,\n handleTrigger,\n mounted,\n open,\n panelId,\n setMounted,\n setOpen,\n setPanelIdState,\n transitionStatus\n }), [defaultPanelId, disabled, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CollapsibleRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CollapsibleRootContext.displayName = \"CollapsibleRootContext\";\nexport function useCollapsibleRootContext() {\n const context = React.useContext(CollapsibleRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.' : _formatErrorMessage(15));\n }\n return context;\n}","export let TransitionStatusDataAttributes = /*#__PURE__*/function (TransitionStatusDataAttributes) {\n /**\n * Present when the component begins animating in.\n */\n TransitionStatusDataAttributes[\"startingStyle\"] = \"data-starting-style\";\n /**\n * Present when the component is animating out.\n */\n TransitionStatusDataAttributes[\"endingStyle\"] = \"data-ending-style\";\n return TransitionStatusDataAttributes;\n}({});\nconst STARTING_HOOK = {\n 'data-starting-style': ''\n};\nconst ENDING_HOOK = {\n 'data-ending-style': ''\n};\nexport const transitionStatusMapping = {\n transitionStatus(value) {\n if (value === 'starting') {\n return STARTING_HOOK;\n }\n if (value === 'ending') {\n return ENDING_HOOK;\n }\n return null;\n }\n};","import { TransitionStatusDataAttributes } from \"../../internals/stateAttributesMapping.mjs\";\nexport let CollapsiblePanelDataAttributes = function (CollapsiblePanelDataAttributes) {\n /**\n * Present when the collapsible panel is open.\n */\n CollapsiblePanelDataAttributes[\"open\"] = \"data-open\";\n /**\n * Present when the collapsible panel is closed.\n */\n CollapsiblePanelDataAttributes[\"closed\"] = \"data-closed\";\n /**\n * Present when the panel begins animating in.\n */\n CollapsiblePanelDataAttributes[CollapsiblePanelDataAttributes[\"startingStyle\"] = TransitionStatusDataAttributes.startingStyle] = \"startingStyle\";\n /**\n * Present when the panel is animating out.\n */\n CollapsiblePanelDataAttributes[CollapsiblePanelDataAttributes[\"endingStyle\"] = TransitionStatusDataAttributes.endingStyle] = \"endingStyle\";\n return CollapsiblePanelDataAttributes;\n}({});","export let CollapsibleTriggerDataAttributes = /*#__PURE__*/function (CollapsibleTriggerDataAttributes) {\n /**\n * Present when the collapsible panel is open.\n */\n CollapsibleTriggerDataAttributes[\"panelOpen\"] = \"data-panel-open\";\n return CollapsibleTriggerDataAttributes;\n}({});","import { CollapsiblePanelDataAttributes } from \"../collapsible/panel/CollapsiblePanelDataAttributes.mjs\";\nimport { CollapsibleTriggerDataAttributes } from \"../collapsible/trigger/CollapsibleTriggerDataAttributes.mjs\";\nconst PANEL_OPEN_HOOK = {\n [CollapsiblePanelDataAttributes.open]: ''\n};\nconst PANEL_CLOSED_HOOK = {\n [CollapsiblePanelDataAttributes.closed]: ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return {\n [CollapsibleTriggerDataAttributes.panelOpen]: ''\n };\n }\n return null;\n }\n};\nexport const collapsibleOpenStateMapping = {\n open(value) {\n if (value) {\n return PANEL_OPEN_HOOK;\n }\n return PANEL_CLOSED_HOOK;\n }\n};","import { collapsibleOpenStateMapping as baseMapping } from \"../../utils/collapsibleOpenStateMapping.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nexport const collapsibleStateAttributesMapping = {\n ...baseMapping,\n ...transitionStatusMapping\n};","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCollapsibleRoot } from \"./useCollapsibleRoot.mjs\";\nimport { CollapsibleRootContext } from \"./CollapsibleRootContext.mjs\";\nimport { collapsibleStateAttributesMapping } from \"./stateAttributesMapping.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Groups all parts of the collapsible.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsibleRoot = /*#__PURE__*/React.forwardRef(function CollapsibleRoot(componentProps, forwardedRef) {\n const {\n render,\n className,\n defaultOpen = false,\n disabled = false,\n onOpenChange: onOpenChangeProp,\n open,\n style,\n ...elementProps\n } = componentProps;\n const onOpenChange = useStableCallback(onOpenChangeProp);\n const collapsible = useCollapsibleRoot({\n open,\n defaultOpen,\n onOpenChange,\n disabled\n });\n const state = React.useMemo(() => ({\n open: collapsible.open,\n disabled: collapsible.disabled,\n transitionStatus: collapsible.transitionStatus\n }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);\n const contextValue = React.useMemo(() => ({\n ...collapsible,\n onOpenChange,\n state\n }), [collapsible, onOpenChange, state]);\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: elementProps,\n stateAttributesMapping: collapsibleStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(CollapsibleRootContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") CollapsibleRoot.displayName = \"CollapsibleRoot\";","'use client';\n\nimport * as React from 'react';\nimport { triggerOpenStateMapping } from \"../../utils/collapsibleOpenStateMapping.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useCollapsibleRootContext } from \"../root/CollapsibleRootContext.mjs\";\nconst stateAttributesMapping = {\n ...triggerOpenStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A button that opens and closes the collapsible panel.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsibleTrigger = /*#__PURE__*/React.forwardRef(function CollapsibleTrigger(componentProps, forwardedRef) {\n const {\n panelId,\n open,\n handleTrigger,\n state,\n disabled: contextDisabled\n } = useCollapsibleRootContext();\n const {\n className,\n disabled = contextDisabled,\n render,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton\n });\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [{\n 'aria-controls': open ? panelId : undefined,\n 'aria-expanded': open,\n onClick: handleTrigger\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") CollapsibleTrigger.displayName = \"CollapsibleTrigger\";","/**\n * Adds an event listener and returns a cleanup function to remove it.\n */\n\nexport function addEventListener(target, type, listener, options) {\n target.addEventListener(type, listener, options);\n return () => {\n target.removeEventListener(type, listener, options);\n };\n}","'use client';\n\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Untracks the provided value by turning it into a ref to remove its reactivity.\n *\n * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.\n */\nexport function useValueAsRef(value) {\n const latest = useRefWithInit(createLatestRef, value).current;\n latest.next = value;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(latest.effect);\n return latest;\n}\nfunction createLatestRef(value) {\n const latest = {\n current: value,\n next: value,\n effect: () => {\n latest.current = latest.next;\n }\n };\n return latest;\n}","/**\n * If the provided argument is a ref object, returns its `current` value.\n * Otherwise, returns the argument itself.\n */\nexport function resolveRef(maybeRef) {\n if (maybeRef == null) {\n return maybeRef;\n }\n return 'current' in maybeRef ? maybeRef.current : maybeRef;\n}","'use client';\n\nimport * as ReactDOM from 'react-dom';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { resolveRef } from \"../utils/resolveRef.mjs\";\n\n/**\n * Executes a function once all animations have finished on the provided element.\n * If an animation is canceled, waits for any replacement animations before executing.\n * @param elementOrRef - The element to watch for animations.\n * @param waitForStartingStyleRemoved - Whether to wait for [data-starting-style] to be removed before checking for animations.\n * @returns A function that takes a callback to execute once all animations have finished, and an optional AbortSignal to abort the callback\n */\nexport function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false) {\n const frame = useAnimationFrame();\n return useStableCallback((fnToExecute,\n /**\n * An optional [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that\n * can be used to abort `fnToExecute` before all the animations have finished.\n * @default null\n */\n signal = null) => {\n frame.cancel();\n const element = resolveRef(elementOrRef);\n if (element == null) {\n return;\n }\n const resolvedElement = element;\n const done = () => {\n // Synchronously flush the unmounting of the component so that the browser doesn't\n // paint: https://github.com/mui/base-ui/issues/979\n ReactDOM.flushSync(fnToExecute);\n };\n if (typeof resolvedElement.getAnimations !== 'function' || globalThis.BASE_UI_ANIMATIONS_DISABLED) {\n fnToExecute();\n return;\n }\n function exec() {\n Promise.all(resolvedElement.getAnimations().map(animation => animation.finished)).then(() => {\n if (!signal?.aborted) {\n done();\n }\n }, () => {\n if (signal?.aborted) {\n return;\n }\n const currentAnimations = resolvedElement.getAnimations();\n if (currentAnimations.some(animation => animation.pending || animation.playState !== 'finished')) {\n // Sometimes animations can be aborted because a property they depend on changes while the animation plays.\n // In such cases, we need to re-check if any new animations have started.\n exec();\n return;\n }\n done();\n });\n }\n if (waitForStartingStyleRemoved) {\n const startingStyleAttribute = 'data-starting-style';\n\n // If `[data-starting-style]` isn't present, fall back to waiting one more frame\n // to give \"open\" animations a chance to be registered.\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n frame.request(exec);\n return;\n }\n\n // Wait for `[data-starting-style]` to have been removed.\n const attributeObserver = new MutationObserver(() => {\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n attributeObserver.disconnect();\n exec();\n }\n });\n attributeObserver.observe(resolvedElement, {\n attributes: true,\n attributeFilter: [startingStyleAttribute]\n });\n signal?.addEventListener('abort', () => attributeObserver.disconnect(), {\n once: true\n });\n return;\n }\n frame.request(exec);\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useAnimationsFinished } from \"./useAnimationsFinished.mjs\";\n\n/**\n * Calls the provided function when the CSS open/close animation or transition completes.\n */\nexport function useOpenChangeComplete(parameters) {\n const {\n enabled = true,\n open,\n ref,\n onComplete: onCompleteParam\n } = parameters;\n const onComplete = useStableCallback(onCompleteParam);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, open);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n const abortController = new AbortController();\n runOnceAnimationsFinish(onComplete, abortController.signal);\n return () => {\n abortController.abort();\n };\n }, [enabled, open, onComplete, runOnceAnimationsFinish]);\n}","'use client';\n\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { warn } from '@base-ui/utils/warn';\nimport { ownerWindow } from '@base-ui/utils/owner';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useAnimationsFinished } from \"../../internals/useAnimationsFinished.mjs\";\nimport { CollapsiblePanelDataAttributes } from \"./CollapsiblePanelDataAttributes.mjs\";\nconst EMPTY_DIMENSIONS = {\n height: undefined,\n width: undefined\n};\nexport function useCollapsiblePanel(parameters) {\n const {\n externalRef,\n hiddenUntilFound,\n id: idParam,\n keepMounted,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setOpen,\n transitionStatus\n } = parameters;\n const panelRef = React.useRef(null);\n const animationTypeRef = React.useRef(null);\n const [dimensions, setDimensionsUnwrapped] = React.useState(EMPTY_DIMENSIONS);\n const lastMeasuredDimensionsRef = React.useRef(EMPTY_DIMENSIONS);\n // `beforematch` should reveal the matched content immediately, so the next\n // open cycle skips author-defined motion once and then returns to normal.\n const shouldSkipNextOpenRef = React.useRef(false);\n // Keyframe mount animations on initially open panels cause a visible layout\n // shift during the server-rendered first paint, so suppress that first open\n // lifecycle until the panel has been closed once.\n const shouldPreventMountAnimationRef = React.useRef(open);\n // React.Activity tears down Effects while preserving state, so revealing an\n // already-open panel would otherwise replay its CSS keyframe open animation.\n const shouldPreventActivityResumeAnimationRef = React.useRef(false);\n // Some open paths intentionally bypass motion, but the shared root transition\n // status still advances asynchronously. Override the panel to idle so its data\n // attributes and dimension cleanup reflect the immediate open state.\n const [forcePanelIdle, setForcePanelIdle] = React.useState(false);\n const pendingTemporaryStyleRestoreRef = React.useRef(null);\n const mergedPanelRef = useMergedRefs(externalRef, panelRef);\n const latestOpenRef = useValueAsRef(open);\n // Only used to handle panel close\n const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef);\n const hidden = !open && !mounted;\n const panelTransitionStatus = forcePanelIdle ? 'idle' : transitionStatus;\n const shouldPreventOpenAnimation = open && (\n // These 2 refs are safe to read in render, they are only written from committed\n // layout/effect paths and gate one-shot motion suppression for the next open\n // lifecycle. They intentionally expose the last committed motion snapshot.\n shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current);\n const renderedDimensions = !open && mounted &&\n // These 2 refs are also safe to read in render, both hold the last committed\n // animation mode and measurement. This fallback only restores a previously\n // measured pixel size after the live dimensions state has been reset back to `auto`.\n animationTypeRef.current === 'css-animation' && dimensions.height === undefined && dimensions.width === undefined ? lastMeasuredDimensionsRef.current : dimensions;\n const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== 'css-animation';\n\n // Most measured dimensions are reused later when CSS keyframe closes need a\n // pixel size after the rendered dimensions have been reset back to `auto`.\n // Passing `false` is only for clearing the current dimensions state.\n const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => {\n if (shouldCacheMeasurement) {\n lastMeasuredDimensionsRef.current = nextDimensions;\n }\n setDimensionsUnwrapped(nextDimensions);\n });\n const restorePendingTemporaryStyle = useStableCallback(() => {\n pendingTemporaryStyleRestoreRef.current?.();\n pendingTemporaryStyleRestoreRef.current = null;\n });\n const setPendingTemporaryStyleRestore = useStableCallback(restore => {\n restorePendingTemporaryStyle();\n pendingTemporaryStyleRestoreRef.current = () => {\n pendingTemporaryStyleRestoreRef.current = null;\n restore();\n };\n });\n\n // React.Activity unmounts Effects while preserving component state. If that\n // teardown happens while an already-open keyframe panel is visible, remember\n // to suppress the replayed open animation on the next committed reveal.\n const markActivityResumeAnimationSuppressed = useStableCallback(() => {\n if (open && mounted && animationTypeRef.current === 'css-animation') {\n shouldPreventActivityResumeAnimationRef.current = true;\n }\n });\n useIsoLayoutEffect(() => {\n // `forcePanelIdle` is only a temporary override for open paths that skip\n // motion. Keep it active while the shared root still reports `starting`,\n // then drop it once the root transition state catches up.\n if (!forcePanelIdle || transitionStatus === 'starting') {\n return;\n }\n setForcePanelIdle(false);\n }, [forcePanelIdle, transitionStatus]);\n React.useEffect(() => {\n return () => {\n markActivityResumeAnimationSuppressed();\n restorePendingTemporaryStyle();\n };\n }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]);\n useIsoLayoutEffect(() => {\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n\n // `beforematch` can temporarily force a `0s` motion duration so the matched\n // content reveals immediately. Restore the authored duration before detecting\n // the next close animation type, otherwise that first close is misread as\n // \"no motion\" and the close transition or keyframe gets skipped.\n if (!open && pendingTemporaryStyleRestoreRef.current) {\n restorePendingTemporaryStyle();\n }\n const animationType = getAnimationType(panel, shouldPreventOpenAnimation);\n animationTypeRef.current = animationType;\n\n // Initially open keyframe panels skip their first paint animation to avoid\n // layout shift, but we still need to cache the expanded size so the first\n // close animation can start from pixels instead of `auto`.\n if (open && transitionStatus === 'idle' && shouldPreventMountAnimationRef.current && animationType === 'css-animation') {\n lastMeasuredDimensionsRef.current = getDimensions(panel);\n return undefined;\n }\n\n // Handle the opening pass: measure the expanded size and, when necessary,\n // neutralize author-defined motion so the panel can open immediately.\n if (open && transitionStatus === 'starting') {\n // `beforematch` opens should reveal the panel immediately so find-in-page\n // does not wait for the author-defined transition or animation to finish.\n const skipNextOpen = shouldSkipNextOpenRef.current;\n shouldSkipNextOpenRef.current = false;\n if (animationType === 'none') {\n setDimensions(getDimensions(panel));\n setForcePanelIdle(true);\n return undefined;\n }\n if (animationType === 'css-transition') {\n const restoreLayoutStyles = resetLayoutStyles(panel);\n setDimensions(getDimensions(panel));\n if (!skipNextOpen) {\n return restoreLayoutStyles;\n }\n const restoreTransitionDuration = setTemporaryStyle(panel, 'transition-duration', '0s');\n setPendingTemporaryStyleRestore(restoreTransitionDuration);\n setForcePanelIdle(true);\n return restoreLayoutStyles;\n }\n setDimensions(getDimensions(panel));\n const restoreAnimationName = setTemporaryStyle(panel, 'animation-name', 'none');\n if (!skipNextOpen) {\n restoreAnimationName();\n return undefined;\n }\n const restoreAnimationDuration = setTemporaryStyle(panel, 'animation-duration', '0s');\n restoreAnimationName();\n setPendingTemporaryStyleRestore(restoreAnimationDuration);\n setForcePanelIdle(true);\n return undefined;\n }\n\n // Capture the current size as soon as close is requested, before the\n // deferred ending phase applies closed styles. This keeps close transitions\n // starting from a measured pixel value, including interrupted opens.\n if (!open && mounted && (transitionStatus === 'idle' || transitionStatus === 'starting')) {\n shouldPreventMountAnimationRef.current = false;\n shouldPreventActivityResumeAnimationRef.current = false;\n if (animationType === 'none') {\n setDimensions(EMPTY_DIMENSIONS, false);\n setMounted(false);\n return undefined;\n }\n setDimensions(getDimensions(panel));\n return undefined;\n }\n if (transitionStatus !== 'ending') {\n return undefined;\n }\n\n // Reachable when `transitionStatus` already flipped to `ending` before this effect ran, so\n // the close branch above was skipped. Without motion there is nothing to wait for, so unmount\n // here instead of deferring to the animation-finished path below.\n if (animationType === 'none') {\n setMounted(false);\n return undefined;\n }\n const nextDimensions = getDimensions(panel);\n const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0;\n if (!hasMeasuredSize) {\n setMounted(false);\n return undefined;\n }\n setDimensions(nextDimensions);\n if (animationType === 'css-animation') {\n const restoreAnimationName = setTemporaryStyle(panel, 'animation-name', 'none');\n restoreAnimationName();\n }\n return undefined;\n }, [mounted, open, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]);\n useOpenChangeComplete({\n enabled: open && mounted && panelTransitionStatus === 'idle',\n open: true,\n ref: panelRef,\n onComplete() {\n // `useOpenChangeComplete` only aborts from its effect cleanup, which React runs in the\n // post-paint passive flush. An animation's `finished` microtask can resolve after the render\n // that set `open` to `false` but before that cleanup, so re-check the latest value here.\n // Clearing the measured size in that window would make the close transition start from\n // `height: 0` instead of the expanded pixel height.\n if (!open) {\n return;\n }\n setDimensions(EMPTY_DIMENSIONS, false);\n }\n });\n\n // Closing panels need extra sequencing beyond `useOpenChangeComplete`.\n // This passive effect runs after the `ending` render has committed, so\n // `[data-ending-style]` is already present. Chrome can still register the\n // exit transition one frame later when an Accordion closes one item while\n // opening another, so wait one frame before watching animations.\n // See https://github.com/mui/base-ui/issues/3099\n React.useEffect(() => {\n if (open || !mounted || panelTransitionStatus !== 'ending') {\n return undefined;\n }\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n const abortController = new AbortController();\n let endingStyleFrame = -1;\n function handleComplete() {\n // Same post-paint race as the `useOpenChangeComplete` callback above, except `open` is\n // captured by this effect's closure and always `false` here, so read the latest value from\n // a ref. Unmounting a panel that has already reopened would drop it from the DOM.\n if (latestOpenRef.current) {\n return;\n }\n setMounted(false);\n setDimensions(EMPTY_DIMENSIONS, false);\n }\n endingStyleFrame = AnimationFrame.request(() => {\n runOnceCloseAnimationsFinish(handleComplete, abortController.signal);\n });\n return () => {\n AnimationFrame.cancel(endingStyleFrame);\n abortController.abort();\n };\n }, [latestOpenRef, mounted, open, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]);\n useIsoLayoutEffect(() => {\n const panel = panelRef.current;\n if (!panel || !hiddenUntilFound || !hidden) {\n return;\n }\n\n // React only supports a boolean for the `hidden` attribute and forces\n // legit string values to booleans so we have to force it back in the DOM\n // when necessary: https://github.com/react/react/issues/24740\n panel.setAttribute('hidden', 'until-found');\n }, [hidden, hiddenUntilFound]);\n React.useEffect(function registerBeforeMatchListener() {\n const panel = panelRef.current;\n if (!panel) {\n return undefined;\n }\n function handleBeforeMatch(event) {\n const eventDetails = createChangeEventDetails(REASONS.none, event);\n onOpenChange(true, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n shouldSkipNextOpenRef.current = true;\n setOpen(true);\n }\n return addEventListener(panel, 'beforematch', handleBeforeMatch);\n }, [onOpenChange, setOpen]);\n const shouldRender = keepMounted || hiddenUntilFound || mounted || open;\n return {\n height: renderedDimensions.height,\n props: {\n ...(shouldPersistHiddenTransitionStyles ? {\n [CollapsiblePanelDataAttributes.startingStyle]: ''\n } : undefined),\n hidden,\n id: idParam\n },\n ref: mergedPanelRef,\n shouldPreventOpenAnimation,\n shouldRender,\n transitionStatus: panelTransitionStatus,\n width: renderedDimensions.width\n };\n}\nfunction getDimensions(element) {\n return {\n height: element.scrollHeight,\n width: element.scrollWidth\n };\n}\nfunction getAnimationType(element, hasSuppressedMountAnimation) {\n const panelStyles = ownerWindow(element).getComputedStyle(element);\n const hasAnimation = (panelStyles.animationName.split(',').map(name => name.trim()).some(name => name !== '' && name !== 'none') || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration);\n const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration);\n if (hasAnimation && hasTransition) {\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n warn('CSS transitions and CSS animations both detected on Collapsible or Accordion panel.', 'Only one of either animation type should be used.');\n }\n return 'css-transition';\n }\n if (hasTransition) {\n return 'css-transition';\n }\n if (hasAnimation) {\n return 'css-animation';\n }\n return 'none';\n}\nfunction hasNonZeroDuration(value) {\n return value.split(',').map(part => part.trim()).some(part => part !== '' && Number.parseFloat(part) > 0);\n}\n\n/**\n * Temporarily overrides an inline style property and returns a cleanup that\n * restores the previous inline value and priority.\n * @param element - The element whose inline style should be updated.\n * @param property - The CSS property name to override.\n * @param value - The temporary value to assign.\n * @returns A cleanup function that restores the original inline style state.\n */\nfunction setTemporaryStyle(element, property, value) {\n const previousValue = element.style.getPropertyValue(property);\n const previousPriority = element.style.getPropertyPriority(property);\n element.style.setProperty(property, value);\n return () => {\n if (previousValue === '') {\n element.style.removeProperty(property);\n return;\n }\n element.style.setProperty(property, previousValue, previousPriority);\n };\n}\n\n/**\n * Temporarily resets inline alignment styles that can distort scroll-based\n * size measurements, then restores them on the next animation frame.\n * @param element - The panel element being measured.\n * @returns A cleanup function that cancels the scheduled restore and reapplies\n * the original inline layout styles immediately.\n */\nfunction resetLayoutStyles(element) {\n const originalLayoutStyles = {\n 'justify-content': element.style.justifyContent,\n 'align-items': element.style.alignItems,\n 'align-content': element.style.alignContent,\n 'justify-items': element.style.justifyItems\n };\n Object.keys(originalLayoutStyles).forEach(key => {\n element.style.setProperty(key, 'initial', 'important');\n });\n function restoreLayoutStyles() {\n Object.entries(originalLayoutStyles).forEach(([key, value]) => {\n if (value === '') {\n element.style.removeProperty(key);\n return;\n }\n element.style.setProperty(key, value);\n });\n }\n const frame = AnimationFrame.request(restoreLayoutStyles);\n return () => {\n AnimationFrame.cancel(frame);\n restoreLayoutStyles();\n };\n}","export let CollapsiblePanelCssVars = /*#__PURE__*/function (CollapsiblePanelCssVars) {\n /**\n * The collapsible panel's height.\n * @type {number}\n */\n CollapsiblePanelCssVars[\"collapsiblePanelHeight\"] = \"--collapsible-panel-height\";\n /**\n * The collapsible panel's width.\n * @type {number}\n */\n CollapsiblePanelCssVars[\"collapsiblePanelWidth\"] = \"--collapsible-panel-width\";\n return CollapsiblePanelCssVars;\n}({});","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { warn } from '@base-ui/utils/warn';\nimport { resolveStyle } from \"../../utils/resolveStyle.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCollapsibleRootContext } from \"../root/CollapsibleRootContext.mjs\";\nimport { collapsibleStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useCollapsiblePanel } from \"./useCollapsiblePanel.mjs\";\nimport { CollapsiblePanelCssVars } from \"./CollapsiblePanelCssVars.mjs\";\n/**\n * A panel with the collapsible contents.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)\n */\nexport const CollapsiblePanel = /*#__PURE__*/React.forwardRef(function CollapsiblePanel(componentProps, forwardedRef) {\n const {\n className,\n hiddenUntilFound: hiddenUntilFoundProp,\n keepMounted: keepMountedProp,\n render,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n\n /* istanbul ignore else -- `process.env.NODE_ENV` is a build-time constant under test */\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hiddenUntilFoundProp && keepMountedProp === false) {\n warn('The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.');\n }\n }, [hiddenUntilFoundProp, keepMountedProp]);\n }\n const {\n defaultPanelId,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setPanelIdState,\n setOpen,\n state,\n transitionStatus\n } = useCollapsibleRootContext();\n const hiddenUntilFound = hiddenUntilFoundProp ?? false;\n const keepMounted = keepMountedProp ?? false;\n const registeredId = idProp || undefined;\n const id = registeredId ?? defaultPanelId;\n useIsoLayoutEffect(() => {\n setPanelIdState(currentId => registeredId ?? (currentId === null ? undefined : currentId));\n return () => {\n setPanelIdState(currentId => currentId === registeredId ? null : currentId);\n };\n }, [registeredId, setPanelIdState]);\n const {\n height,\n props,\n ref,\n shouldPreventOpenAnimation,\n shouldRender,\n transitionStatus: panelTransitionStatus,\n width\n } = useCollapsiblePanel({\n externalRef: forwardedRef,\n hiddenUntilFound,\n id,\n keepMounted,\n mounted,\n onOpenChange,\n open,\n setMounted,\n setOpen,\n transitionStatus\n });\n const panelState = {\n ...state,\n transitionStatus: panelTransitionStatus\n };\n const resolvedStyle = resolveStyle(style, panelState);\n const element = useRenderElement('div', {\n ...componentProps,\n style: undefined\n }, {\n state: panelState,\n ref,\n props: [props, {\n style: {\n [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === undefined ? 'auto' : `${height}px`,\n [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === undefined ? 'auto' : `${width}px`\n }\n }, elementProps, resolvedStyle ? {\n style: resolvedStyle\n } : undefined,\n // Resolve the public `style` prop so temporary `animationName: 'none'`\n // can still win after user's inline styles have been merged.\n shouldPreventOpenAnimation ? {\n style: {\n animationName: 'none'\n }\n } : undefined],\n stateAttributesMapping: collapsibleStateAttributesMapping\n });\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") CollapsiblePanel.displayName = \"CollapsiblePanel\";","/**\n * Reads `navigator.userAgent` / `navigator.platform` (legacy but universally\n * supported) into a normalized shape. In development, prefers the modern\n * `navigator.userAgentData` API on Chromium to avoid DevTools warnings about\n * the deprecated reads; that branch is dead-code-eliminated in production\n * builds to keep the bundle small.\n *\n * Returns empty/zero values when `navigator` is undefined (SSR), so every\n * derived flag safely evaluates to `false`.\n */\nfunction readRawData() {\n if (typeof navigator === 'undefined') {\n return {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return {\n userAgent: uaData.brands.map(({\n brand,\n version\n }) => `${brand}/${version}`).join(' '),\n platform: uaData.platform ?? navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n }\n }\n return {\n userAgent: navigator.userAgent,\n platform: navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n}\nconst {\n userAgent,\n platform,\n maxTouchPoints\n} = readRawData();\nexport const lowerUserAgent = userAgent.toLowerCase();\nexport const lowerPlatform = platform.toLowerCase();\nexport { maxTouchPoints };","import { lowerUserAgent, lowerPlatform, maxTouchPoints } from \"./shared.mjs\";\n\n// iPadOS 13+ reports `MacIntel` for `navigator.platform`; disambiguated via\n// `maxTouchPoints` so iPad is classified as iOS, not macOS.\n// https://github.com/mui/base-ui/issues/1309\n/** iPhone, iPad (including iPadOS 13+ reporting as macOS), iPod. */\nexport const ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === 'macintel' && maxTouchPoints > 1;\n\n/** Android phones, tablets, and embedded Android browsers. */\nconst ANDROID_STRING = 'android';\nexport const android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);\n\n/** macOS desktop. Excludes iPadOS, which reports as `MacIntel`. */\nexport const mac = !ios && lowerPlatform.startsWith('mac');\n\n/** Windows desktop. */\nexport const windows = lowerPlatform.startsWith('win');\n\n/** Linux desktop (including Chrome OS). */\nexport const linux = !android && /^(linux|chrome os)/.test(lowerPlatform);\n\n/** Any Apple OS (`mac || ios`). */\nexport const apple = mac || ios;","import { lowerUserAgent } from \"./shared.mjs\";\n\n// WebKit (Safari, all iOS browsers, GNOME Web). Distinguished from Blink by\n// the legacy `-webkit-backdrop-filter` name — Blink forked from WebKit in 2013\n// and only ships the unprefixed `backdrop-filter`.\n/** WebKit: Safari, all iOS browsers, GNOME Web. Excludes Blink. */\nexport const webkit = typeof CSS !== 'undefined' && !!CSS.supports?.('-webkit-backdrop-filter:none');\n\n// Anchored to `!webkit` so engines are mutually exclusive by construction.\n// Firefox-on-iOS uses WebKit (its UA marker is `FxiOS/`, not `Firefox/`); the\n// `!webkit` prefix also defends against future iOS-browser UA changes that\n// might inject `Firefox` into a WebKit-based UA.\n/** Gecko: Firefox. */\nexport const gecko = !webkit && lowerUserAgent.includes('firefox');\n\n// All Chromium-based browsers ship `Chrome/` or `Chromium/` in their UA — both\n// share the `chrom` prefix, so a single substring check covers Chrome, Edge,\n// Opera, Brave, etc. Chrome-on-iOS uses `CriOS/` and stays WebKit. The positive\n// UA check also makes this SSR-safe — an empty UA matches nothing.\n/** Blink: Chrome, Edge, Opera, Brave, and other Chromium-based browsers. */\nexport const blink = !webkit && lowerUserAgent.includes('chrom');","import { apple } from \"./os.mjs\";\n\n// Whether a screen reader is *actually* running cannot be detected. These flags\n// identify platforms where a specific screen reader could be active. VoiceOver\n// is the system screen reader on Apple platforms and works with every browser\n// there, so the flag is purely an OS check; engine-specific quirks (e.g. the\n// NSAccessibility virtual-cursor focus path) should be gated at the call site.\n/**\n * The user *may* be using VoiceOver — actual activation is not detectable.\n * True on any Apple platform (macOS, iOS, iPadOS).\n */\nexport const voiceOver = apple;","import { lowerUserAgent } from \"./shared.mjs\";\n\n/** Running in jsdom or HappyDOM (used by unit tests). */\nexport const jsdom = /jsdom|happydom/.test(lowerUserAgent);","export const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';\nexport const ACTIVE_KEY = 'active';\nexport const SELECTED_KEY = 'selected';\nexport const TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';","import { isShadowRoot } from '@floating-ui/utils/dom';\nexport function activeElement(doc) {\n let element = doc.activeElement;\n while (element?.shadowRoot?.activeElement != null) {\n element = element.shadowRoot.activeElement;\n }\n return element;\n}\nexport function contains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n const rootNode = child.getRootNode?.();\n\n // First, attempt with the faster native method.\n if (parent.contains(child)) {\n return true;\n }\n\n // Then fall back to traversing out of shadow roots when needed.\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n while (next) {\n if (parent === next) {\n return true;\n }\n next = next.parentNode || next.host;\n }\n }\n return false;\n}\nexport function getTarget(event) {\n if ('composedPath' in event) {\n return event.composedPath()[0];\n }\n\n // TS assumes `composedPath()` always exists, but older browsers without\n // shadow DOM support still fall back to `target`.\n return event.target;\n}","import { isElement, isHTMLElement } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR } from \"./constants.mjs\";\nimport { activeElement, contains, getTarget } from \"../../internals/shadowDom.mjs\";\nexport { activeElement, contains, getTarget };\nexport function isTargetInsideEnabledTrigger(target, triggerElements) {\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n if (triggerElements.hasElement(targetElement)) {\n return !targetElement.hasAttribute('data-trigger-disabled');\n }\n for (const [, trigger] of triggerElements.entries()) {\n if (contains(trigger, targetElement)) {\n return !trigger.hasAttribute('data-trigger-disabled');\n }\n }\n return false;\n}\nexport function isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const eventAgain = event;\n return eventAgain.target != null && node.contains(eventAgain.target);\n}\nexport function isRootElement(element) {\n return element.matches('html,body');\n}\nexport function isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nexport function isInteractiveElement(element) {\n return element?.closest(`button,a[href],[role=\"button\"],select,[tabindex]:not([tabindex=\"-1\"]),${TYPEABLE_SELECTOR}`) != null;\n}\nexport function isTypeableCombobox(element) {\n if (!element) {\n return false;\n }\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nexport function matchesFocusVisible(element) {\n // We don't want to block focus from working with `visibleOnly`\n // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n if (!element || platform.env.jsdom) {\n return true;\n }\n try {\n return element.matches(':focus-visible');\n } catch (_e) {\n return true;\n }\n}\nexport function getFloatingFocusElement(floatingElement) {\n if (!floatingElement) {\n return null;\n }\n // Try to find the element that has `{...getFloatingProps()}` spread on it.\n // This indicates the floating element is acting as a positioning wrapper, and\n // so focus should be managed on the child element with the event handlers and\n // aria props.\n return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;\n}","/* eslint-disable @typescript-eslint/no-loop-func */\n\nexport function getNodeChildren(nodes, id, onlyOpenChildren = true) {\n const directChildren = nodes.filter(node => node.parentId === id);\n return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nexport function getDeepestNode(nodes, id) {\n let deepestNodeId;\n let maxDepth = -1;\n function findDeepest(nodeId, depth) {\n if (depth > maxDepth) {\n deepestNodeId = nodeId;\n maxDepth = depth;\n }\n const children = getNodeChildren(nodes, nodeId);\n children.forEach(child => {\n findDeepest(child.id, depth + 1);\n });\n }\n findDeepest(id, 0);\n return nodes.find(node => node.id === deepestNodeId);\n}\nexport function getNodeAncestors(nodes, id) {\n let allAncestors = [];\n let currentParentId = nodes.find(node => node.id === id)?.parentId;\n while (currentParentId) {\n const currentNode = nodes.find(node => node.id === currentParentId);\n currentParentId = currentNode?.parentId;\n if (currentNode) {\n allAncestors = allAncestors.concat(currentNode);\n }\n }\n return allAncestors;\n}","import { platform } from '@base-ui/utils/platform';\nexport function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nexport function isReactEvent(event) {\n return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts\nexport function isVirtualClick(event) {\n if (event.pointerType === '' && event.isTrusted) {\n return true;\n }\n if (platform.os.android && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nexport function isVirtualPointerEvent(event) {\n if (platform.env.jsdom) {\n return false;\n }\n return !platform.os.android && event.width === 0 && event.height === 0 || platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nexport function isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nexport function isClickLikeEvent(event) {\n const type = event.type;\n return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';\n}","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n const firstChar = placement[0];\n return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n const side = getSide(placement);\n return oppositeSideMap[side] + placement.slice(side.length);\n}\nfunction expandPaddingObject(padding) {\n var _padding$top, _padding$right, _padding$bottom, _padding$left;\n return {\n top: (_padding$top = padding.top) != null ? _padding$top : 0,\n right: (_padding$right = padding.right) != null ? _padding$right : 0,\n bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,\n left: (_padding$left = padding.left) != null ? _padding$left : 0\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = el.closest('[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}","import { getComputedStyle, getNodeName, isHTMLElement, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { activeElement, contains } from \"./element.mjs\";\nimport { isElementVisible } from \"./composite.mjs\";\nconst CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]';\nfunction getParentElement(element) {\n const assignedSlot = element.assignedSlot;\n if (assignedSlot) {\n return assignedSlot;\n }\n if (element.parentElement) {\n return element.parentElement;\n }\n const rootNode = element.getRootNode();\n return isShadowRoot(rootNode) ? rootNode.host : null;\n}\nfunction getDetailsSummary(details) {\n for (const child of Array.from(details.children)) {\n if (getNodeName(child) === 'summary') {\n return child;\n }\n }\n return null;\n}\nfunction isWithinOpenDetailsSummary(element, details) {\n const summary = getDetailsSummary(details);\n return !!summary && (element === summary || contains(summary, element));\n}\nfunction isFocusableCandidate(element) {\n const nodeName = element ? getNodeName(element) : '';\n return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');\n}\nfunction isFocusableElement(element) {\n if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {\n return false;\n }\n for (let current = element; current; current = getParentElement(current)) {\n const isAncestor = current !== element;\n const isSlot = getNodeName(current) === 'slot';\n if (current.hasAttribute('inert')) {\n return false;\n }\n if (isAncestor && getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {\n return false;\n }\n }\n return true;\n}\nfunction isVisibleInTabbableTree(element, isAncestor) {\n const styles = getComputedStyle(element);\n if (!isAncestor) {\n return isElementVisible(element, styles);\n }\n return styles.display !== 'none';\n}\nfunction getTabIndex(element) {\n const tabIndex = element.tabIndex;\n if (tabIndex < 0) {\n const nodeName = getNodeName(element);\n if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || isHTMLElement(element) && element.isContentEditable) {\n return 0;\n }\n }\n return tabIndex;\n}\nfunction getNamedRadioInput(element) {\n if (getNodeName(element) !== 'input') {\n return null;\n }\n const input = element;\n return input.type === 'radio' && input.name !== '' ? input : null;\n}\nfunction isTabbableRadio(element, candidates) {\n const input = getNamedRadioInput(element);\n if (!input) {\n return true;\n }\n const checkedRadio = candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form && radio.checked;\n });\n if (checkedRadio) {\n return checkedRadio === input;\n }\n return candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form;\n }) === input;\n}\nfunction getComposedChildren(container) {\n if (isHTMLElement(container) && getNodeName(container) === 'slot') {\n const assignedElements = container.assignedElements({\n flatten: true\n });\n if (assignedElements.length > 0) {\n return assignedElements;\n }\n }\n if (isHTMLElement(container) && container.shadowRoot) {\n return Array.from(container.shadowRoot.children);\n }\n return Array.from(container.children);\n}\nfunction appendCandidates(container, list) {\n getComposedChildren(container).forEach(child => {\n if (isFocusableCandidate(child)) {\n list.push(child);\n }\n appendCandidates(child, list);\n });\n}\nfunction appendMatchingElements(container, selector, list) {\n getComposedChildren(container).forEach(child => {\n if (isHTMLElement(child) && child.matches(selector)) {\n list.push(child);\n }\n appendMatchingElements(child, selector, list);\n });\n}\nexport function isTabbable(element) {\n return isFocusableElement(element) && getTabIndex(element) >= 0;\n}\nexport function focusable(container) {\n const candidates = [];\n appendCandidates(container, candidates);\n return candidates.filter(isFocusableElement);\n}\nexport function tabbable(container) {\n const candidates = focusable(container);\n return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));\n}\nfunction getTabbableIn(container, dir) {\n const list = tabbable(container);\n const len = list.length;\n if (len === 0) {\n return undefined;\n }\n const active = activeElement(ownerDocument(container));\n const index = list.indexOf(active);\n // eslint-disable-next-line no-nested-ternary\n const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n return list[nextIndex];\n}\nexport function getNextTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;\n}\nexport function getPreviousTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction getTabbableNearElement(referenceElement, dir) {\n if (!referenceElement) {\n return null;\n }\n const list = tabbable(ownerDocument(referenceElement).body);\n const elementCount = list.length;\n if (elementCount === 0) {\n return null;\n }\n const index = list.indexOf(referenceElement);\n if (index === -1) {\n return null;\n }\n const nextIndex = (index + dir + elementCount) % elementCount;\n return list[nextIndex];\n}\nexport function getTabbableAfterElement(referenceElement) {\n return getTabbableNearElement(referenceElement, 1);\n}\nexport function getTabbableBeforeElement(referenceElement) {\n return getTabbableNearElement(referenceElement, -1);\n}\nexport function isOutsideEvent(event, container) {\n const containerElement = container || event.currentTarget;\n const relatedTarget = event.relatedTarget;\n return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nexport function disableFocusInside(container) {\n const tabbableElements = tabbable(container);\n tabbableElements.forEach(element => {\n element.dataset.tabindex = element.getAttribute('tabindex') || '';\n element.setAttribute('tabindex', '-1');\n });\n}\nexport function enableFocusInside(container) {\n const elements = [];\n appendMatchingElements(container, '[data-tabindex]', elements);\n elements.forEach(element => {\n const tabindex = element.dataset.tabindex;\n delete element.dataset.tabindex;\n if (tabindex) {\n element.setAttribute('tabindex', tabindex);\n } else {\n element.removeAttribute('tabindex');\n }\n });\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\nconst EMPTY = 0;\nexport class Timeout {\n static create() {\n return new Timeout();\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n start(delay, fn) {\n this.clear();\n this.currentId = setTimeout(() => {\n this.currentId = EMPTY;\n fn();\n }, delay); /* Node.js types are enabled in development */\n }\n isStarted() {\n return this.currentId !== EMPTY;\n }\n clear = () => {\n if (this.currentId !== EMPTY) {\n clearTimeout(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.clear;\n };\n}\n\n/**\n * A `setTimeout` with automatic cleanup and guard.\n */\nexport function useTimeout() {\n const timeout = useRefWithInit(Timeout.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { activeElement } from \"../../floating-ui-react/utils.mjs\";\n\n/**\n * The form control to label and validate.\n * Renders an `<input>` element.\n *\n * You can omit this part and use any Base UI input component instead. For example,\n * [Input](https://base-ui.com/react/components/input), [Checkbox](https://base-ui.com/react/components/checkbox),\n * or [Select](https://base-ui.com/react/components/select), among others, will work with Field out of the box.\n *\n * Documentation: [Base UI Field](https://base-ui.com/react/components/field)\n */\nexport const FieldControl = /*#__PURE__*/React.forwardRef(function FieldControl(componentProps, forwardedRef) {\n const {\n render,\n className,\n id: idProp,\n name: nameProp,\n value: valueProp,\n disabled: disabledProp = false,\n onValueChange,\n defaultValue,\n autoFocus = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n name: fieldName,\n disabled: fieldDisabled,\n setTouched,\n setDirty,\n validityData,\n setFocused,\n setFilled,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n clearErrors\n } = useFormContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const state = {\n ...fieldState,\n disabled\n };\n const {\n labelId\n } = useLabelableContext();\n const id = useLabelableId({\n id: idProp\n });\n useIsoLayoutEffect(() => {\n const hasExternalValue = valueProp != null;\n if (validation.inputRef.current?.value || hasExternalValue && valueProp !== '') {\n setFilled(true);\n } else if (hasExternalValue && valueProp === '') {\n setFilled(false);\n }\n }, [validation.inputRef, setFilled, valueProp]);\n const inputRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {\n setFocused(true);\n }\n }, [autoFocus, setFocused]);\n const [valueUnwrapped] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'FieldControl',\n state: 'value'\n });\n const isControlled = valueProp !== undefined;\n const value = isControlled ? valueUnwrapped : undefined;\n const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);\n useRegisterFieldControl(validation.inputRef, id, value, getValueFromInput, !disabled, nameProp);\n const element = useRenderElement('input', componentProps, {\n ref: [forwardedRef, inputRef],\n state,\n props: [{\n id,\n disabled,\n name,\n ref: validation.inputRef,\n 'aria-labelledby': labelId,\n autoFocus,\n ...(isControlled ? {\n value\n } : {\n defaultValue\n }),\n onChange(event) {\n const inputValue = event.currentTarget.value;\n onValueChange?.(inputValue, createChangeEventDetails(REASONS.none, event.nativeEvent));\n // `validation.change` reads `markedDirtyRef`, so update dirty before validating.\n setDirty(inputValue !== (validityData.initialValue ?? ''));\n setFilled(inputValue !== '');\n\n // Workaround for https://github.com/react/react/issues/9023\n if (!event.nativeEvent.defaultPrevented) {\n clearErrors(name);\n validation.change(inputValue);\n }\n },\n onFocus() {\n setFocused(true);\n },\n onBlur(event) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(event.currentTarget.value);\n }\n },\n onKeyDown(event) {\n if (event.currentTarget.tagName === 'INPUT' && event.key === 'Enter') {\n setTouched(true);\n validation.commit(event.currentTarget.value);\n }\n }\n }, elementProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping: fieldValidityMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") FieldControl.displayName = \"FieldControl\";","'use client';\n\nimport * as React from 'react';\nimport { Field } from \"../field/index.mjs\";\n\n/**\n * A native input element that automatically works with [Field](https://base-ui.com/react/components/field).\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI Input](https://base-ui.com/react/components/input)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const Input = /*#__PURE__*/React.forwardRef(function Input(props, forwardedRef) {\n return /*#__PURE__*/_jsx(Field.Control, {\n ref: forwardedRef,\n ...props\n });\n});\nif (process.env.NODE_ENV !== \"production\") Input.displayName = \"Input\";","'use client';\n\nimport * as React from 'react';\nexport const CompositeListContext = /*#__PURE__*/React.createContext({\n register: () => {},\n unregister: () => {},\n subscribeMapChange: () => () => {},\n nextIndexRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") CompositeListContext.displayName = \"CompositeListContext\";\nexport function useCompositeListContext() {\n return React.useContext(CompositeListContext);\n}","/* eslint-disable no-bitwise */\n'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { CompositeListContext } from \"./CompositeListContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides context for a list of items in a composite component.\n */\nexport function CompositeList(props) {\n const {\n children,\n elementsRef,\n labelsRef,\n onMapChange: onMapChangeProp\n } = props;\n const onMapChange = useStableCallback(onMapChangeProp);\n const [, setMapTick] = React.useState(false);\n const listeners = useRefWithInit(createListeners).current;\n const map = useRefWithInit(createMap).current;\n const nextIndexRef = React.useRef(0);\n const isDirtyRef = React.useRef(true);\n const itemsRef = React.useRef([]);\n const mutationObserverRef = React.useRef(null);\n\n // Item effects can run without their parent rendering. Schedule one synchronous\n // parent update for the whole commit so refs are rebuilt before paint and while\n // the originating React event is still inside `act()` in tests.\n const scheduleMapUpdate = useStableCallback(() => {\n if (isDirtyRef.current) {\n return;\n }\n isDirtyRef.current = true;\n setMapTick(tick => !tick);\n });\n const register = useStableCallback((node, registration) => {\n map.set(node, registration);\n scheduleMapUpdate();\n });\n const unregister = useStableCallback(node => {\n map.delete(node);\n scheduleMapUpdate();\n });\n const syncRefs = useStableCallback(items => {\n const nextMap = new Map();\n elementsRef.current.length = 0;\n if (labelsRef) {\n labelsRef.current.length = 0;\n }\n items.forEach(item => {\n nextMap.set(item.element, {\n ...(item.registration.metadata ?? {}),\n index: item.index\n });\n elementsRef.current[item.index] = item.element;\n if (labelsRef) {\n labelsRef.current[item.index] = item.registration.label !== undefined ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;\n }\n });\n nextIndexRef.current = elementsRef.current.length;\n return nextMap;\n });\n function observe(sortedNodes) {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n\n // A single item can't reorder.\n if (typeof MutationObserver !== 'function' || sortedNodes.length < 2) {\n return;\n }\n const mutationObserver = new MutationObserver(entries => {\n // Only verify the order after a move: a node that was removed and later\n // re-added within the same batch. Additions and removals alone can't\n // change the relative order of the remaining items, and items that mount\n // or unmount re-sort through `register`/`unregister`.\n if (!hasMovedNode(entries)) {\n return;\n }\n let previousConnectedNode = null;\n\n // If any connected node now appears before the previous connected node,\n // wrappers/items moved and the index map needs to be rebuilt.\n for (const node of sortedNodes) {\n if (!node.isConnected) {\n continue;\n }\n if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {\n mutationObserver.disconnect();\n scheduleMapUpdate();\n return;\n }\n previousConnectedNode = node;\n }\n });\n mutationObserverRef.current = mutationObserver;\n\n // A reorder that changes item indexes must invert at least one adjacent pair\n // from the previous sorted order. Observing each pair's common parent catches\n // both direct item moves and ancestor wrapper moves at the boundary.\n const roots = new Set();\n for (let i = 1; i < sortedNodes.length; i += 1) {\n const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);\n if (root) {\n roots.add(root);\n }\n }\n roots.forEach(root => mutationObserver.observe(root, {\n childList: true\n }));\n }\n const flush = useStableCallback(() => {\n const [items, automaticNodes] = getCompositeListSnapshot(map);\n const nextMap = syncRefs(items);\n observe(automaticNodes);\n itemsRef.current = items;\n isDirtyRef.current = false;\n listeners.forEach(listener => listener(nextMap));\n onMapChange(nextMap);\n });\n useIsoLayoutEffect(() => {\n // Re-copy the last committed snapshot when the ref objects change or Strict Mode replays\n // effects without reattaching callback refs.\n if (!isDirtyRef.current) {\n syncRefs(itemsRef.current);\n }\n return () => {\n elementsRef.current = [];\n if (labelsRef) {\n labelsRef.current = [];\n }\n };\n }, [elementsRef, labelsRef, syncRefs]);\n useIsoLayoutEffect(() => {\n if (isDirtyRef.current) {\n flush();\n }\n });\n useIsoLayoutEffect(() => {\n return () => {\n mutationObserverRef.current?.disconnect();\n // React 18 Strict Mode replays effects without replaying callback refs.\n // Mark the retained map dirty so the replay rebuilds refs and observation.\n isDirtyRef.current = true;\n };\n }, []);\n const subscribeMapChange = useStableCallback(fn => {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n });\n const contextValue = React.useMemo(() => ({\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n }), [register, unregister, subscribeMapChange, nextIndexRef]);\n return /*#__PURE__*/_jsx(CompositeListContext.Provider, {\n value: contextValue,\n children: children\n });\n}\nfunction createMap() {\n return new Map();\n}\nfunction createListeners() {\n return new Set();\n}\nfunction getCompositeListSnapshot(map) {\n const reservedIndices = new Set();\n const items = [];\n const automaticItems = [];\n map.forEach((registration, node) => {\n if (!node.isConnected) {\n return;\n }\n const index = registration.index;\n const item = {\n index: index ?? -1,\n element: node,\n registration\n };\n if (index === null) {\n automaticItems.push(item);\n } else if (index >= 0) {\n reservedIndices.add(index);\n items.push(item);\n }\n });\n let nextAutomaticIndex = 0;\n automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));\n automaticItems.forEach(item => {\n while (reservedIndices.has(nextAutomaticIndex)) {\n nextAutomaticIndex += 1;\n }\n item.index = nextAutomaticIndex;\n items.push(item);\n nextAutomaticIndex += 1;\n });\n if (reservedIndices.size > 0) {\n items.sort((a, b) => a.index - b.index);\n }\n return [items, automaticItems.map(item => item.element)];\n}\nfunction getCommonAncestor(firstNode, lastNode) {\n let ancestor = firstNode.parentElement;\n\n // The `parentElement` walk cannot cross shadow boundaries, so the native\n // `contains` is sufficient here.\n while (ancestor && !ancestor.contains(lastNode)) {\n ancestor = ancestor.parentElement;\n }\n return ancestor;\n}\nfunction hasMovedNode(entries) {\n for (const entry of entries) {\n for (let i = 0; i < entry.removedNodes.length; i += 1) {\n if (entry.removedNodes[i].isConnected) {\n return true;\n }\n }\n }\n return false;\n}\nfunction sortByDocumentPosition(a, b) {\n // `DOCUMENT_POSITION_CONTAINED_BY` is always reported alongside `FOLLOWING`, and `CONTAINS`\n // alongside `PRECEDING`, so testing `FOLLOWING` alone orders siblings and nested items alike.\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\n/**\n * @internal\n */\nexport const TabsRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") TabsRootContext.displayName = \"TabsRootContext\";\nexport function useTabsRootContext() {\n const context = React.useContext(TabsRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.' : _formatErrorMessage(64));\n }\n return context;\n}","export const tabsStateAttributesMapping = {\n tabActivationDirection: dir => ({\n 'data-activation-direction': dir\n })\n};","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { TabsRootContext } from \"./TabsRootContext.mjs\";\nimport { tabsStateAttributesMapping } from \"./stateAttributesMapping.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * Groups the tabs and the corresponding panels.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const TabsRoot = /*#__PURE__*/React.forwardRef(function TabsRoot(componentProps, forwardedRef) {\n const {\n className,\n defaultValue: defaultValueProp = 0,\n onValueChange: onValueChangeProp,\n orientation = 'horizontal',\n render,\n value: valueProp,\n style,\n ...elementProps\n } = componentProps;\n\n // Track whether the user explicitly provided a defined `defaultValue` prop.\n // Used to determine if we should honor a disabled tab selection.\n const hasExplicitDefaultValueProp = componentProps.defaultValue !== undefined;\n const tabPanelRefs = React.useRef([]);\n const [mountedTabPanels, setMountedTabPanels] = React.useState(() => new Map());\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValueProp,\n name: 'Tabs',\n state: 'value'\n });\n const isControlled = valueProp !== undefined;\n const [tabMap, setTabMap] = React.useState(() => new Map());\n const lastKnownTabElementRef = React.useRef(undefined);\n\n // Used for activation direction detection via tab element positions.\n const getTabElementBySelectedValue = React.useCallback(selectedValue => findTabElement(tabMap, selectedValue), [tabMap]);\n const [activationDirectionState, setActivationDirectionState] = React.useState(() => ({\n previousValue: value,\n tabActivationDirection: 'none'\n }));\n const {\n previousValue,\n tabActivationDirection: committedTabActivationDirection\n } = activationDirectionState;\n let tabActivationDirection = committedTabActivationDirection;\n let directionComputationIncomplete = false;\n\n // Compute activation direction during render when value changes so children see\n // the correct direction on their very first render after the selection update.\n // The previous value snapshot is stored in state and synced after commit.\n // https://github.com/mui/base-ui/issues/3873\n if (previousValue !== value) {\n tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);\n\n // When a new tab is added and selected in the same controlled update,\n // the tab element may not yet be registered in tabMap, so direction was\n // computed from a value-based fallback. Keep the previous value snapshot\n // stale so we re-compute from DOM positions once tabMap is up to date.\n directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;\n }\n const nextPreviousValue = directionComputationIncomplete ? previousValue : value;\n const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;\n useIsoLayoutEffect(() => {\n if (!shouldSyncActivationDirectionState) {\n return;\n }\n setActivationDirectionState({\n previousValue: nextPreviousValue,\n tabActivationDirection\n });\n }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]);\n const onValueChange = useStableCallback((newValue, eventDetails) => {\n const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);\n eventDetails.activationDirection = activationDirection;\n onValueChangeProp?.(newValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValue(newValue);\n });\n const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {\n onValueChangeProp?.(nextValue, createChangeEventDetails(reason, undefined, undefined, {\n activationDirection: 'none'\n }));\n });\n const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {\n setMountedTabPanels(prev => {\n const next = new Map(prev);\n next.set(panelValue, panelId);\n return next;\n });\n return () => {\n setMountedTabPanels(prev => {\n // Another panel with the same value took ownership in the meantime;\n // leave its registration in place.\n if (prev.get(panelValue) !== panelId) {\n return prev;\n }\n const next = new Map(prev);\n next.delete(panelValue);\n return next;\n });\n };\n });\n\n // get the `id` attribute of <Tabs.Panel> to set as the value of `aria-controls` on <Tabs.Tab>\n const getTabPanelIdByValue = React.useCallback(tabValue => {\n return mountedTabPanels.get(tabValue);\n }, [mountedTabPanels]);\n\n // get the `id` attribute of <Tabs.Tab> to set as the value of `aria-labelledby` on <Tabs.Panel>\n const getTabIdByPanelValue = React.useCallback(tabPanelValue => {\n for (const tabMetadata of tabMap.values()) {\n if (tabPanelValue === tabMetadata.value) {\n return tabMetadata.id;\n }\n }\n return undefined;\n }, [tabMap]);\n const tabsContextValue = React.useMemo(() => ({\n getTabElementBySelectedValue,\n getTabIdByPanelValue,\n getTabPanelIdByValue,\n onValueChange,\n orientation,\n registerMountedTabPanel,\n setTabMap,\n tabActivationDirection,\n value\n }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, tabActivationDirection, value]);\n const selectedTabMetadata = React.useMemo(() => {\n for (const tabMetadata of tabMap.values()) {\n if (tabMetadata.value === value) {\n return tabMetadata;\n }\n }\n return undefined;\n }, [tabMap, value]);\n\n // Find the first non-disabled tab value.\n // Used as a fallback when the current selection is disabled or missing.\n const firstEnabledTabValue = React.useMemo(() => {\n for (const tabMetadata of tabMap.values()) {\n if (!tabMetadata.disabled) {\n return tabMetadata.value;\n }\n }\n return undefined;\n }, [tabMap]);\n\n // Implicit uncontrolled selections are still automatic changes, so notify\n // once when the tabs first register. Explicit defaults are treated as user-owned.\n const shouldNotifyInitialValueChangeRef = React.useRef(!hasExplicitDefaultValueProp);\n // useControlled warns if defaultValue changes after mount, but the\n // disabled-default honor policy below still needs a stable initial value.\n const initialDefaultValueRef = React.useRef(defaultValueProp);\n // An explicit defaultValue can intentionally point at a disabled tab on mount.\n // Once that selection becomes valid, later disabled states should fall back.\n const shouldHonorDisabledDefaultValueRef = React.useRef(hasExplicitDefaultValueProp);\n const didRegisterTabsRef = React.useRef(false);\n\n // Uncontrolled roots own automatic fallback. Controlled roots keep the exact\n // value supplied by the parent, even when that tab is disabled or missing.\n useIsoLayoutEffect(() => {\n if (isControlled) {\n return;\n }\n function commitAutomaticValueChange(fallbackValue, fallbackReason) {\n setValue(fallbackValue);\n // Automatic fallbacks are not directional transitions; reset the direction\n // alongside the value so the batched commit keeps both in sync.\n setActivationDirectionState({\n previousValue: fallbackValue,\n tabActivationDirection: 'none'\n });\n notifyAutomaticValueChange(fallbackValue, fallbackReason);\n // Mark the initial notification as delivered only after the consumer\n // callback returns. The fallback value is queued first so automatic\n // consistency updates are not cancelable through a throwing handler.\n shouldNotifyInitialValueChangeRef.current = false;\n }\n if (tabMap.size === 0) {\n // A Suspense boundary outside the root can clean up layout effects while\n // keeping the previous tabs connected. Don't treat that as removal.\n if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) {\n commitAutomaticValueChange(null, REASONS.missing);\n }\n return;\n }\n didRegisterTabsRef.current = true;\n lastKnownTabElementRef.current = tabMap.keys().next().value;\n const selectionIsDisabled = selectedTabMetadata?.disabled;\n const selectionIsMissing = selectedTabMetadata == null && value !== null;\n if (!selectionIsDisabled && value === initialDefaultValueRef.current) {\n shouldHonorDisabledDefaultValueRef.current = false;\n }\n if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) {\n return;\n }\n const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;\n if (selectionIsDisabled || selectionIsMissing) {\n const fallbackValue = firstEnabledTabValue ?? null;\n if (value === fallbackValue) {\n // Already at the fallback value; no commit or notification needed,\n // but record that the implicit-initial transition has resolved.\n shouldNotifyInitialValueChangeRef.current = false;\n return;\n }\n let fallbackReason = REASONS.missing;\n if (shouldNotifyInitialValueChange) {\n fallbackReason = REASONS.initial;\n } else if (selectionIsDisabled) {\n fallbackReason = REASONS.disabled;\n }\n commitAutomaticValueChange(fallbackValue, fallbackReason);\n return;\n }\n if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {\n notifyAutomaticValueChange(value, REASONS.initial);\n shouldNotifyInitialValueChangeRef.current = false;\n }\n }, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]);\n const state = {\n orientation,\n tabActivationDirection\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: elementProps,\n stateAttributesMapping: tabsStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(TabsRootContext.Provider, {\n value: tabsContextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: tabPanelRefs,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") TabsRoot.displayName = \"TabsRoot\";\nfunction findTabElement(tabMap, value) {\n for (const [tabElement, tabMetadata] of tabMap.entries()) {\n if (value === tabMetadata.value) {\n return tabElement;\n }\n }\n return null;\n}\nfunction computeActivationDirection(oldValue, newValue, orientation, tabMap) {\n if (oldValue == null || newValue == null) {\n return 'none';\n }\n const [positionProp, backward, forward] = orientation === 'horizontal' ? ['left', 'left', 'right'] : ['top', 'up', 'down'];\n const oldTab = findTabElement(tabMap, oldValue);\n const newTab = findTabElement(tabMap, newValue);\n if (oldTab == null || newTab == null) {\n // Fallback for dynamic tabs: when a tab element isn't registered yet\n // (e.g. added and selected in the same update), infer direction from\n // the values themselves. Works for comparable types (numbers, strings).\n if (oldTab !== newTab && (typeof oldValue === 'number' || typeof oldValue === 'string') && typeof oldValue === typeof newValue) {\n return newValue > oldValue ? forward : backward;\n }\n return 'none';\n }\n const oldPosition = oldTab.getBoundingClientRect()[positionProp];\n const newPosition = newTab.getBoundingClientRect()[positionProp];\n if (newPosition < oldPosition) {\n return backward;\n }\n if (newPosition > oldPosition) {\n return forward;\n }\n return 'none';\n}","export const ACTIVE_COMPOSITE_ITEM = 'data-composite-item-active';","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useCompositeListContext } from \"./CompositeListContext.mjs\";\n/**\n * Used to register a list item and its index (DOM position) in the `CompositeList`.\n */\nexport function useCompositeListItem(params = {}) {\n const {\n guess,\n label,\n metadata,\n textRef,\n index: externalIndex\n } = params;\n const {\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n } = useCompositeListContext();\n\n // Guess the index from the render order. This avoids a re-render after mount for\n // flat lists rendered in DOM order; when the guess is wrong (grouped or out-of-order\n // rendering), the commit flush corrects it before paint.\n const indexRef = React.useRef(-1);\n const [internalIndex, setInternalIndex] = React.useState(externalIndex == null && guess ? () => {\n if (indexRef.current === -1) {\n const newIndex = nextIndexRef.current;\n nextIndexRef.current += 1;\n indexRef.current = newIndex;\n }\n return indexRef.current;\n } : -1);\n const index = externalIndex ?? internalIndex;\n const componentRef = React.useRef(null);\n\n // Deliberately identity-sensitive: nested items sharing one DOM node rely on ref attachment\n // order to decide which registration wins, and republishing from an effect instead would let\n // an inner item's later update silently take ownership from the outer one.\n const ref = React.useCallback(node => {\n const previousNode = componentRef.current;\n if (previousNode) {\n unregister(previousNode);\n }\n componentRef.current = node;\n if (node) {\n register(node, {\n metadata: metadata ?? null,\n index: externalIndex ?? null,\n label,\n textRef\n });\n }\n }, [externalIndex, register, unregister, metadata, label, textRef]);\n useIsoLayoutEffect(() => {\n if (externalIndex != null) {\n return undefined;\n }\n return subscribeMapChange(map => {\n const i = componentRef.current ? map.get(componentRef.current)?.index : null;\n if (i != null) {\n setInternalIndex(i);\n }\n });\n }, [externalIndex, subscribeMapChange]);\n return {\n ref,\n index\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useCompositeRootContext } from \"../root/CompositeRootContext.mjs\";\nimport { useCompositeListItem } from \"../list/useCompositeListItem.mjs\";\nexport function useCompositeItem(params = {}) {\n const {\n highlightItemOnHover,\n highlightedIndex,\n onHighlightedIndexChange\n } = useCompositeRootContext();\n const {\n ref,\n index\n } = useCompositeListItem(params);\n const isHighlighted = highlightedIndex === index;\n const itemRef = React.useRef(null);\n const mergedRef = useMergedRefs(ref, itemRef);\n const compositeProps = {\n tabIndex: isHighlighted ? 0 : -1,\n onFocus() {\n onHighlightedIndexChange(index);\n },\n onMouseMove() {\n const item = itemRef.current;\n if (!highlightItemOnHover || !item) {\n return;\n }\n const disabled = item.hasAttribute('disabled') || item.ariaDisabled === 'true';\n if (!isHighlighted && !disabled) {\n item.focus();\n }\n }\n };\n return {\n compositeProps,\n compositeRef: mergedRef,\n index\n };\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const TabsListContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") TabsListContext.displayName = \"TabsListContext\";\nexport function useTabsListContext() {\n const context = React.useContext(TabsListContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.' : _formatErrorMessage(65));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { ACTIVE_COMPOSITE_ITEM } from \"../../internals/composite/constants.mjs\";\nimport { useCompositeItem } from \"../../internals/composite/item/useCompositeItem.mjs\";\nimport { useCompositeRootContext } from \"../../internals/composite/root/CompositeRootContext.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsListContext } from \"../list/TabsListContext.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { activeElement, contains } from \"../../floating-ui-react/utils.mjs\";\n\n/**\n * An individual interactive tab button that toggles the corresponding panel.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nexport const TabsTab = /*#__PURE__*/React.forwardRef(function TabsTab(componentProps, forwardedRef) {\n const {\n className,\n disabled = false,\n render,\n value,\n id: idProp,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n value: activeTabValue,\n getTabPanelIdByValue,\n onValueChange,\n orientation,\n tabActivationDirection\n } = useTabsRootContext();\n const {\n activateOnFocus,\n registerTabResizeObserverElement,\n tabsListElement\n } = useTabsListContext();\n const {\n highlightedIndex,\n onHighlightedIndexChange\n } = useCompositeRootContext();\n const id = useBaseUiId(idProp);\n const tabMetadata = React.useMemo(() => ({\n disabled,\n id,\n value\n }), [disabled, id, value]);\n const {\n compositeProps,\n compositeRef,\n index\n // hook is used instead of the CompositeItem component\n // because the index is needed for Tab internals\n } = useCompositeItem({\n metadata: tabMetadata\n });\n const active = value === activeTabValue;\n const isNavigatingRef = React.useRef(false);\n const unobserveTabElementRef = React.useRef(null);\n\n // Registered from the ref callback rather than an effect so the observer\n // follows the rendered element when the `render` prop swaps the host element.\n const observeTabElement = useStableCallback(element => {\n unobserveTabElementRef.current?.();\n unobserveTabElementRef.current = element ? registerTabResizeObserverElement(element) : null;\n });\n\n // Keep the highlighted item in sync with the currently active tab\n // when the value prop changes externally (controlled mode)\n useIsoLayoutEffect(() => {\n if (isNavigatingRef.current) {\n isNavigatingRef.current = false;\n return;\n }\n if (!(active && index > -1 && highlightedIndex !== index)) {\n return;\n }\n\n // If focus is currently within the tabs list, don't override the roving\n // focus highlight. This keeps keyboard navigation relative to the focused\n // item after an external/asynchronous selection change.\n const listElement = tabsListElement;\n if (listElement != null) {\n const activeEl = activeElement(ownerDocument(listElement));\n if (activeEl && contains(listElement, activeEl)) {\n return;\n }\n }\n\n // Don't highlight disabled tabs to prevent them from interfering with keyboard navigation.\n // Keyboard focus (tabIndex) should remain on an enabled tab even when a disabled tab is selected.\n if (!disabled) {\n onHighlightedIndexChange(index);\n }\n }, [active, index, highlightedIndex, onHighlightedIndexChange, disabled, tabsListElement]);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton,\n focusableWhenDisabled: true\n });\n const tabPanelId = getTabPanelIdByValue(value);\n const isPressingRef = React.useRef(false);\n const isMainButtonRef = React.useRef(false);\n\n // Both callers guard on `!active`, so the current value is never re-committed.\n function activate(event) {\n onValueChange(value, createChangeEventDetails(REASONS.none, event.nativeEvent, undefined, {\n activationDirection: 'none'\n }));\n }\n function onClick(event) {\n if (active || disabled) {\n return;\n }\n activate(event);\n }\n function onFocus(event) {\n if (active || disabled) {\n return;\n }\n if (activateOnFocus && (!isPressingRef.current ||\n // keyboard or touch focus\n isMainButtonRef.current) // main mouse button focus\n ) {\n activate(event);\n }\n }\n function onPointerDown(event) {\n if (active || disabled) {\n return;\n }\n isPressingRef.current = true;\n // Secondary presses (context menu, middle click) may focus the tab, but\n // must not activate it with `activateOnFocus`.\n isMainButtonRef.current = event.button === 0;\n\n // Registered for every button so a secondary press doesn't leave the tab\n // stuck in the pressing state, which would suppress later focus activation.\n const doc = ownerDocument(event.currentTarget);\n function handlePointerEnd() {\n isPressingRef.current = false;\n isMainButtonRef.current = false;\n doc.removeEventListener('pointerup', handlePointerEnd);\n doc.removeEventListener('pointercancel', handlePointerEnd);\n }\n doc.addEventListener('pointerup', handlePointerEnd);\n doc.addEventListener('pointercancel', handlePointerEnd);\n }\n const state = {\n disabled,\n active,\n orientation,\n tabActivationDirection\n };\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef, compositeRef, observeTabElement],\n props: [compositeProps, {\n role: 'tab',\n 'aria-controls': tabPanelId,\n 'aria-selected': active,\n id,\n onClick,\n onFocus,\n onPointerDown,\n [ACTIVE_COMPOSITE_ITEM]: active ? '' : undefined,\n onKeyDownCapture() {\n isNavigatingRef.current = true;\n }\n }, elementProps, getButtonProps],\n stateAttributesMapping: tabsStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") TabsTab.displayName = \"TabsTab\";","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import { isReactVersionAtLeast } from \"./reactVersion.mjs\";\nexport function inertValue(value) {\n if (isReactVersionAtLeast(19)) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nconst stateAttributesMapping = {\n ...tabsStateAttributesMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A panel displayed when the corresponding tab is active.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nexport const TabsPanel = /*#__PURE__*/React.forwardRef(function TabsPanel(componentProps, forwardedRef) {\n const {\n className,\n value,\n render,\n keepMounted = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n value: selectedValue,\n getTabIdByPanelValue,\n orientation,\n tabActivationDirection,\n registerMountedTabPanel\n } = useTabsRootContext();\n const id = useBaseUiId();\n const {\n ref: listItemRef,\n index\n } = useCompositeListItem();\n const open = value === selectedValue;\n const {\n mounted,\n transitionStatus,\n setMounted\n } = useTransitionStatus(open);\n const hidden = !mounted;\n const correspondingTabId = getTabIdByPanelValue(value);\n const state = {\n hidden,\n orientation,\n tabActivationDirection,\n transitionStatus\n };\n const panelRef = React.useRef(null);\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, listItemRef, panelRef],\n props: [{\n 'aria-labelledby': correspondingTabId,\n hidden,\n id,\n role: 'tabpanel',\n tabIndex: open ? 0 : -1,\n inert: inertValue(!open),\n // Computed key: a plain literal key fails the DOM-props excess property check.\n ['data-index']: index\n }, elementProps],\n stateAttributesMapping\n });\n useOpenChangeComplete({\n open,\n ref: panelRef,\n onComplete() {\n if (!open) {\n setMounted(false);\n }\n }\n });\n useIsoLayoutEffect(() => {\n // On React 17 `useId` resolves in a passive effect, so `id` is still\n // undefined during this layout effect on the first commit. Skip the\n // registration until the effect re-runs with the resolved id.\n if (id == null || hidden && !keepMounted) {\n return undefined;\n }\n return registerMountedTabPanel(value, id);\n }, [hidden, keepMounted, value, id, registerMountedTabPanel]);\n const shouldRender = keepMounted || mounted;\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") TabsPanel.displayName = \"TabsPanel\";","export function isElementDisabled(element) {\n return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';\n}","import { isHTMLElement } from '@floating-ui/utils/dom';\nexport { stopEvent, isIndexOutOfListBounds, isListIndexDisabled, findNonDisabledListIndex, getMaxListIndex, getMinListIndex } from \"../../floating-ui-react/utils.mjs\";\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const HOME = 'Home';\nexport const END = 'End';\nexport const PAGE_UP = 'PageUp';\nexport const PAGE_DOWN = 'PageDown';\nexport const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);\nexport const SHIFT = 'Shift';\nexport const MODIFIER_KEYS = [SHIFT, 'Control', 'Alt', 'Meta'];\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName === 'INPUT';\n}\nexport function isNativeInput(element) {\n if (isInputElement(element) && element.selectionStart != null) {\n return true;\n }\n if (isHTMLElement(element) && element.tagName === 'TEXTAREA') {\n return true;\n }\n return false;\n}\nexport function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {\n if (!scrollContainer || !element || !element.scrollTo) {\n return;\n }\n let targetX = scrollContainer.scrollLeft;\n let targetY = scrollContainer.scrollTop;\n const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;\n const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;\n if (isOverflowingX && orientation !== 'vertical') {\n const elementOffsetLeft = getOffset(scrollContainer, element, 'left');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (direction === 'ltr') {\n if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n }\n }\n if (direction === 'rtl') {\n if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n }\n }\n }\n if (isOverflowingY && orientation !== 'horizontal') {\n const elementOffsetTop = getOffset(scrollContainer, element, 'top');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {\n // overflow upwards, align top edges\n targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;\n } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {\n // overflow downwards, align bottom edges\n targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;\n }\n }\n scrollContainer.scrollTo({\n left: targetX,\n top: targetY,\n behavior: 'auto'\n });\n}\nfunction getOffset(ancestor, element, side) {\n const propName = side === 'left' ? 'offsetLeft' : 'offsetTop';\n let result = 0;\n while (element.offsetParent) {\n result += element[propName];\n if (element.offsetParent === ancestor) {\n break;\n }\n element = element.offsetParent;\n }\n return result;\n}\nfunction getStyles(element) {\n const styles = getComputedStyle(element);\n return {\n scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,\n scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,\n scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,\n scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,\n scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,\n scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,\n scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,\n scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { isElementDisabled } from '@base-ui/utils/isElementDisabled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { COMPOSITE_KEYS, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, END, HOME, MODIFIER_KEYS, findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isListIndexDisabled, isIndexOutOfListBounds, isNativeInput, scrollIntoViewIfNeeded } from \"../composite.mjs\";\nimport { ACTIVE_COMPOSITE_ITEM } from \"../constants.mjs\";\nimport { getTarget } from \"../../../floating-ui-react/utils.mjs\";\nconst EMPTY_ARRAY = [];\nexport function useCompositeRoot(params) {\n const {\n loopFocus = true,\n orientation = 'both',\n grid,\n onLoop,\n direction,\n highlightedIndex: externalHighlightedIndex,\n onHighlightedIndexChange: externalSetHighlightedIndex,\n rootRef: externalRef,\n enableHomeAndEndKeys = false,\n stopEventPropagation,\n disabledIndices,\n modifierKeys = EMPTY_ARRAY\n } = params;\n const [internalHighlightedIndex, internalSetHighlightedIndex] = React.useState(0);\n const isGrid = grid != null;\n const rootRef = React.useRef(null);\n const mergedRef = useMergedRefs(rootRef, externalRef);\n const elementsRef = React.useRef([]);\n const hasSetDefaultIndexRef = React.useRef(false);\n const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;\n const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {\n (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);\n if (shouldScrollIntoView) {\n const newActiveItem = elementsRef.current[index];\n scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);\n }\n });\n const onMapChange = useStableCallback(map => {\n if (map.size === 0 || hasSetDefaultIndexRef.current) {\n return;\n }\n hasSetDefaultIndexRef.current = true;\n const sortedElements = Array.from(map.keys());\n const activeItem = sortedElements.find(compositeElement => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;\n // Set the default highlighted index of an arbitrary composite item. The map value carries\n // the item's own index, which is not its position among the keys once a list mixes explicit\n // and automatic indexes and leaves gaps.\n const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;\n if (activeIndex !== -1) {\n onHighlightedIndexChange(activeIndex);\n } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {\n // The default highlighted item is disabled, so it should not hold the single\n // roving tab stop: a natively disabled element is removed from the tab order,\n // and an aria-disabled one should not be the entry point. Move the tab stop\n // to the first enabled item. If every item is disabled, keep the current\n // highlighted index.\n const firstEnabledIndex = findNonDisabledListIndex(sortedElements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);\n });\n useIsoLayoutEffect(() => {\n // `disabledIndices` can resolve a render after the initial map population\n // (e.g. Toolbar derives it from item metadata through a state update), so the\n // default tab stop at index 0 may now point at a disabled item, leaving the\n // composite without a reachable tab stop. Re-validate and move it to the first\n // enabled item. Gated on `disabledIndices` being provided so composites that\n // rely on the DOM disabled fallback keep their existing behavior.\n if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) {\n return;\n }\n const elements = elementsRef.current;\n if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {\n const firstEnabledIndex = findNonDisabledListIndex(elements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]);\n const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {\n if (!onLoop) {\n return nextIndex;\n }\n return onLoop(event, prevIndex, nextIndex, elementsRef);\n });\n\n // Stable so that `relayKeyboardEvent` does not invalidate identity-sensitive\n // consumers (the `CompositeRootContext` value and trigger data forwarding).\n const onKeyDown = useStableCallback(event => {\n const isHomeOrEnd = event.key === HOME || event.key === END;\n if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) {\n return;\n }\n if (isModifierKeySet(event, modifierKeys)) {\n return;\n }\n const element = rootRef.current;\n if (!element) {\n return;\n }\n const isRtl = direction === 'rtl';\n const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;\n const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;\n const forwardKey = orientation === 'vertical' ? ARROW_DOWN : horizontalForwardKey;\n const backwardKey = orientation === 'vertical' ? ARROW_UP : horizontalBackwardKey;\n const target = getTarget(event.nativeEvent);\n if (target != null && isNativeInput(target) && !isElementDisabled(target)) {\n const selectionStart = target.selectionStart;\n const selectionEnd = target.selectionEnd;\n const textContent = target.value;\n // return to native textbox behavior when\n // 1 - Shift is held to make a text selection, or if there already is a text selection\n if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {\n return;\n }\n // 2 - arrow-ing forward and not in the last position of the text\n if (event.key !== backwardKey && selectionStart < textContent.length) {\n return;\n }\n // 3 -arrow-ing backward and not in the first position of the text\n if (event.key !== forwardKey && selectionStart > 0) {\n return;\n }\n }\n let nextIndex = highlightedIndex;\n const minIndex = getMinListIndex(elementsRef, disabledIndices);\n const maxIndex = getMaxListIndex(elementsRef, disabledIndices);\n if (grid != null) {\n nextIndex = grid({\n disabledIndices,\n elementsRef,\n event,\n highlightedIndex,\n loopFocus,\n maxIndex,\n minIndex,\n onLoop: wrappedOnLoop,\n orientation,\n rtl: isRtl\n });\n }\n const isForwardKey = orientation !== 'vertical' && event.key === horizontalForwardKey || orientation !== 'horizontal' && event.key === ARROW_DOWN;\n const isBackwardKey = orientation !== 'vertical' && event.key === horizontalBackwardKey || orientation !== 'horizontal' && event.key === ARROW_UP;\n if (enableHomeAndEndKeys) {\n if (event.key === HOME) {\n nextIndex = minIndex;\n } else if (event.key === END) {\n nextIndex = maxIndex;\n }\n }\n if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) {\n if (loopFocus && nextIndex === maxIndex && isForwardKey) {\n nextIndex = minIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else if (loopFocus && nextIndex === minIndex && isBackwardKey) {\n nextIndex = maxIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else {\n nextIndex = findNonDisabledListIndex(elementsRef.current, {\n startingIndex: nextIndex,\n decrement: isBackwardKey,\n disabledIndices\n });\n }\n }\n if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {\n if (stopEventPropagation) {\n event.stopPropagation();\n }\n if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) {\n event.preventDefault();\n }\n onHighlightedIndexChange(nextIndex, true);\n\n // Wait for FocusManager `returnFocus` to execute.\n queueMicrotask(() => {\n elementsRef.current[nextIndex]?.focus();\n });\n }\n });\n const props = {\n ref: mergedRef,\n onFocus(event) {\n const element = rootRef.current;\n const target = getTarget(event.nativeEvent);\n if (!element || target == null || !isNativeInput(target)) {\n return;\n }\n target.setSelectionRange(0, target.value.length);\n },\n onKeyDown\n };\n return {\n props,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange,\n relayKeyboardEvent: onKeyDown\n };\n}\nfunction isModifierKeySet(event, ignoredModifierKeys) {\n for (const key of MODIFIER_KEYS) {\n if (ignoredModifierKeys.includes(key)) {\n continue;\n }\n if (event.getModifierState(key)) {\n return true;\n }\n }\n return false;\n}","'use client';\n\nimport * as React from 'react';\nexport const DirectionContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") DirectionContext.displayName = \"DirectionContext\";\nexport function useDirection() {\n const context = React.useContext(DirectionContext);\n return context?.direction ?? 'ltr';\n}","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { CompositeList } from \"../list/CompositeList.mjs\";\nimport { useCompositeRoot } from \"./useCompositeRoot.mjs\";\nimport { CompositeRootContext } from \"./CompositeRootContext.mjs\";\nimport { useRenderElement } from \"../../useRenderElement.mjs\";\nimport { useDirection } from \"../../direction-context/DirectionContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function CompositeRoot(componentProps) {\n const {\n render,\n className,\n style,\n refs = EMPTY_ARRAY,\n props = EMPTY_ARRAY,\n state = EMPTY_OBJECT,\n stateAttributesMapping,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n orientation,\n grid,\n loopFocus,\n onLoop,\n enableHomeAndEndKeys,\n onMapChange: onMapChangeProp,\n stopEventPropagation = true,\n rootRef,\n disabledIndices,\n modifierKeys,\n highlightItemOnHover = false,\n tag = 'div',\n ...elementProps\n } = componentProps;\n const direction = useDirection();\n const {\n props: defaultProps,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange: onMapChangeUnwrapped,\n relayKeyboardEvent\n } = useCompositeRoot({\n grid,\n loopFocus,\n onLoop,\n orientation,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n rootRef,\n stopEventPropagation,\n enableHomeAndEndKeys,\n direction,\n disabledIndices,\n modifierKeys\n });\n const element = useRenderElement(tag, componentProps, {\n state,\n ref: refs,\n props: [defaultProps, ...props, elementProps],\n stateAttributesMapping\n });\n const contextValue = React.useMemo(() => ({\n highlightedIndex,\n onHighlightedIndexChange,\n highlightItemOnHover,\n relayKeyboardEvent\n }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);\n return /*#__PURE__*/_jsx(CompositeRootContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: elementsRef,\n onMapChange: newMap => {\n onMapChangeProp?.(newMap);\n onMapChangeUnwrapped(newMap);\n },\n children: element\n })\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { CompositeRoot } from \"../../internals/composite/root/CompositeRoot.mjs\";\nimport { tabsStateAttributesMapping } from \"../root/stateAttributesMapping.mjs\";\nimport { useTabsRootContext } from \"../root/TabsRootContext.mjs\";\nimport { TabsListContext } from \"./TabsListContext.mjs\";\n\n/**\n * Groups the individual tab buttons.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Tabs](https://base-ui.com/react/components/tabs)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const TabsList = /*#__PURE__*/React.forwardRef(function TabsList(componentProps, forwardedRef) {\n const {\n activateOnFocus = false,\n className,\n loopFocus = true,\n render,\n style,\n ...elementProps\n } = componentProps;\n const {\n orientation,\n setTabMap,\n tabActivationDirection\n } = useTabsRootContext();\n const [highlightedTabIndex, setHighlightedTabIndex] = React.useState(0);\n const [tabsListElement, setTabsListElement] = React.useState(null);\n const indicatorUpdateListenersRef = React.useRef(new Set());\n const tabResizeObserverElementsRef = React.useRef(new Set());\n const resizeObserverRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const resizeObserver = new ResizeObserver(() => {\n indicatorUpdateListenersRef.current.forEach(listener => {\n listener();\n });\n });\n resizeObserverRef.current = resizeObserver;\n if (tabsListElement) {\n resizeObserver.observe(tabsListElement);\n }\n tabResizeObserverElementsRef.current.forEach(element => {\n resizeObserver.observe(element);\n });\n return () => {\n resizeObserver.disconnect();\n resizeObserverRef.current = null;\n };\n }, [tabsListElement]);\n const registerIndicatorUpdateListener = useStableCallback(listener => {\n indicatorUpdateListenersRef.current.add(listener);\n return () => {\n indicatorUpdateListenersRef.current.delete(listener);\n };\n });\n const registerTabResizeObserverElement = useStableCallback(element => {\n tabResizeObserverElementsRef.current.add(element);\n resizeObserverRef.current?.observe(element);\n return () => {\n tabResizeObserverElementsRef.current.delete(element);\n resizeObserverRef.current?.unobserve(element);\n };\n });\n const state = {\n orientation,\n tabActivationDirection\n };\n const defaultProps = {\n 'aria-orientation': orientation === 'vertical' ? 'vertical' : undefined,\n role: 'tablist'\n };\n const tabsListContextValue = React.useMemo(() => ({\n activateOnFocus,\n registerIndicatorUpdateListener,\n registerTabResizeObserverElement,\n tabsListElement\n }), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]);\n return /*#__PURE__*/_jsx(TabsListContext.Provider, {\n value: tabsListContextValue,\n children: /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef, setTabsListElement],\n props: [defaultProps, elementProps],\n stateAttributesMapping: tabsStateAttributesMapping,\n highlightedIndex: highlightedTabIndex,\n enableHomeAndEndKeys: true,\n loopFocus: loopFocus,\n orientation: orientation,\n onHighlightedIndexChange: setHighlightedTabIndex,\n onMapChange: setTabMap,\n disabledIndices: EMPTY_ARRAY\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") TabsList.displayName = \"TabsList\";","import * as React from 'react';\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { resolveDisclosure } from './disclosure.js';\n\n/**\n * The chevron both panels use. Kept here rather than copied into each panel:\n * the two had already drifted apart in geometry once, which is exactly the\n * failure a shared control prevents.\n */\nexport const chevronIcon = React.createElement(\n 'svg',\n { width: 12, height: 12, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': true },\n React.createElement('path', {\n d: 'M6 3.5 10.5 8 6 12.5',\n stroke: 'currentColor',\n strokeWidth: 1.4,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n }),\n);\n\nexport interface DisclosureRowOptions {\n /** Stable identity for both the React key and the expanded-state map. */\n readonly rowKey: string;\n /** Whether this row's detail is currently expanded. */\n readonly expanded: boolean;\n /** A filter is active, so matching detail is forced open. */\n readonly filtering: boolean;\n readonly onOpenChange: (open: boolean) => void;\n /** Accessible name for the trigger; the caller translates it. */\n readonly triggerLabel: string;\n readonly className: string;\n readonly headerClassName: string;\n /** Rendered inside the trigger, next to the chevron. */\n readonly heading: React.ReactNode;\n /** Rendered after the trigger, outside it: switches, chips, buttons. */\n readonly actions: readonly React.ReactNode[];\n /** The revealed content. Absent means there is nothing to reveal. */\n readonly detail?: React.ReactNode;\n readonly style?: React.CSSProperties;\n /** Class for the placeholder that keeps a detail-less row aligned. */\n readonly spacerClassName?: string;\n}\n\n/**\n * One capability row that may reveal detail.\n *\n * Both panels show the same kind of thing — a name, a switch, and detail worth\n * hiding until asked for — so both get the same affordance from one place. A\n * row with no detail renders no trigger at all rather than an empty one, and\n * takes a spacer so its name still lines up with the rows that do.\n */\nexport function disclosureRow(options: DisclosureRowOptions): React.ReactElement {\n const hasDetail = options.detail !== undefined && options.detail !== null && options.detail !== '';\n if (!hasDetail) {\n return React.createElement(\n 'div',\n { className: options.className, ...(options.style === undefined ? {} : { style: options.style }) },\n React.createElement(\n 'div',\n { className: options.headerClassName },\n React.createElement('span', {\n 'aria-hidden': true,\n ...(options.spacerClassName === undefined\n ? { style: { width: '18px', flex: 'none' } }\n : { className: options.spacerClassName }),\n }),\n options.heading,\n ...options.actions,\n ),\n );\n }\n const disclosure = resolveDisclosure(options.expanded, options.filtering);\n return React.createElement(\n Collapsible.Root,\n {\n open: disclosure.open,\n onOpenChange: options.onOpenChange,\n className: options.className,\n ...(options.style === undefined ? {} : { style: options.style }),\n },\n React.createElement(\n 'div',\n { className: options.headerClassName },\n React.createElement(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger',\n disabled: disclosure.disabled,\n 'aria-label': options.triggerLabel,\n },\n React.createElement('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n options.heading,\n ),\n ...options.actions,\n ),\n React.createElement(Collapsible.Panel, { className: 'ci-collapse' }, options.detail),\n );\n}\n","/**\n * The settings panel's text filter. It is the same function the composer panel\n * uses, fixed to the preset payload types: the two scopes must behave\n * identically under one query, and sharing the implementation is what makes\n * that true rather than merely intended.\n */\nimport { filterCapabilities } from './filter-core.js';\nimport type { FilteredCapabilities } from './filter-core.js';\nimport type { PresetMcpView, PresetSkillView, PresetToolPresetView, PresetToolView } from './preset-store.js';\n\nexport type FilteredPreset = FilteredCapabilities<PresetSkillView, PresetToolView, PresetMcpView>;\n\nexport function filterPreset(preset: PresetToolPresetView, rawQuery: string): FilteredPreset {\n return filterCapabilities(preset, rawQuery);\n}\n","/**\n * Runtime guards for the preset payload contract, shared so the client parser\n * and the composition tests exercise the exact same code. A rejected payload\n * must read as an error in the panel, not as an empty preset list -- the\n * host/client version skew that produces one (client hot-reloads, host needs\n * a restart) is exactly when shapes diverge.\n */\nimport type {\n PresetMcpServer,\n PresetSkillRow,\n PresetToolEntry,\n PresetToolPayload,\n PresetToolRow,\n} from './preset-contract.js';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\nfunction parseTools(raw: readonly unknown[]): PresetToolRow[] | null {\n const tools: PresetToolRow[] = [];\n for (const rawTool of raw) {\n if (!isRecord(rawTool)) return null;\n const { name, label, description, enabled, reserved } = rawTool;\n if (typeof name !== 'string' || typeof label !== 'string' || typeof enabled !== 'boolean') return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (reserved !== undefined && typeof reserved !== 'boolean') return null;\n tools.push({\n name,\n label,\n ...(description === undefined ? {} : { description }),\n enabled,\n ...(reserved === undefined ? {} : { reserved }),\n });\n }\n return tools;\n}\n\nfunction parseSkills(raw: readonly unknown[]): PresetSkillRow[] | null {\n const skills: PresetSkillRow[] = [];\n for (const rawSkill of raw) {\n if (!isRecord(rawSkill)) return null;\n const { name, description, enabled, project, source, path, group } = rawSkill;\n if (typeof name !== 'string' || typeof enabled !== 'boolean') return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (project !== undefined && typeof project !== 'boolean') return null;\n if (source !== undefined && typeof source !== 'string') return null;\n if (path !== undefined && typeof path !== 'string') return null;\n if (group !== undefined && typeof group !== 'string') return null;\n skills.push({\n name,\n ...(description === undefined ? {} : { description }),\n enabled,\n ...(project === undefined ? {} : { project }),\n ...(source === undefined ? {} : { source }),\n ...(path === undefined ? {} : { path }),\n ...(group === undefined ? {} : { group }),\n });\n }\n return skills;\n}\n\n/** Parse one payload, returning null for anything that is not the contract. */\nexport function parsePresetToolPayload(value: unknown): PresetToolPayload | null {\n if (!isRecord(value)) return null;\n const { presets: rawPresets, writable } = value;\n if (!Array.isArray(rawPresets) || typeof writable !== 'boolean') return null;\n const presets: PresetToolEntry[] = [];\n for (const raw of rawPresets) {\n if (!isRecord(raw)) return null;\n const { id, name, description, broken, trust, skills: rawSkills, mcp: rawMcp, systemTools: rawSystem } = raw;\n if (typeof id !== 'string' || typeof name !== 'string' || (trust !== 'system' && trust !== 'user')) return null;\n if (!Array.isArray(rawMcp) || !Array.isArray(rawSystem) || !Array.isArray(rawSkills)) return null;\n if (description !== undefined && typeof description !== 'string') return null;\n if (broken !== undefined && typeof broken !== 'string') return null;\n const systemTools = parseTools(rawSystem);\n if (systemTools === null) return null;\n const skills = parseSkills(rawSkills);\n if (skills === null) return null;\n const mcp: PresetMcpServer[] = [];\n for (const rawServer of rawMcp) {\n if (!isRecord(rawServer)) return null;\n const { server, tools: rawTools, enabled, source, path, unavailable, reconnectable } = rawServer;\n if (typeof server !== 'string' || typeof enabled !== 'boolean' || !Array.isArray(rawTools)) return null;\n if (source !== undefined && typeof source !== 'string') return null;\n if (path !== undefined && typeof path !== 'string') return null;\n if (unavailable !== undefined && typeof unavailable !== 'boolean') return null;\n if (reconnectable !== undefined && typeof reconnectable !== 'boolean') return null;\n const tools = parseTools(rawTools);\n if (tools === null) return null;\n mcp.push({\n server,\n tools,\n enabled,\n ...(source === undefined ? {} : { source }),\n ...(path === undefined ? {} : { path }),\n ...(unavailable === undefined ? {} : { unavailable }),\n ...(reconnectable === undefined ? {} : { reconnectable }),\n });\n }\n presets.push({\n id,\n name,\n ...(description === undefined ? {} : { description }),\n ...(broken === undefined ? {} : { broken }),\n trust,\n skills,\n mcp,\n systemTools,\n });\n }\n return { presets, writable };\n}\n","import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';\n\nexport type {\n PresetMcpServer as PresetMcpView,\n PresetSkillRow as PresetSkillView,\n PresetToolEntry as PresetToolPresetView,\n PresetToolRow as PresetToolView,\n} from '../preset-contract.js';\nimport type { PresetToolPayload } from '../preset-contract.js';\nimport { parsePresetToolPayload } from '../preset-wire.js';\n\nexport interface PresetToolState {\n readonly loading: boolean;\n readonly payload: PresetToolPayload | null;\n readonly selectedId: string | null;\n readonly error: string | null;\n}\n\nconst INITIAL: PresetToolState = { loading: false, payload: null, selectedId: null, error: null };\nconst store = createSnapshotStore<PresetToolState>(INITIAL);\nlet epoch = 0;\nlet queue: Promise<void> = Promise.resolve();\nlet requests = 0;\n\nexport const subscribePresetTools = (listener: () => void): (() => void) => store.subscribe(listener);\nexport const getPresetToolsSnapshot = (): PresetToolState => store.getSnapshot();\n\nasync function requestPayload(init?: RequestInit): Promise<PresetToolPayload> {\n const response = await fetch('/api/capability-panel/presets', { credentials: 'same-origin', ...init });\n if (!response.ok) {\n let detail = '';\n try {\n const body = await response.json() as { error?: unknown };\n if (typeof body.error === 'string') detail = `: ${body.error}`;\n } catch {}\n throw new Error(`HTTP ${response.status}${detail}`);\n }\n const payload = parsePresetToolPayload(await response.json());\n if (payload === null) throw new Error('unexpected preset payload shape (host/client version skew?)');\n return payload;\n}\n\nfunction begin(): number {\n requests += 1;\n store.set({ ...store.getSnapshot(), loading: true, error: null });\n return epoch;\n}\n\nfunction finish(requestEpoch: number, patch: Partial<PresetToolState>): void {\n if (requestEpoch !== epoch) return;\n requests -= 1;\n const current = store.getSnapshot();\n const nextPayload = patch.payload ?? current.payload;\n const selectedExists = nextPayload?.presets.some((preset) => preset.id === current.selectedId) === true;\n store.set({\n ...current,\n ...patch,\n selectedId: selectedExists ? current.selectedId : (nextPayload?.presets[0]?.id ?? null),\n loading: requests > 0,\n });\n}\n\nexport async function loadPresetTools(): Promise<void> {\n const requestEpoch = begin();\n try {\n finish(requestEpoch, { payload: await requestPayload(), error: null });\n } catch (error) {\n finish(requestEpoch, { error: error instanceof Error ? error.message : String(error) });\n }\n}\n\nexport function selectPreset(id: string): void {\n const current = store.getSnapshot();\n if (current.payload?.presets.some((preset) => preset.id === id) !== true) return;\n store.set({ ...current, selectedId: id });\n}\n\n/** Serialized write: every toggle is one POST whose response is the new truth. */\nfunction mutate(body: { presetId: string; kind: 'tool' | 'mcp-server' | 'skill'; name: string; enabled: boolean }): Promise<void> {\n const requestEpoch = begin();\n const run = async (): Promise<void> => {\n try {\n finish(requestEpoch, {\n payload: await requestPayload({\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n }),\n error: null,\n });\n } catch (error) {\n finish(requestEpoch, { error: error instanceof Error ? error.message : String(error) });\n }\n };\n const result = queue.then(run);\n queue = result;\n return result;\n}\n\nexport function setPresetTool(presetId: string, name: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'tool', name, enabled });\n}\n\n/** Toggle one skill's default for a preset. */\nexport function setPresetSkill(presetId: string, name: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'skill', name, enabled });\n}\n\n/** Toggle a whole MCP server in one write instead of one request per tool. */\nexport function setPresetServer(presetId: string, server: string, enabled: boolean): Promise<void> {\n return mutate({ presetId, kind: 'mcp-server', name: server, enabled });\n}\n\n/**\n * Pull a declared-but-offline server's connection up, then reload the preset\n * list: registration lands asynchronously, so the payload refresh reflects\n * whatever the registry knows when it answers.\n */\nexport function reconnectPresetServer(server: string): Promise<void> {\n const requestEpoch = begin();\n const run = async (): Promise<void> => {\n try {\n const response = await fetch('/api/capability-panel/reconnect', {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ server }),\n });\n if (!response.ok) {\n let detail = '';\n try {\n const body = await response.json() as { error?: unknown };\n if (typeof body.error === 'string') detail = `: ${body.error}`;\n } catch { /* a non-JSON error body adds nothing */ }\n throw new Error(`HTTP ${response.status}${detail}`);\n }\n finish(requestEpoch, { payload: await requestPayload(), error: null });\n } catch (error) {\n finish(requestEpoch, { error: error instanceof Error ? error.message : String(error) });\n }\n };\n const result = queue.then(run);\n queue = result;\n return result;\n}\n\nexport function resetPresetTools(): void {\n epoch += 1;\n requests = 0;\n queue = Promise.resolve();\n store.set(INITIAL);\n}\n","import * as React from 'react';\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { Input } from '@base-ui/react/input';\nimport { Tabs } from '@base-ui/react/tabs';\n// Same host-graph discipline as the composer panel: the Menu primitive keeps\n// the picker's popup on the theme tokens a native <select> can never reach.\nimport { IconChevronDownOutline14, IconFolderClose16, IconRefreshOutline14, Menu } from '@deepseek-ai/dsh-client-ui-primitives';\nimport { resolveDisclosure } from './disclosure.js';\nimport { chevronIcon, disclosureRow } from './disclosure-row.js';\nimport { capabilitySwitch } from './switch.js';\nimport { filterPreset } from './preset-filter.js';\nimport {\n getPresetToolsSnapshot,\n loadPresetTools,\n reconnectPresetServer,\n selectPreset,\n setPresetServer,\n setPresetSkill,\n setPresetTool,\n subscribePresetTools,\n} from './preset-store.js';\nimport type { PresetSkillView, PresetToolView } from './preset-store.js';\nimport type { Translate } from './locale.js';\nimport { TOK } from './styles.js';\n\nexport interface PresetToolSectionProps {\n readonly t: Translate;\n readonly subscribeLocale: (listener: () => void) => () => void;\n readonly getLocaleSnapshot: () => { readonly active: string; readonly revision: number };\n}\n\n/** Middle ellipsis for long path labels; the full path stays in the tooltip. */\nconst ellipsizeMiddle = (text: string, max = 56): string => {\n if (text.length <= max) return text;\n const head = Math.ceil((max - 1) / 2);\n const tail = Math.floor((max - 1) / 2);\n return `${text.slice(0, head)}…${text.slice(text.length - tail)}`;\n};\n\n/** Group items by a key, preserving first-seen order. */\nfunction groupBy<T>(items: readonly T[], keyOf: (item: T) => string): [string, T[]][] {\n const groups = new Map<string, T[]>();\n const order: string[] = [];\n for (const item of items) {\n const key = keyOf(item);\n const bucket = groups.get(key);\n if (bucket !== undefined) bucket.push(item);\n else { groups.set(key, [item]); order.push(key); }\n }\n return order.map((key) => [key, groups.get(key)!]);\n}\n\n/**\n * Settings-side twin of the composer panel. It reuses that panel's vocabulary\n * and interaction — an always-visible filter, MCP tools collapsed under their\n * server, one switch per row — because at ~200 tools a flat list is not\n * usable, and because two scopes of one feature should not feel like two\n * unrelated features.\n */\nexport function PresetToolSection(props: PresetToolSectionProps): React.ReactElement {\n const { t } = props;\n const state = React.useSyncExternalStore(subscribePresetTools, getPresetToolsSnapshot);\n React.useSyncExternalStore(props.subscribeLocale, props.getLocaleSnapshot);\n React.useEffect(() => { void loadPresetTools(); }, []);\n const [query, setQuery] = React.useState('');\n const [expanded, setExpanded] = React.useState<Record<string, boolean>>({});\n // Which categories to show. The composer panel switches between them with\n // exclusive tabs because it is a 360px popover; this panel is wide enough to\n // show all three at once, so \"all\" is the default and the tabs narrow it.\n const [kind, setKind] = React.useState<'all' | 'skills' | 'mcp' | 'system'>('all');\n // The preset picker's popup is owner-controlled like every Menu consumer.\n const [pickerOpen, setPickerOpen] = React.useState(false);\n // Which server is mid-reconnect: its button spins and disables until the\n // request settles, so a click reads as \"starting\" not \"nothing happened\".\n const [reconnecting, setReconnecting] = React.useState<string | null>(null);\n\n const selected = state.payload?.presets.find((preset) => preset.id === state.selectedId);\n const filtering = query.trim() !== '';\n const view = selected === undefined ? null : filterPreset(selected, query);\n const writable = state.payload?.writable === true;\n const locked = state.loading || !writable;\n\n /** One switch, shared by tool rows, server rows and skill rows. */\n const switchFor = (\n on: boolean,\n frozen: boolean,\n label: string,\n onChange: (checked: boolean) => void,\n ): React.ReactElement =>\n capabilitySwitch({\n checked: on,\n disabled: locked || frozen,\n busy: state.loading,\n label,\n onCheckedChange: onChange,\n });\n\n /**\n * Open a source folder from the settings page. The route resolves\n * user/project/host/preset sources without a session (project sources\n * against the dsh process's own cwd, matching how this page lists them).\n */\n const openSourceFolder = (source: string): void => {\n void fetch('/api/capability-panel/open-folder', {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ source }),\n }).then((response) => {\n if (!response.ok) console.warn(`[capability-panel] cannot open source folder (${response.status})`);\n }).catch((error: unknown) => {\n console.warn('[capability-panel] open source folder request failed', error);\n });\n };\n\n /** Sources the open-folder route can resolve without a session. */\n const SESSIONLESS_OPENABLE = new Set(['user-dsh', 'user-agents', 'project-dsh', 'project-agents', 'host']);\n\n /**\n * A ruled source divider inside a settings list — the same visual language\n * as the session panel's group headers (`── label (count) ────`). Preset\n * groups name their preset; other groups show the directory (ellipsized);\n * openable groups offer the hover folder icon and a click-through.\n */\n const sourceDivider = (\n groupKey: string,\n items: readonly { path?: string }[],\n first: boolean,\n ): React.ReactElement => {\n const presetName = groupKey.startsWith('preset:') ? groupKey.slice(7) : undefined;\n const path = items.find((item) => item.path !== undefined)?.path;\n // Unknown or untranslated group keys display as-is, never the raw\n // `source.*` locale key (the session panel falls back the same way).\n const translated = t(`source.${groupKey}`);\n const fallbackLabel = translated === `source.${groupKey}` ? groupKey : translated;\n const label = presetName ?? (path !== undefined ? ellipsizeMiddle(path) : groupKey === 'host' ? t('source.host') : fallbackLabel);\n const openSource = presetName ?? groupKey;\n const openable = presetName !== undefined || SESSIONLESS_OPENABLE.has(groupKey);\n const rule = (grow: boolean): React.ReactElement =>\n React.createElement('span', {\n style: grow\n ? { flex: '1', height: '1px', background: TOK.borderStrong }\n : { flex: 'none', width: '16px', height: '1px', background: TOK.borderStrong },\n });\n return React.createElement(\n 'li',\n { key: `source:${groupKey}`, className: 'ci-source-divider' },\n React.createElement(\n 'div',\n {\n className: 'ci-source-header',\n style: { display: 'flex', alignItems: 'center', gap: '8px', margin: first ? '6px 0 2px' : '18px 0 2px' },\n },\n rule(false),\n React.createElement(\n 'span',\n {\n style: {\n flex: 'none',\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n fontSize: '12px',\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n cursor: openable ? 'pointer' : 'default',\n },\n title: openable ? t('source.openFolder', { source: path ?? label }) : undefined,\n onClick: openable ? () => { openSourceFolder(openSource); } : undefined,\n },\n openable\n ? React.createElement(\n 'span',\n { className: 'ci-folder-icon', style: { display: 'inline-grid', placeItems: 'center', opacity: 0, transition: 'opacity 0.15s' } },\n // The host's own folder glyph, same as the session panel's dividers.\n React.createElement(IconFolderClose16, { size: 12 }),\n )\n : null,\n `${label} (${items.length})`,\n ),\n rule(true),\n ),\n );\n };\n\n const toggle = (tool: PresetToolView, presetId: string): React.ReactElement =>\n switchFor(\n tool.enabled,\n tool.reserved === true,\n tool.reserved === true\n ? t('preset.reserved', { name: tool.label })\n : t(tool.enabled ? 'action.disable' : 'action.enable', { name: tool.label }),\n (checked) => { void setPresetTool(presetId, tool.name, checked); },\n );\n\n /** Expand/collapse label, worded like the composer panel's. */\n const detailAria = (subject: string, rowKey: string): string => {\n const state = resolveDisclosure(expanded[rowKey] === true, filtering);\n const detail = t('detail.description');\n if (state.disabled) return t('disclosure.pinned', { subject, detail });\n return t(state.open ? 'disclosure.collapse' : 'disclosure.expand', { subject, detail });\n };\n\n const skillRow = (skill: PresetSkillView, presetId: string): React.ReactElement => {\n const rowKey = `skill:${skill.name}`;\n return React.createElement(\n 'li',\n { key: rowKey, className: 'ci-preset-item' },\n disclosureRow({\n rowKey,\n expanded: expanded[rowKey] === true,\n filtering,\n onOpenChange: (open) => { setExpanded((prev) => ({ ...prev, [rowKey]: open })); },\n triggerLabel: detailAria(skill.name, rowKey),\n className: 'ci-preset-disclosure',\n headerClassName: 'ci-row-head ci-preset-tool-row',\n spacerClassName: 'ci-preset-spacer',\n heading: React.createElement(\n 'span',\n { className: 'ci-preset-tool-name' },\n skill.name,\n // A project skill is real but conditional: it exists because THIS\n // workspace supplies it, and a session opened elsewhere will not see\n // it. Marking beats hiding, which would just look like a short list.\n skill.project === true\n ? React.createElement('span', { className: 'ci-preset-badge' }, t('preset.projectSkill'))\n : null,\n ),\n actions: [\n switchFor(\n skill.enabled,\n false,\n t(skill.enabled ? 'action.disable' : 'action.enable', { name: skill.name }),\n (checked) => { void setPresetSkill(presetId, skill.name, checked); },\n ),\n ],\n ...(skill.description === undefined\n ? {}\n : { detail: React.createElement('div', { className: 'ci-preset-detail' }, skill.description) }),\n }),\n );\n };\n\n const toolRow = (tool: PresetToolView, presetId: string, nested: boolean): React.ReactElement => {\n const rowKey = `tool:${tool.name}`;\n return React.createElement(\n 'li',\n { key: tool.name, className: nested ? 'ci-toolrow ci-preset-item' : 'ci-preset-item' },\n disclosureRow({\n rowKey,\n expanded: expanded[rowKey] === true,\n filtering,\n onOpenChange: (open) => { setExpanded((prev) => ({ ...prev, [rowKey]: open })); },\n triggerLabel: detailAria(tool.label, rowKey),\n className: 'ci-preset-disclosure',\n headerClassName: 'ci-row-head ci-preset-tool-row',\n spacerClassName: 'ci-preset-spacer',\n heading: React.createElement('span', { className: 'ci-preset-tool-name' }, tool.label),\n actions: [toggle(tool, presetId)],\n ...(tool.description === undefined\n ? {}\n : { detail: React.createElement('div', { className: 'ci-preset-detail' }, tool.description) }),\n }),\n );\n };\n\n const body = (): React.ReactElement | null => {\n if (selected === undefined || view === null) return React.createElement('p', null, t('preset.empty'));\n if (selected.broken !== undefined) {\n return React.createElement(\n 'p',\n { role: 'alert', className: 'ci-settings-note', style: { color: TOK.error } },\n t('preset.broken', { reason: selected.broken }),\n );\n }\n if (view.total === 0) {\n return React.createElement('p', null, filtering ? t('empty.match') : t('preset.noTools'));\n }\n // The same three groups the composer panel uses, with the same labels and\n // the same shown/total counts. They are three because they are three\n // different things: skills and MCP servers both come from outside the\n // preset (the user's skills roots and the host composition), while system\n // tools are what the preset itself carries.\n const totals = {\n skills: selected.skills.length,\n mcp: selected.mcp.length,\n systemTools: selected.systemTools.length,\n };\n const groups: React.ReactElement[] = [];\n const group = (\n key: 'skills' | 'mcp' | 'system',\n label: string,\n rows: readonly React.ReactElement[],\n ): void => {\n if (kind !== 'all' && kind !== key) return;\n if (rows.length === 0) return;\n groups.push(React.createElement(\n 'section',\n { key, className: 'ci-preset-part' },\n React.createElement('h3', { className: 'ci-preset-part-title' }, label),\n React.createElement('ul', { className: 'ci-preset-tool-list' }, ...rows),\n ));\n };\n\n group(\n 'skills',\n t('group.skills', { shown: view.skills.length, total: totals.skills }),\n groupBy(view.skills, (skill) => skill.group ?? skill.source ?? 'unknown').flatMap(([groupKey, items], i) => [\n sourceDivider(groupKey, items, i === 0),\n ...items.map((skill) => skillRow(skill, selected.id)),\n ]),\n );\n\n const serverRow = (server: (typeof view.mcp)[number]): React.ReactElement => {\n const key = `mcp:${server.server}`;\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n return React.createElement(\n 'li',\n { key, className: 'ci-preset-group' },\n React.createElement(\n Collapsible.Root,\n {\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setExpanded((prev) => ({ ...prev, [key]: open })); },\n },\n React.createElement(\n 'div',\n { className: 'ci-row-head ci-preset-tool-row' },\n React.createElement(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger ci-preset-server-trigger',\n disabled: disclosure.disabled,\n },\n React.createElement('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n React.createElement(\n 'span',\n { className: 'ci-preset-tool-copy' },\n React.createElement('span', { className: 'ci-preset-tool-name' }, server.server),\n // Nothing is registered, so a tool count would be a lie: the\n // listed rows are this preset's stored default, not a roster.\n server.unavailable === true\n ? null\n : React.createElement(\n 'span',\n { className: 'ci-preset-tool-description' },\n server.tools.length === 1 ? t('server.tool.one') : t('server.tools', { count: server.tools.length }),\n ),\n ),\n ),\n // While the server is down there is no name to store a toggle\n // for: report the state and offer the one action that can still\n // change it. Reconnectable servers get a manual pull-up that does\n // not wait out the client's reconnect backoff.\n server.unavailable === true\n ? React.createElement(\n 'span',\n { className: 'ci-preset-badge', title: t('server.unavailableHint') },\n t('server.unavailable'),\n )\n : switchFor(\n server.enabled,\n false,\n t(server.enabled ? 'action.disable' : 'action.enable', { name: server.server }),\n (checked) => { void setPresetServer(selected.id, server.server, checked); },\n ),\n server.unavailable === true && server.reconnectable === true\n ? React.createElement(\n 'button',\n {\n type: 'button',\n className: `ci-reconnect${reconnecting === server.server ? ' ci-reconnect-busy' : ''}`,\n disabled: reconnecting !== null,\n title: reconnecting === server.server\n ? t('action.reload.ing', { name: server.server })\n : `${t('action.reload', { name: server.server })}\\n${t('action.reloadHint')}`,\n 'aria-label': t('action.reload', { name: server.server }),\n onClick: () => {\n if (reconnecting !== null) return;\n setReconnecting(server.server);\n void reconnectPresetServer(server.server).finally(() => { setTimeout(() => { setReconnecting(null); }, 2500); });\n },\n },\n React.createElement('span', { className: 'ci-reconnect-glyph', 'aria-hidden': true }, React.createElement(IconRefreshOutline14, { size: 12 })),\n t('action.reload.label'),\n )\n : null,\n ),\n React.createElement(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n React.createElement(\n 'ul',\n { className: 'ci-preset-tool-list' },\n ...server.tools.map((tool) => toolRow(tool, selected.id, true)),\n ),\n ),\n ),\n );\n };\n\n group(\n 'mcp',\n t('group.mcp', { shown: view.mcp.length, total: totals.mcp }),\n groupBy(view.mcp, (server) => server.source === undefined || server.source === 'host' ? 'host' : `preset:${server.source}`).flatMap(([groupKey, items], i) => [\n sourceDivider(groupKey, items, i === 0),\n ...items.map((server) => serverRow(server)),\n ]),\n );\n group(\n 'system',\n t('group.system', { shown: view.systemTools.length, total: totals.systemTools }),\n view.systemTools.map((tool) => toolRow(tool, selected.id, false)),\n );\n // Narrowing to a category that this preset has nothing in is a normal\n // outcome, not an error: say so rather than render an empty panel.\n if (groups.length === 0) {\n return React.createElement('p', null, filtering ? t('empty.match') : t('preset.noTools'));\n }\n return React.createElement(React.Fragment, null, ...groups);\n };\n\n return React.createElement(\n 'div',\n { className: 'ci-preset-section' },\n React.createElement('h2', { className: 'ci-settings-title' }, t('preset.title')),\n React.createElement('p', { className: 'ci-settings-intro' }, t('preset.intro')),\n state.error === null\n ? null\n : React.createElement('p', { role: 'alert', style: { color: TOK.error } }, t('status.error', { error: state.error })),\n state.loading && state.payload === null\n ? React.createElement('p', { 'aria-live': 'polite', style: { color: TOK.textTertiary } }, t('status.loading'))\n : null,\n state.payload === null\n ? null\n : React.createElement(\n React.Fragment,\n null,\n writable\n ? null\n : React.createElement('p', { role: 'note', className: 'ci-settings-note' }, t('preset.readonly')),\n React.createElement(\n 'div',\n { className: 'ci-preset-toolbar' },\n React.createElement(\n 'span',\n { className: 'ci-preset-picker-label' },\n React.createElement('span', null, t('preset.choose')),\n // The model selector's language: a borderless pill trigger and a\n // Menu the theme owns — a native <select> popup cannot follow\n // --dsw-* tokens, and its bordered box read as foreign here.\n React.createElement(\n Menu,\n {\n open: pickerOpen,\n anchor: React.createElement(\n 'button',\n {\n type: 'button',\n className: 'ci-preset-picker-trigger',\n // Menu renders role=\"menu\" (same as the host's model\n // selector); the visible text above is a layout sibling,\n // not a label, so name the trigger explicitly.\n 'aria-haspopup': 'menu',\n 'aria-expanded': pickerOpen,\n 'aria-label': t('preset.choose'),\n onClick: () => { setPickerOpen((open) => !open); },\n },\n React.createElement('span', { className: 'ci-preset-picker-name' }, selected?.name ?? ''),\n React.createElement(\n 'span',\n { className: `ci-preset-picker-chevron${pickerOpen ? ' ci-preset-picker-chevron-open' : ''}`, 'aria-hidden': true },\n React.createElement(IconChevronDownOutline14, { size: 14 }),\n ),\n ),\n items: state.payload.presets.map((preset) => ({ id: preset.id, label: preset.name })),\n ...(state.selectedId === null ? {} : { selectedId: state.selectedId }),\n onSelect: (id: string) => { selectPreset(id); setPickerOpen(false); },\n onClose: () => { setPickerOpen(false); },\n },\n ),\n ),\n React.createElement(Input, {\n className: 'ci-filter ci-preset-filter',\n value: query,\n placeholder: t('filter.placeholder'),\n 'aria-label': t('filter.aria'),\n autoComplete: 'off',\n spellCheck: false,\n name: 'ci-preset-filter',\n onChange: (event: { target: { value: string } }) => { setQuery(event.target.value); },\n onKeyDown: (event: { key: string }) => { if (event.key === 'Escape' && filtering) setQuery(''); },\n }),\n ),\n // Same three categories, same words, as the composer panel's tabs --\n // plus \"all\", because this panel is wide enough to show every group\n // at once and that is the useful default here.\n selected === undefined\n ? null\n : React.createElement(\n Tabs.Root,\n {\n value: kind,\n onValueChange: (value: string) => { setKind(value as 'all' | 'skills' | 'mcp' | 'system'); },\n className: 'ci-preset-kinds',\n },\n React.createElement(\n Tabs.List,\n { 'aria-label': t('preset.kindAria'), className: 'ci-tabs' },\n React.createElement(Tabs.Tab, { value: 'all', className: 'ci-tab' }, t('tab.all')),\n React.createElement(Tabs.Tab, { value: 'skills', className: 'ci-tab' }, `${t('tab.skills')} ${selected.skills.length}`),\n React.createElement(Tabs.Tab, { value: 'mcp', className: 'ci-tab' }, `${t('tab.mcp')} ${selected.mcp.length}`),\n React.createElement(\n Tabs.Tab,\n { value: 'system', className: 'ci-tab', 'aria-label': t('tab.system.aria', { count: selected.systemTools.length }) },\n `${t('tab.system')} ${selected.systemTools.length}`,\n ),\n ),\n ),\n selected?.description === undefined\n ? null\n : React.createElement('p', { className: 'ci-settings-description' }, selected.description),\n view === null || !filtering\n ? null\n : React.createElement(\n 'p',\n { 'aria-live': 'polite', className: 'ci-settings-description' },\n t('filter.count', { shown: view.total, total: selected === undefined ? 0 : selected.skills.length + selected.mcp.length + selected.systemTools.length }),\n ),\n body(),\n ),\n );\n}\n","import { isMouseLikePointerType } from \"../utils/event.mjs\";\nexport { isTargetInsideEnabledTrigger as isInsideEnabledTrigger } from \"../utils/element.mjs\";\nfunction resolveValue(value, pointerType) {\n if (pointerType != null && !isMouseLikePointerType(pointerType)) {\n return 0;\n }\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function getDelay(value, prop, pointerType) {\n const result = resolveValue(value, pointerType);\n if (typeof result === 'number') {\n return result;\n }\n return result?.[prop];\n}\nexport function getRestMs(value) {\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function isClickLikeOpenEvent(openEventType, interactedInside) {\n return interactedInside || openEventType === 'click' || openEventType === 'mousedown';\n}\nexport function isHoverOpenEvent(openEventType) {\n return openEventType?.includes('mouse') && openEventType !== 'mousedown';\n}","/**\n * Combines multiple cleanup functions into a single cleanup function.\n */\nexport function mergeCleanups(...cleanups) {\n return () => {\n for (let i = 0; i < cleanups.length; i += 1) {\n const cleanup = cleanups[i];\n if (cleanup) {\n cleanup();\n }\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { platform } from '@base-ui/utils/platform';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n const [role, setRole] = React.useState();\n useIsoLayoutEffect(() => {\n // Unlike NVDA and JAWS, VoiceOver's virtual cursor triggers `onFocus` as\n // it moves — but only on focusable/role-button elements through WebKit's\n // NSAccessibility path. Setting `role=\"button\"` lets the focus trap catch\n // the cursor.\n if (platform.screenReader.voiceOver && platform.engine.webkit) {\n setRole('button');\n }\n }, []);\n const restProps = {\n tabIndex: 0,\n // Role is only for VoiceOver\n role\n };\n return /*#__PURE__*/_jsx(\"span\", {\n ...props,\n ref: ref,\n style: visuallyHidden,\n \"aria-hidden\": role ? undefined : true,\n ...restProps,\n \"data-base-ui-focus-guard\": \"\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") FocusGuard.displayName = \"FocusGuard\";","export function createAttribute(name) {\n return `data-base-ui-${name}`;\n}","import { NOOP } from '@base-ui/utils/empty';\nlet rafId = 0;\nexport function enqueueFocus(el, options = {}) {\n const {\n preventScroll = false,\n sync = false,\n shouldFocus\n } = options;\n cancelAnimationFrame(rafId);\n function exec() {\n if (shouldFocus && !shouldFocus()) {\n return;\n }\n el?.focus({\n preventScroll\n });\n }\n if (sync) {\n exec();\n return NOOP;\n }\n const currentRafId = requestAnimationFrame(exec);\n rafId = currentRafId;\n return () => {\n if (rafId === currentRafId) {\n cancelAnimationFrame(currentRafId);\n rafId = 0;\n }\n };\n}","// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nimport { getNodeName, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nconst counters = {\n inert: new WeakMap(),\n 'aria-hidden': new WeakMap()\n};\nconst markerName = 'data-base-ui-inert';\nconst uncontrolledElementsSets = {\n inert: new WeakSet(),\n 'aria-hidden': new WeakSet()\n};\nlet markerCounterMap = new WeakMap();\nlet lockCount = 0;\nfunction getUncontrolledElementsSet(controlAttribute) {\n return uncontrolledElementsSets[controlAttribute];\n}\nfunction unwrapHost(node) {\n if (!node) {\n return null;\n }\n return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);\n}\nconst correctElements = (parent, targets) => targets.map(target => {\n if (parent.contains(target)) {\n return target;\n }\n const correctedTarget = unwrapHost(target);\n if (parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n return null;\n}).filter(x => x != null);\nconst buildKeepSet = targets => {\n const keep = new Set();\n targets.forEach(target => {\n let node = target;\n while (node && !keep.has(node)) {\n keep.add(node);\n node = node.parentNode;\n }\n });\n return keep;\n};\nconst collectOutsideElements = (root, keepElements, stopElements) => {\n const outside = [];\n const walk = parent => {\n if (!parent || stopElements.has(parent)) {\n return;\n }\n Array.from(parent.children).forEach(node => {\n if (getNodeName(node) === 'script') {\n return;\n }\n if (keepElements.has(node)) {\n walk(node);\n } else {\n outside.push(node);\n }\n });\n };\n walk(root);\n return outside;\n};\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {\n mark = true\n}) {\n let controlAttribute = null;\n if (inert) {\n controlAttribute = 'inert';\n } else if (ariaHidden) {\n controlAttribute = 'aria-hidden';\n }\n let counterMap = null;\n let uncontrolledElementsSet = null;\n const avoidElements = correctElements(body, uncorrectedAvoidElements);\n const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];\n const hiddenElements = [];\n const markedElements = [];\n if (controlAttribute) {\n const map = counters[controlAttribute];\n const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);\n uncontrolledElementsSet = currentUncontrolledElementsSet;\n counterMap = map;\n const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));\n const controlElements = avoidElements.concat(ariaLiveElements);\n const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));\n controlTargets.forEach(node => {\n const attr = node.getAttribute(controlAttribute);\n const alreadyHidden = attr !== null && attr !== 'false';\n const counterValue = (map.get(node) || 0) + 1;\n map.set(node, counterValue);\n hiddenElements.push(node);\n if (counterValue === 1 && alreadyHidden) {\n currentUncontrolledElementsSet.add(node);\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n }\n });\n }\n if (mark) {\n markerTargets.forEach(node => {\n const markerValue = (markerCounterMap.get(node) || 0) + 1;\n markerCounterMap.set(node, markerValue);\n markedElements.push(node);\n if (markerValue === 1) {\n node.setAttribute(markerName, '');\n }\n });\n }\n lockCount += 1;\n return () => {\n if (counterMap) {\n hiddenElements.forEach(element => {\n const currentCounterValue = counterMap.get(element) || 0;\n const counterValue = currentCounterValue - 1;\n counterMap.set(element, counterValue);\n if (!counterValue) {\n if (!uncontrolledElementsSet?.has(element) && controlAttribute) {\n element.removeAttribute(controlAttribute);\n }\n uncontrolledElementsSet?.delete(element);\n }\n });\n }\n if (mark) {\n markedElements.forEach(element => {\n const markerValue = (markerCounterMap.get(element) || 0) - 1;\n markerCounterMap.set(element, markerValue);\n if (!markerValue) {\n element.removeAttribute(markerName);\n }\n });\n }\n lockCount -= 1;\n if (!lockCount) {\n counters.inert = new WeakMap();\n counters['aria-hidden'] = new WeakMap();\n uncontrolledElementsSets.inert = new WeakSet();\n uncontrolledElementsSets['aria-hidden'] = new WeakSet();\n markerCounterMap = new WeakMap();\n }\n };\n}\nexport function markOthers(avoidElements, options = {}) {\n const {\n ariaHidden = false,\n inert = false,\n mark = true\n } = options;\n const body = ownerDocument(avoidElements[0]).body;\n return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {\n mark\n });\n}","export const TYPEAHEAD_RESET_MS = 500;\nexport const PATIENT_CLICK_THRESHOLD = 500;\nexport const DISABLED_TRANSITIONS_STYLE = {\n style: {\n transition: 'none'\n }\n};\nexport const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';\nexport const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';\nexport const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';\nexport const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;\nexport const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;\n\n/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'none'\n};\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'end'\n};\n\n/**\n * Special visually hidden styles for the aria-owns owner element to ensure owned element\n * accessibility in iOS/Safari/VoiceControl.\n * The owner element is an empty span, so most of the common visually hidden styles are not needed.\n * @see https://github.com/floating-ui/floating-ui/issues/3403\n */\nexport const ownerVisuallyHidden = {\n clipPath: 'inset(50%)',\n position: 'fixed',\n top: 0,\n left: 0\n};","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { isNode } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { enableFocusInside, disableFocusInside, getPreviousTabbable, getNextTabbable, isOutsideEvent } from \"../utils/tabbable.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ownerVisuallyHidden } from \"../../internals/constants.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") PortalContext.displayName = \"PortalContext\";\nexport const usePortalContext = () => React.useContext(PortalContext);\nconst attr = createAttribute('portal');\nexport function useFloatingPortalNode(props = {}) {\n const {\n ref,\n container: containerProp,\n componentProps = EMPTY_OBJECT,\n elementProps\n } = props;\n const uniqueId = useId();\n const portalContext = usePortalContext();\n const parentPortalNode = portalContext?.portalNode;\n const [containerElement, setContainerElement] = React.useState(null);\n const [portalNode, setPortalNode] = React.useState(null);\n const setPortalNodeRef = useStableCallback(node => {\n if (node !== null) {\n // the useIsoLayoutEffect below watching containerProp / parentPortalNode\n // sets setPortalNode(null) when the container becomes null or changes.\n // So even though the ref callback now ignores null, the portal node still gets cleared.\n setPortalNode(node);\n }\n });\n const containerRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n // Wait for the container to be resolved if explicitly `null`.\n if (containerProp === null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;\n if (resolvedContainer == null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n if (containerRef.current !== resolvedContainer) {\n containerRef.current = resolvedContainer;\n setPortalNode(null);\n setContainerElement(resolvedContainer);\n }\n }, [containerProp, parentPortalNode]);\n const portalElement = useRenderElement('div', componentProps, {\n ref: [ref, setPortalNodeRef],\n props: [{\n id: uniqueId,\n [attr]: ''\n }, elementProps]\n });\n\n // This `createPortal` call injects `portalElement` into the `container`.\n // Another call inside `FloatingPortal`/`FloatingPortalLite` then injects the children into `portalElement`.\n const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ReactDOM.createPortal(portalElement, containerElement) : null;\n return {\n node: portalNode,\n // `id` and `render` props can override or remove the generated ID. Use the exact\n // rendered value so `aria-owns` never points at an ID absent from the DOM.\n nodeId: /*#__PURE__*/React.isValidElement(portalElement) ? portalElement.props.id : undefined,\n subtree: portalSubtree\n };\n}\n\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n * @internal\n */\nexport const FloatingPortal = /*#__PURE__*/React.forwardRef(function FloatingPortal(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n container,\n ...elementProps\n } = componentProps;\n const {\n node: portalNode,\n nodeId: portalNodeId,\n subtree: portalSubtree\n } = useFloatingPortalNode({\n container,\n ref: forwardedRef,\n componentProps,\n elementProps\n });\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const [focusManagerState, setFocusManagerState] = React.useState(null);\n const focusInsideDisabledRef = React.useRef(false);\n const modal = focusManagerState?.modal;\n const open = focusManagerState?.open;\n const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!portalNode || modal) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (portalNode && event.relatedTarget && isOutsideEvent(event)) {\n if (event.type === 'focusin') {\n if (focusInsideDisabledRef.current) {\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }\n } else {\n disableFocusInside(portalNode);\n focusInsideDisabledRef.current = true;\n }\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));\n }, [portalNode, modal]);\n useIsoLayoutEffect(() => {\n if (!portalNode || open !== true || !focusInsideDisabledRef.current) {\n return;\n }\n\n // Restore tabbability before the focus manager's queued focus-on-open step runs.\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }, [open, portalNode]);\n const portalContextValue = React.useMemo(() => ({\n beforeOutsideRef,\n afterOutsideRef,\n beforeInsideRef,\n afterInsideRef,\n portalNode,\n setFocusManagerState\n }), [portalNode]);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [portalSubtree, /*#__PURE__*/_jsxs(PortalContext.Provider, {\n value: portalContextValue,\n children: [shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: beforeOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n beforeInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n }\n }\n }), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(\"span\", {\n \"aria-owns\": portalNodeId,\n style: ownerVisuallyHidden\n }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: afterOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n afterInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n if (focusManagerState?.closeOnFocusOut) {\n focusManagerState?.onOpenChange(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") FloatingPortal.displayName = \"FloatingPortal\";","export function createEventEmitter() {\n const map = new Map();\n return {\n emit(event, data) {\n map.get(event)?.forEach(listener => listener(data));\n },\n on(event, listener) {\n if (!map.has(event)) {\n map.set(event, new Set());\n }\n map.get(event).add(listener);\n },\n off(event, listener) {\n map.get(event)?.delete(listener);\n }\n };\n}","import { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\n\n/**\n * Stores and manages floating elements in a tree structure.\n * This is a backing store for the `FloatingTree` component.\n */\nexport class FloatingTreeStore {\n nodesRef = {\n current: []\n };\n events = createEventEmitter();\n addNode(node) {\n this.nodesRef.current.push(node);\n }\n removeNode(node) {\n const index = this.nodesRef.current.findIndex(n => n === node);\n if (index !== -1) {\n this.nodesRef.current.splice(index, 1);\n }\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FloatingTreeStore } from \"./FloatingTreeStore.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") FloatingNodeContext.displayName = \"FloatingNodeContext\";\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nif (process.env.NODE_ENV !== \"production\") FloatingTreeContext.displayName = \"FloatingTreeContext\";\nexport const useFloatingParentNodeId = () => React.useContext(FloatingNodeContext)?.id || null;\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nexport const useFloatingTree = externalTree => {\n const contextTree = React.useContext(FloatingTreeContext);\n return externalTree ?? contextTree;\n};\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nexport function useFloatingNodeId(externalTree) {\n const id = useId();\n const tree = useFloatingTree(externalTree);\n const parentId = useFloatingParentNodeId();\n useIsoLayoutEffect(() => {\n if (!id) {\n return undefined;\n }\n const node = {\n id,\n parentId\n };\n tree?.addNode(node);\n return () => {\n tree?.removeNode(node);\n };\n }, [tree, id, parentId]);\n return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingNode(props) {\n const {\n children,\n id\n } = props;\n const parentId = useFloatingParentNodeId();\n return /*#__PURE__*/_jsx(FloatingNodeContext.Provider, {\n value: React.useMemo(() => ({\n id,\n parentId\n }), [id, parentId]),\n children: children\n });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingTree(props) {\n const {\n children,\n externalTree\n } = props;\n const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;\n return /*#__PURE__*/_jsx(FloatingTreeContext.Provider, {\n value: tree,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { platform } from '@base-ui/utils/platform';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { activeElement, contains, getTarget, isTypeableCombobox, getFloatingFocusElement, isTypeableElement } from \"../utils/element.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nimport { tabbable, focusable, isOutsideEvent, isTabbable, getNextTabbable, getPreviousTabbable } from \"../utils/tabbable.mjs\";\nimport { getNodeAncestors, getNodeChildren } from \"../utils/nodes.mjs\";\nimport { isElementVisible } from \"../utils/composite.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { markOthers } from \"../utils/markOthers.mjs\";\nimport { usePortalContext } from \"./FloatingPortal.mjs\";\nimport { useFloatingTree } from \"./FloatingTree.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { resolveRef } from \"../../utils/resolveRef.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction getEventType(event, lastInteractionType) {\n const win = ownerWindow(getTarget(event));\n if (event instanceof win.KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof win.FocusEvent) {\n // Focus events can be caused by a preceding pointer interaction (e.g., focusout on outside press).\n // Prefer the last known pointer type if provided, else treat as keyboard.\n return lastInteractionType || 'keyboard';\n }\n if ('pointerType' in event) {\n return event.pointerType || 'keyboard';\n }\n if ('touches' in event) {\n return 'touch';\n }\n if (event instanceof win.MouseEvent) {\n // onClick events may not contain pointer events, and will fall through to here\n return lastInteractionType || (event.detail === 0 ? 'keyboard' : 'mouse');\n }\n return '';\n}\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n previouslyFocusedElements = previouslyFocusedElements.filter(entry => {\n return entry.deref()?.isConnected;\n });\n}\nfunction addPreviouslyFocusedElement(element) {\n clearDisconnectedPreviouslyFocusedElements();\n if (element && getNodeName(element) !== 'body') {\n previouslyFocusedElements.push(new WeakRef(element));\n if (previouslyFocusedElements.length > LIST_LIMIT) {\n previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);\n }\n }\n}\nfunction getPreviouslyFocusedElement() {\n clearDisconnectedPreviouslyFocusedElements();\n return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();\n}\nfunction getFirstTabbableElement(container) {\n if (!container) {\n return null;\n }\n if (isTabbable(container)) {\n return container;\n }\n return tabbable(container)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement) {\n if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {\n return;\n }\n if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) {\n return;\n }\n const focusableElements = focusable(floatingFocusElement);\n const tabbableContent = focusableElements.filter(element => {\n const dataTabIndex = element.getAttribute('data-tabindex') || '';\n return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n });\n const tabIndex = floatingFocusElement.getAttribute('tabindex');\n if (tabbableContent.length === 0) {\n if (tabIndex !== '0') {\n floatingFocusElement.setAttribute('tabindex', '0');\n // Mark our own write so the externally-managed early-return above doesn't\n // mistake it for a user-authored `tabindex` and freeze management.\n floatingFocusElement.setAttribute('data-tabindex', '0');\n }\n } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n floatingFocusElement.setAttribute('tabindex', '-1');\n floatingFocusElement.setAttribute('data-tabindex', '-1');\n }\n}\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n * @internal\n */\nexport function FloatingFocusManager(props) {\n const {\n context,\n children,\n disabled = false,\n initialFocus = true,\n returnFocus = true,\n restoreFocus = false,\n modal = true,\n closeOnFocusOut = true,\n openInteractionType = '',\n nextFocusableElement,\n previousFocusableElement,\n beforeContentFocusGuardRef,\n externalTree,\n getInsideElements\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const domReference = store.useState('domReferenceElement');\n const floating = store.useState('floatingElement');\n const {\n events,\n dataRef\n } = store.context;\n const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);\n const ignoreInitialFocus = initialFocus === false;\n // A typeable combobox reference (e.g. input/textarea) with `initialFocus={false}`\n // has different focus semantics: focus is not trapped inside the floating element,\n // so in the modal case the guards are not rendered, but `aria-hidden` is still\n // applied to the outside nodes.\n const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n const initialFocusRef = useValueAsRef(initialFocus);\n const returnFocusRef = useValueAsRef(returnFocus);\n const openInteractionTypeRef = useValueAsRef(openInteractionType);\n const openRef = useValueAsRef(open);\n const tree = useFloatingTree(externalTree);\n const portalContext = usePortalContext();\n const preventReturnFocusRef = React.useRef(false);\n const isPointerDownRef = React.useRef(false);\n const pointerDownOutsideRef = React.useRef(false);\n const lastFocusedTabbableRef = React.useRef(null);\n const closeTypeRef = React.useRef('');\n const lastInteractionTypeRef = React.useRef('');\n const beforeGuardRef = React.useRef(null);\n const afterGuardRef = React.useRef(null);\n const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);\n const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);\n const blurTimeout = useTimeout();\n const pointerDownTimeout = useTimeout();\n const restoreFocusFrame = useAnimationFrame();\n const isInsidePortal = portalContext != null;\n const floatingFocusElement = getFloatingFocusElement(floating);\n const getTabbableContent = useStableCallback((container = floatingFocusElement) => {\n return container ? tabbable(container) : [];\n });\n const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);\n\n // Prevent Tab from escaping the modal when there are no tabbable elements.\n React.useEffect(() => {\n if (disabled || !modal) {\n return undefined;\n }\n function onKeyDown(event) {\n if (event.key === 'Tab') {\n // The focus guards have nothing to focus, so we need to stop the event.\n if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n stopEvent(event);\n }\n }\n }\n const doc = ownerDocument(floatingFocusElement);\n return addEventListener(doc, 'keydown', onKeyDown);\n }, [disabled, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);\n\n // Track pointer/keyboard interactions to disambiguate focus and outside presses.\n React.useEffect(() => {\n if (disabled || !open) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n function clearPointerDownOutside() {\n pointerDownOutsideRef.current = false;\n }\n function onPointerDown(event) {\n const target = getTarget(event);\n const insideElements = getResolvedInsideElements();\n const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));\n pointerDownOutsideRef.current = !pointerTargetInside;\n lastInteractionTypeRef.current = event.pointerType || 'keyboard';\n if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {\n isPointerDownRef.current = true;\n // Reset on the next tick so a single click on a click-trigger doesn't\n // permanently suppress focus-out closing for the lifetime of the instance.\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n }\n function onKeyDown() {\n lastInteractionTypeRef.current = 'keyboard';\n }\n return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true),\n // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)\n // if the popup dismissed between pointerdown and pointerup.\n clearPointerDownOutside);\n }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);\n\n // Close on focus out and restore focus within the floating tree when needed.\n React.useEffect(() => {\n if (disabled || !closeOnFocusOut) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n\n // In Safari, buttons lose focus when pressing them.\n function handlePointerDown() {\n isPointerDownRef.current = true;\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n function handleFocusIn(event) {\n const target = getTarget(event);\n if (isTabbable(target)) {\n lastFocusedTabbableRef.current = target;\n }\n }\n function handleFocusOutside(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n const target = getTarget(event);\n\n // When focus is lost to the body (e.g. on a backdrop press), record the element that\n // had focus so a confirmation dialog opened while the body is focused can return focus\n // to it. Scoped to `modal` to avoid non-modal popups polluting the shared stack.\n if (modal && relatedTarget == null && target != null && contains(floating, target)) {\n addPreviouslyFocusedElement(target);\n }\n queueMicrotask(() => {\n const nodeId = getNodeId();\n const triggers = store.context.triggerElements;\n const insideElements = getResolvedInsideElements();\n const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);\n const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));\n if (currentTarget === domReference && floatingFocusElement) {\n handleTabIndex(floatingFocusElement);\n }\n\n // Restore focus to the previously focused tabbable element to prevent\n // focus from being lost outside the floating tree.\n if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {\n // Let `FloatingPortal` effect knows that focus is still inside the\n // floating tree.\n if (isHTMLElement(floatingFocusElement)) {\n floatingFocusElement.focus();\n // If explicitly requested to restore focus to the popup container, do not search\n // for the next/previous tabbable element.\n if (restoreFocus === 'popup') {\n // If the focused element is removed on pointerdown, the browser\n // tries to move focus to it right after the `.focus()` call above,\n // but because it's removed in the same tick, focus is lost instead.\n // Re-focusing asynchronously (next frame) wins that race.\n restoreFocusFrame.request(() => {\n floatingFocusElement.focus();\n });\n return;\n }\n }\n const tabbableContent = getTabbableContent();\n const prevTabbable = lastFocusedTabbableRef.current;\n const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n if (isHTMLElement(nodeToFocus)) {\n nodeToFocus.focus();\n }\n }\n\n // https://github.com/floating-ui/floating-ui/issues/3060\n if (dataRef.current.insideReactTree) {\n dataRef.current.insideReactTree = false;\n return;\n }\n\n // Focus did not move inside the floating tree, and there are no tabbable\n // portal guards to handle closing.\n if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (\n // Fix React 18 Strict Mode returnFocus due to double rendering.\n // For an \"untrapped\" typeable combobox (input role=combobox with\n // initialFocus=false), re-opening the popup and tabbing out should still close it even\n // when the previously focused element (e.g. the next tabbable outside the popup) is\n // focused again. Otherwise, the popup remains open on the second Tab sequence:\n // click input -> Tab (closes) -> click input -> Tab.\n // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.\n isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {\n preventReturnFocusRef.current = true;\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event));\n }\n });\n }\n function markInsideReactTree() {\n if (pointerDownOutsideRef.current) {\n return;\n }\n dataRef.current.insideReactTree = true;\n blurTimeout.start(0, () => {\n dataRef.current.insideReactTree = false;\n });\n }\n const domReferenceElement = isHTMLElement(domReference) ? domReference : null;\n if (!floating && !domReferenceElement) {\n return undefined;\n }\n return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));\n }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Hide everything outside the floating tree from assistive tech while open.\n React.useEffect(() => {\n if (disabled || !floating || !open) {\n return undefined;\n }\n\n // Don't hide portals nested within the parent portal.\n const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);\n const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;\n const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];\n const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n const ariaHiddenCleanup = markOthers(insideElements, {\n ariaHidden: modal || isUntrappedTypeableCombobox,\n mark: false\n });\n const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);\n const markerCleanup = markOthers(markerInsideElements);\n return () => {\n markerCleanup();\n ariaHiddenCleanup();\n };\n }, [open, disabled, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Focus the initial element when the floating element opens.\n useIsoLayoutEffect(() => {\n if (!open || disabled || !isHTMLElement(floatingFocusElement)) {\n return;\n }\n closeTypeRef.current = '';\n lastInteractionTypeRef.current = '';\n const doc = ownerDocument(floatingFocusElement);\n const previouslyFocusedElement = activeElement(doc);\n\n // Wait for any layout effect state setters to execute to set `tabIndex`.\n queueMicrotask(() => {\n const initialFocusValueOrFn = initialFocusRef.current;\n const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {\n return;\n }\n const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);\n if (focusAlreadyInsideFloatingEl) {\n return;\n }\n let focusableElements = null;\n const getDefaultFocusElement = () => {\n if (focusableElements == null) {\n focusableElements = getTabbableContent(floatingFocusElement);\n }\n return focusableElements[0] || floatingFocusElement;\n };\n let elToFocus;\n if (resolvedInitialFocus === true || resolvedInitialFocus === null) {\n elToFocus = getDefaultFocusElement();\n } else {\n elToFocus = resolveRef(resolvedInitialFocus);\n }\n elToFocus = elToFocus || getDefaultFocusElement();\n const hadFocusInside = contains(floatingFocusElement, activeElement(doc));\n\n // enqueueFocus returns a rAF-cancel function; we intentionally don't cancel this focus.\n void enqueueFocus(elToFocus, {\n preventScroll: elToFocus === floatingFocusElement,\n shouldFocus() {\n // This focus is queued on the next animation frame. If the floating element has closed\n // before it runs — e.g. tabbing out of a kept-mounted popup — don't pull focus back\n // onto the initial element after it has legitimately moved elsewhere.\n if (!openRef.current) {\n return false;\n }\n if (hadFocusInside) {\n return true;\n }\n const currentActiveElement = activeElement(doc);\n const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);\n return !focusMovedInside;\n }\n });\n });\n }, [disabled, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);\n\n // Track return focus targets and restore focus on unmount/close.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n const elementFocusedBeforeOpen = activeElement(doc);\n // Only an explicit `null` interaction type represents a programmatic open.\n // `undefined` is normalized to `''` by the prop default, so it never reaches\n // here as nullish and is intentionally not treated as programmatic.\n const preferPreviousFocus = openInteractionTypeRef.current == null;\n addPreviouslyFocusedElement(elementFocusedBeforeOpen);\n function onOpenChangeLocal(details) {\n if (!details.open) {\n closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);\n }\n if (details.reason === REASONS.triggerHover && details.nativeEvent.type === 'mouseleave') {\n preventReturnFocusRef.current = true;\n }\n if (details.reason !== REASONS.outsidePress) {\n return;\n }\n if (details.nested) {\n preventReturnFocusRef.current = false;\n } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {\n preventReturnFocusRef.current = false;\n } else {\n // On outside press, only return focus to the reference when the browser supports the\n // `focus({ preventScroll })` option; without it, restoring focus scrolls the page.\n // Chrome on Android and Samsung Internet still don't support `preventScroll`\n // (https://issues.chromium.org/issues/41453122), so the runtime check keeps return\n // focus disabled there to avoid the scroll jump.\n let isPreventScrollSupported = false;\n ownerDocument(floatingFocusElement).createElement('div').focus({\n get preventScroll() {\n isPreventScrollSupported = true;\n return false;\n }\n });\n if (isPreventScrollSupported) {\n preventReturnFocusRef.current = false;\n } else {\n preventReturnFocusRef.current = true;\n }\n }\n }\n events.on('openchange', onOpenChangeLocal);\n function getReturnElement(closeType) {\n const returnFocusValueOrFn = returnFocusRef.current;\n let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedReturnFocusValue === undefined || resolvedReturnFocusValue === false) {\n return null;\n }\n if (resolvedReturnFocusValue === null) {\n resolvedReturnFocusValue = true;\n }\n const referenceReturnElement = domReference?.isConnected ? domReference : null;\n const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== 'body' ? elementFocusedBeforeOpen : null;\n let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;\n if (!defaultReturnElement) {\n defaultReturnElement = getPreviouslyFocusedElement() || null;\n }\n if (typeof resolvedReturnFocusValue === 'boolean') {\n return defaultReturnElement;\n }\n return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;\n }\n return () => {\n events.off('openchange', onOpenChangeLocal);\n const activeEl = activeElement(doc);\n const insideElements = getResolvedInsideElements();\n const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const returnFocusValueOrFn = returnFocusRef.current;\n const closeType = closeTypeRef.current;\n const returnElement = getReturnElement(closeType);\n queueMicrotask(() => {\n // `returnElement` if it is tabbable, otherwise its first tabbable child,\n // otherwise `returnElement` itself (which may not be tabbable at all).\n const tabbableReturnElement = getFirstTabbableElement(returnElement);\n const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';\n if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n // If the focus moved somewhere else after mount, avoid returning focus\n // since it likely entered a different element which should be\n // respected: https://github.com/floating-ui/floating-ui/issues/2607\n !hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n const focusOptions = {\n preventScroll: true\n };\n if (closeType === 'keyboard') {\n focusOptions.focusVisible = true;\n }\n tabbableReturnElement.focus(focusOptions);\n }\n preventReturnFocusRef.current = false;\n });\n };\n }, [disabled, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);\n\n // Safari may randomly scroll to the bottom of the page if an input inside a popup has focus\n // when the popup unmounts from the DOM.\n // By blurring it before the popup unmounts, we can prevent this behavior.\n useIsoLayoutEffect(() => {\n if (!platform.engine.webkit || open || !floating) {\n return;\n }\n const activeEl = activeElement(ownerDocument(floating));\n if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {\n return;\n }\n if (contains(floating, activeEl)) {\n activeEl.blur();\n }\n }, [open, floating]);\n\n // Synchronize the focus manager state (modal, closeOnFocusOut, open, etc.) to the\n // FloatingPortal context, which uses it to decide whether to render its own guards.\n useIsoLayoutEffect(() => {\n if (disabled || !portalContext) {\n return undefined;\n }\n portalContext.setFocusManagerState({\n modal,\n closeOnFocusOut,\n open,\n onOpenChange: store.setOpen,\n domReference\n });\n return () => {\n portalContext.setFocusManagerState(null);\n };\n }, [disabled, portalContext, modal, open, store, closeOnFocusOut, domReference]);\n\n // Keep the floating element tabIndex in sync and clear stale focus records.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n handleTabIndex(floatingFocusElement);\n return () => {\n queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n };\n }, [disabled, floatingFocusElement]);\n const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedBeforeGuardRef,\n onFocus: event => {\n if (modal) {\n const els = getTabbableContent();\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(els[els.length - 1]);\n } else if (portalContext?.portalNode) {\n preventReturnFocusRef.current = false;\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n } else {\n resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();\n }\n }\n }\n }), children, shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedAfterGuardRef,\n onFocus: event => {\n if (modal) {\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(getTabbableContent()[0]);\n } else if (portalContext?.portalNode) {\n if (closeOnFocusOut) {\n preventReturnFocusRef.current = true;\n }\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n } else {\n resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();\n }\n }\n }\n })]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getTarget, isTypeableElement } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType, isVirtualPointerEvent } from \"../utils/event.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nexport function useClick(context, props = {}) {\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n stickIfOpen = true,\n touchOpenDelay = 0,\n reason = REASONS.triggerPress\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const dataRef = store.context.dataRef;\n const pointerTypeRef = React.useRef(undefined);\n const frame = useAnimationFrame();\n const touchOpenTimeout = useTimeout();\n const reference = React.useMemo(() => {\n function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {\n const details = createChangeEventDetails(reason, nativeEvent, target);\n if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {\n touchOpenTimeout.start(touchOpenDelay, () => {\n store.setOpen(true, details);\n });\n } else {\n store.setOpen(nextOpen, details);\n }\n }\n function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {\n const openEvent = dataRef.current.openEvent;\n const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== currentTarget;\n if (open && hasClickedOnInactiveTrigger) {\n // Moving between triggers should always open the newly active one.\n return true;\n }\n if (!open) {\n // A closed popup should open on the next press.\n return true;\n }\n if (!toggle) {\n // Non-toggle mode never closes on a repeated trigger press.\n return true;\n }\n if (openEvent && stickIfOpen) {\n // Preserve hover/focus-opened popups until the matching click-like event closes them.\n return !isClickLikeOpenEvent(openEvent.type);\n }\n\n // Otherwise, a repeated click toggles the popup closed.\n return false;\n }\n return {\n onPointerDown(event) {\n // Screen reader activations (Android TalkBack, desktop screen readers) report a\n // mouse-like `pointerType`, but `ignoreMouse` must not drop them: hover logic cannot\n // open for a virtual press since there is no real pointer movement to wait for.\n // Virtual `touch` presses (iOS VoiceOver) keep their type so `touchOpenDelay` applies.\n pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? 'virtual' : event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n const nativeEvent = event.nativeEvent;\n const open = store.select('open');\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0 || eventOption === 'click' || isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown');\n\n // Animations sometimes won't run on a typeable element if using a rAF.\n // Focus is always set on these elements. For touch, we may delay opening.\n const target = getTarget(nativeEvent);\n if (isTypeableElement(target)) {\n setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);\n return;\n }\n\n // Capture the currentTarget before the rAF.\n // as React sets it to null after the event handler completes.\n const eventCurrentTarget = event.currentTarget;\n\n // Wait until focus is set on the element. This is an alternative to\n // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.\n frame.request(() => {\n setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);\n });\n },\n onClick(event) {\n if (eventOption === 'mousedown-only') {\n return;\n }\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerType) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const open = store.select('open');\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown' || openEventType === 'keydown' || openEventType === 'keyup');\n setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);\n },\n onKeyDown() {\n pointerTypeRef.current = undefined;\n }\n };\n }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);\n return React.useMemo(() => enabled ? {\n reference\n } : EMPTY_OBJECT, [enabled, reference]);\n}","'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n React.useEffect(() => {\n if (!open || !enabled) {\n return clearInsideReactTree;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // In intentional mode, a press that starts inside and ends outside gets\n // one suppressed outside click. Run this after inside-target checks so\n // inside clicks don't consume the one-shot suppression.\n if (getOutsidePressEvent() === 'intentional' && suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n if (event.type === 'pointerdown') {\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const doc = ownerDocument(floatingElement);\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, true), addEventListener(doc, 'touchmove', handleTouchMoveCapture, true), addEventListener(doc, 'touchend', handleTouchEndCapture, true)));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n clearInsideReactTree();\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n const alignment = getAlignment(placement);\n if (alignment) {\n coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(minPadding, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n\n // No rects (e.g. a hidden or detached reference, or a collapsed range) —\n // keep the existing reference rect rather than resetting to an invalid\n // one with non-finite values.\n if (!nativeClientRects.length) {\n return {};\n }\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n return rectToClientRect({\n x: left,\n y: top,\n width: right - left,\n height: bottom - top\n });\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n return rectToClientRect({\n x: minLeft,\n y: top,\n width: maxRight - minLeft,\n height: bottom - top\n });\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);\n if (checkMainAxis) {\n mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);\n }\n if (checkCrossAxis) {\n crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n var _rawOffset$mainAxis, _rawOffset$crossAxis;\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,\n crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n// Method syntax keeps callback parameters bivariant, but expressing the\n// explicit `| undefined` required by `exactOptionalPropertyTypes` needs\n// property syntax, which is contravariant under `strictFunctionTypes`.\n// Extracting the function from a method position restores that bivariance so\n// consumers can still assign callbacks with narrower parameter types.\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const shiftData = state.middlewareData.shift;\n const noShift = !shiftData;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if (shiftData != null && shiftData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if (shiftData != null && shiftData.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n if (isYAxis) {\n availableWidth = width - 2 * max(overflow.left, overflow.right);\n } else {\n availableHeight = height - 2 * max(overflow.top, overflow.bottom);\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement && offsetParent) {\n const win = getWindow(domElement);\n const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return element.getClientRects ? Array.from(element.getClientRects()) : [];\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(html) {\n const scroll = getNodeScroll(html);\n const body = html.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(html);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy, rootBoundary) {\n if (rootBoundary === void 0) {\n rootBoundary = 'viewport';\n }\n const isLayoutViewport = rootBoundary === 'layoutViewport';\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n // Client coordinates are relative to the layout viewport, except in\n // WebKit with an `absolute` strategy, where they are relative to the\n // visual viewport.\n const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';\n if (isLayoutViewport) {\n if (!layoutRelativeClientCoords) {\n x = -visualViewport.offsetLeft;\n y = -visualViewport.offsetTop;\n }\n } else {\n width = visualViewport.width;\n height = visualViewport.height;\n if (layoutRelativeClientCoords) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks\n // the visual width but isn't reflected in `html.clientWidth`, so subtract it.\n // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also\n // reserves an empty inline-start gutter that clips nothing, so exclude just\n // the one scrollbar-side gutter — halve the measured (two-gutter) total. A\n // left-side scrollbar (`windowScrollbarX > 0`) is already handled by\n // `getHTMLOffset`/`visualViewport.width`; skip it here.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;\n if (gutter <= SCROLLBAR_MAX) {\n width -= gutter;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = getScale(element);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {\n rect = getViewportRect(element, strategy, clippingAncestor);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let lastKeptComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n // Position of the containing block chain below the current node. A fixed\n // element whose containing block hasn't been found yet is a fixed chain.\n const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';\n\n // A non-containing ancestor does not clip the element when the chain\n // below it escapes it: a fixed chain escapes all ancestors up to the\n // next containing block, an absolute chain escapes static ancestors.\n const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // The kept node carries the chain position for the next iteration.\n lastKeptComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n if (!isOffsetParentAnElement && documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove, ancestorResize) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n\n // The entry is a snapshot, so the reference may have moved since the\n // intersection was computed (under performance constraints, or between\n // consecutive frames of a multi-frame layout shift). The reported ratio\n // and the observed area are stale in that case and cannot be trusted to\n // detect subsequent movement, so refresh regardless of the ratio.\n if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n return refresh();\n }\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped in place, the ratio is 0. Throttle\n // the refresh to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n const win = getWindow(element);\n // The window is a resize ancestor, so when `ancestorResize` is enabled its\n // listener already runs the update on resize. Here we only need to rebuild\n // the `IntersectionObserver` for the new root size, skipping a redundant\n // update. When `ancestorResize` is disabled, this becomes the sole update.\n const handleResize = () => refresh(ancestorResize);\n win.addEventListener('resize', handleResize);\n refresh(true);\n return () => {\n win.removeEventListener('resize', handleResize);\n cleanup();\n };\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update);\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = options != null ? options : {};\n const platformWithCache = {\n ...platform,\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst hooks = [];\nlet currentInstance = undefined;\nexport function getInstance() {\n return currentInstance;\n}\nexport function setInstance(instance) {\n currentInstance = instance;\n}\nexport function register(hook) {\n hooks.push(hook);\n}\n\n/**\n * Wraps a component function to enable performance optimizations for internal hooks.\n *\n * **Performance Optimization:**\n * Components wrapped with `fastComponent` have access to a shared \"instance\" context that enables\n * specialized hook implementations to batch operations and reduce overhead. The wrapper creates a\n * stable instance object that persists across renders, sets it as the current context, calls\n * registered hooks before and after rendering, then clears the context. The primary benefit is\n * with `useStore`, where multiple store subscriptions within the same component are collapsed into\n * a single `useSyncExternalStore` subscription per store, significantly reducing re-render overhead.\n * This optimization is only active on React 19+; on earlier versions `useStore` falls back to a\n * separate subscription per call.\n *\n * **Requirements:**\n * - The component function should follow standard React component patterns\n * - `useStore` calls must keep a stable order and count across renders, as batched hooks are\n * matched by call index\n * - Do not rely on the instance context outside of specialized hooks\n *\n * @param fn - The component function to wrap\n * @returns A wrapped component with the same signature as the input function\n *\n * @example\n * ```tsx\n * // Wrapping a component to enable optimized useStore batching\n * export const TooltipRoot = fastComponent(function TooltipRoot(props) {\n * // These useStore calls share a single subscription\n * const open = useStore(store, (state) => state.open);\n * const disabled = useStore(store, (state) => state.disabled);\n * const value = useStore(store, (state) => state.value);\n * // ...\n * });\n * ```\n */\nexport function fastComponent(fn) {\n const FastComponent = (props, forwardedRef) => {\n const instance = useRefWithInit(createInstance).current;\n let result;\n try {\n currentInstance = instance;\n for (const hook of hooks) {\n hook.before(instance);\n }\n result = fn(props, forwardedRef);\n for (const hook of hooks) {\n hook.after(instance);\n }\n instance.didInitialize = true;\n } finally {\n currentInstance = undefined;\n }\n return result;\n };\n FastComponent.displayName = fn.displayName || fn.name;\n return FastComponent;\n}\n\n/**\n * Wraps a component function with ref forwarding to enable performance optimizations for internal hooks.\n *\n * This is a convenience wrapper that combines `fastComponent` with `React.forwardRef`, enabling\n * both performance optimizations and proper ref forwarding. See `fastComponent` for details on\n * the performance benefits.\n *\n * @param fn - The component function that accepts props and a forwarded ref\n * @returns A wrapped component with ref forwarding enabled\n *\n * @example\n * ```tsx\n * // Wrapping a component with ref forwarding and optimized hooks\n * export const TooltipTrigger = fastComponentRef(function TooltipTrigger(\n * props,\n * forwardedRef\n * ) {\n * const store = useContext(TooltipContext);\n * const open = useStore(store, (state) => state.open);\n * // ... component logic with ref\n * return <button ref={forwardedRef} {...props} />;\n * });\n * ```\n */\nexport function fastComponentRef(fn) {\n return /*#__PURE__*/React.forwardRef(fastComponent(fn));\n}\nfunction createInstance() {\n return {\n didInitialize: false\n };\n}","import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}","import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}","/* False positives - ESLint thinks we're calling a hook from a class component. */\n/* eslint-disable react-hooks/rules-of-hooks */\n'use client';\n\nimport * as React from 'react';\nimport { Store } from \"./Store.mjs\";\nimport { useStore } from \"./useStore.mjs\";\nimport { useStableCallback } from \"../useStableCallback.mjs\";\nimport { useIsoLayoutEffect } from \"../useIsoLayoutEffect.mjs\";\nimport { NOOP } from \"../empty.mjs\";\n\n/**\n * A Store that supports controlled state keys, non-reactive values and provides utility methods for React.\n */\nexport class ReactStore extends Store {\n /**\n * Creates a new ReactStore instance.\n *\n * @param state Initial state of the store.\n * @param context Non-reactive context values.\n * @param selectors Optional selectors for use with `useState`.\n */\n constructor(state, context = {}, selectors) {\n super(state);\n this.context = context;\n this.selectors = selectors;\n }\n\n /**\n * Non-reactive values such as refs, callbacks, etc.\n */\n\n /**\n * Synchronizes a single external value into the store.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValue(key, value) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes a single external value into the store and\n * cleans it up (sets to `undefined`) on unmount.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValueWithCleanup(key, value) {\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n return () => {\n store.set(key, undefined);\n };\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes multiple external values into the store.\n *\n * Note that the while the values in `state` are updated immediately, the values returned\n * by `useState` are updated before the next render (similarly to React's `useState`).\n */\n useSyncedValues(statePart) {\n // eslint-disable-next-line consistent-this\n const store = this;\n if (process.env.NODE_ENV !== 'production') {\n // Check that an object with the same shape is passed on every render\n React.useDebugValue(statePart, p => Object.keys(p));\n const keys = React.useRef(Object.keys(statePart)).current;\n const nextKeys = Object.keys(statePart);\n if (keys.length !== nextKeys.length || keys.some((key, index) => key !== nextKeys[index])) {\n console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');\n }\n }\n const dependencies = Object.values(statePart);\n useIsoLayoutEffect(() => {\n store.update(statePart);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...dependencies]);\n }\n\n /**\n * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`\n * is non-undefined, the store's state at `key` is updated to match `controlled`.\n */\n useControlledProp(key, controlled) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n const isControlled = controlled !== undefined;\n useIsoLayoutEffect(() => {\n if (isControlled && !Object.is(store.state[key], controlled)) {\n // Set the internal state to match the controlled value.\n store.setState({\n ...store.state,\n [key]: controlled\n });\n }\n }, [store, key, controlled, isControlled]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n const cache = this.controlledValues ??= new Map();\n if (!cache.has(key)) {\n cache.set(key, isControlled);\n }\n const previouslyControlled = cache.get(key);\n if (previouslyControlled !== undefined && previouslyControlled !== isControlled) {\n console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);\n }\n }\n }\n\n /** Gets the current value from the store using a selector with the provided key.\n *\n * @param key Key of the selector to use.\n */\n\n select(key, a1, a2, a3) {\n const selector = this.selectors[key];\n return selector(this.state, a1, a2, a3);\n }\n\n /**\n * Returns a value from the store's state using a selector function.\n * Used to subscribe to specific parts of the state.\n * This methods causes a rerender whenever the selected state changes.\n *\n * @param key Key of the selector to use.\n */\n\n useState(key, a1, a2, a3) {\n React.useDebugValue(key);\n return useStore(this, this.selectors[key], a1, a2, a3);\n }\n\n /**\n * Wraps a function with `useStableCallback` to ensure it has a stable reference\n * and assigns it to the context.\n *\n * @param key Key of the event callback. Must be a function in the context.\n * @param fn Function to assign.\n */\n useContextCallback(key, fn) {\n React.useDebugValue(key);\n const stableFunction = useStableCallback(fn ?? NOOP);\n this.context[key] = stableFunction;\n }\n\n /**\n * Returns a stable setter function for a specific key in the store's state.\n * It's commonly used to pass as a ref callback to React elements.\n *\n * @param key Key of the state to set.\n */\n useStateSetter(key) {\n const ref = React.useRef(undefined);\n if (ref.current === undefined) {\n ref.current = value => {\n this.set(key, value);\n };\n }\n return ref.current;\n }\n\n /**\n * Observes changes derived from the store's selectors and calls the listener when the selected value changes.\n *\n * @param key Key of the selector to observe.\n * @param listener Listener function called when the selector result changes.\n */\n\n observe(selector, listener) {\n let selectFn;\n if (typeof selector === 'function') {\n selectFn = selector;\n } else {\n selectFn = this.selectors[selector];\n }\n let prevValue = selectFn(this.state);\n listener(prevValue, prevValue, this);\n return this.subscribe(nextState => {\n const nextValue = selectFn(nextState);\n if (!Object.is(prevValue, nextValue)) {\n const oldValue = prevValue;\n prevValue = nextValue;\n listener(nextValue, oldValue, this);\n }\n });\n }\n}","import { ReactStore } from '@base-ui/utils/store';\nimport { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\nimport { isClickLikeEvent } from \"../utils.mjs\";\nconst selectors = {\n open: state => state.open,\n transitionStatus: state => state.transitionStatus,\n domReferenceElement: state => state.domReferenceElement,\n referenceElement: state => state.positionReference ?? state.referenceElement,\n floatingElement: state => state.floatingElement,\n floatingId: state => state.floatingId\n};\nexport class FloatingRootStore extends ReactStore {\n constructor(options) {\n const {\n syncOnly,\n nested,\n onOpenChange,\n triggerElements,\n ...initialState\n } = options;\n super({\n ...initialState,\n positionReference: initialState.referenceElement,\n domReferenceElement: initialState.referenceElement\n }, {\n onOpenChange,\n dataRef: {\n current: {}\n },\n events: createEventEmitter(),\n nested,\n triggerElements\n }, selectors);\n this.syncOnly = syncOnly;\n }\n\n /**\n * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.\n */\n syncOpenEvent = (newOpen, event) => {\n if (!newOpen || !this.state.open ||\n // Prevent a pending hover-open from overwriting a click-open event, while allowing\n // click events to upgrade a hover-open.\n event != null && isClickLikeEvent(event)) {\n this.context.dataRef.current.openEvent = newOpen ? event : undefined;\n }\n };\n\n /**\n * Runs the root-owned side effects for an open state change.\n */\n dispatchOpenChange = (newOpen, eventDetails) => {\n this.syncOpenEvent(newOpen, eventDetails.event);\n const details = {\n open: newOpen,\n reason: eventDetails.reason,\n nativeEvent: eventDetails.event,\n nested: this.context.nested,\n triggerElement: eventDetails.trigger\n };\n this.context.events.emit('openchange', details);\n };\n\n /**\n * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.\n *\n * @param newOpen The new open state.\n * @param eventDetails Details about the event that triggered the open state change.\n */\n setOpen = (newOpen, eventDetails) => {\n if (this.syncOnly) {\n this.context.onOpenChange?.(newOpen, eventDetails);\n return;\n }\n this.dispatchOpenChange(newOpen, eventDetails);\n this.context.onOpenChange?.(newOpen, eventDetails);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\n/**\n * Keeps a FloatingRootStore in sync with the provided PopupStore.\n * Uses the provided FloatingRootStore when one exists, otherwise creates one once and updates it on every render.\n */\nexport function useSyncedFloatingRootContext(options) {\n const {\n popupStore,\n treatPopupAsFloatingElement = false,\n floatingRootContext: floatingRootContextProp,\n floatingId,\n nested,\n onOpenChange\n } = options;\n const open = popupStore.useState('open');\n const referenceElement = popupStore.useState('activeTriggerElement');\n const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? 'popupElement' : 'positionerElement');\n const triggerElements = popupStore.context.triggerElements;\n const handleOpenChange = onOpenChange;\n const internalStoreRef = React.useRef(null);\n if (floatingRootContextProp === undefined && internalStoreRef.current === null) {\n internalStoreRef.current = new FloatingRootStore({\n open,\n transitionStatus: undefined,\n referenceElement,\n floatingElement,\n triggerElements,\n onOpenChange: handleOpenChange,\n floatingId,\n syncOnly: true,\n nested\n });\n }\n const store = floatingRootContextProp ?? internalStoreRef.current;\n popupStore.useSyncedValue('floatingId', floatingId);\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId,\n referenceElement,\n floatingElement\n };\n if (isElement(referenceElement)) {\n valuesToSync.domReferenceElement = referenceElement;\n }\n if (store.state.positionReference === store.state.referenceElement) {\n valuesToSync.positionReference = referenceElement;\n }\n store.update(valuesToSync);\n }, [open, floatingId, referenceElement, floatingElement, store]);\n\n // Keep non-reactive context values fresh for interactions that call `store.setOpen`.\n store.context.onOpenChange = handleOpenChange;\n store.context.nested = nested;\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useId } from '@base-ui/utils/useId';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FOCUSABLE_ATTRIBUTE } from \"../../floating-ui-react/utils/constants.mjs\";\nimport { useFloatingParentNodeId } from \"../../floating-ui-react/components/FloatingTree.mjs\";\nimport { useSyncedFloatingRootContext } from \"../../floating-ui-react/hooks/useSyncedFloatingRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nexport const FOCUSABLE_POPUP_PROPS = {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n};\n\n/**\n * Returns the default `initialFocus` resolver for a popup. When opened by touch it focuses the\n * popup element itself to prevent the virtual keyboard from opening (required for Android\n * specifically; iOS handles this automatically). Otherwise it falls back to the default behavior.\n */\nexport function createDefaultInitialFocus(popupRef) {\n return interactionType => interactionType === 'touch' ? popupRef.current : true;\n}\n\n/**\n * The subset of a popup handle that a Root needs to bind its store to. Both the real handle classes\n * and any test double satisfy it.\n */\n\n/**\n * Creates and owns a popup store on behalf of a Root part. The store is created exactly once, with\n * controlled props and root state synced separately after creation. Sets up the synced floating\n * root context and returns the store.\n *\n * @param createStore Factory that builds the store. Called exactly once, receiving the floating id\n * and whether the popup is nested inside another floating element, both resolved on the first render.\n * @param treatPopupAsFloatingElement Whether the popup element is passed to Floating UI as the\n * floating element instead of the default positioner.\n */\nexport function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n const store = useRefWithInit(() => createStore(floatingId, nested)).current;\n useSyncedFloatingRootContext({\n popupStore: store,\n treatPopupAsFloatingElement,\n floatingRootContext: store.state.floatingRootContext,\n floatingId,\n nested,\n onOpenChange: store.setOpen\n });\n return store;\n}\n\n/**\n * Attaches a Root's store to a handle for this component's committed lifetime. Popup Roots render\n * it before their interactions and user children so its layout effect runs before descendant layout\n * effects. This lets descendants call the handle during the Root's initial commit without attaching\n * during render, which would leak suspended or abandoned stores. Store subscribers are notified by\n * `attachStore` in this ordinary layout phase, where React permits synchronous updates.\n *\n * Popup Roots must render this component only when a handle is present so handle-less Roots avoid\n * mounting an extra fiber and layout effect.\n */\nexport function PopupHandleAttachment({\n handle,\n store\n}) {\n useIsoLayoutEffect(() => {\n return handle.attachStore(store);\n }, [handle, store]);\n return null;\n}\n\n/**\n * Returns a callback ref that registers/unregisters the trigger element in the store.\n *\n * @param store The Store instance where the trigger should be registered.\n */\nexport function useTriggerRegistration(id, store) {\n // Keep track of the currently registered element to unregister it on unmount or id change.\n const registeredElementIdRef = React.useRef(null);\n const registeredElementRef = React.useRef(null);\n return React.useCallback(element => {\n if (id === undefined) {\n return;\n }\n let shouldSyncTriggerCount = false;\n if (registeredElementIdRef.current !== null) {\n const registeredId = registeredElementIdRef.current;\n const registeredElement = registeredElementRef.current;\n const currentElement = store.context.triggerElements.getById(registeredId);\n if (registeredElement && currentElement === registeredElement) {\n store.context.triggerElements.delete(registeredId);\n shouldSyncTriggerCount = true;\n }\n registeredElementIdRef.current = null;\n registeredElementRef.current = null;\n }\n if (element !== null) {\n registeredElementIdRef.current = id;\n registeredElementRef.current = element;\n store.context.triggerElements.add(id, element);\n shouldSyncTriggerCount = true;\n }\n if (shouldSyncTriggerCount) {\n const triggerCount = store.context.triggerElements.size;\n if (store.select('open') && store.state.triggerCount !== triggerCount) {\n store.set('triggerCount', triggerCount);\n }\n }\n }, [store, id]);\n}\nexport function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {\n if (open) {\n // Opening starts a new close cycle, so clear any previous request to keep the popup mounted.\n state.preventUnmountingOnClose = false;\n } else if (preventUnmountOnClose) {\n state.preventUnmountingOnClose = true;\n }\n const triggerId = trigger?.id ?? null;\n\n // If a popup is closing, the `trigger` may be undefined.\n // We want to keep the previous value so that exit animations are played and focus is returned correctly.\n if (triggerId || open) {\n state.activeTriggerId = triggerId;\n state.activeTriggerElement = trigger ?? null;\n }\n}\nexport function attachPreventUnmountOnClose(eventDetails) {\n let preventUnmountOnClose = false;\n eventDetails.preventUnmountOnClose = () => {\n preventUnmountOnClose = true;\n };\n return () => preventUnmountOnClose;\n}\n\n/**\n * Runs the shared open-change sequence for a popup store: notifies `onOpenChange`,\n * honors cancellation, dispatches the floating root change, maps the reason to an\n * `instantType`, and commits the state update (synchronously for hover so\n * `getAnimations()` observes it). Stores supply their own differences via\n * `extraState` (e.g. the last change reason) and `onBeforeDispatch` (e.g. updating\n * inline-rect coordinates).\n */\nexport function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {\n const reason = eventDetails.reason;\n const isHover = reason === REASONS.triggerHover;\n const isFocusOpen = nextOpen && reason === REASONS.triggerFocus;\n const isDismissClose = !nextOpen && (reason === REASONS.triggerPress || reason === REASONS.escapeKey);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n store.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n options.onBeforeDispatch?.();\n store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n // Spread `extraState` first so `open` always reflects `nextOpen`, keeping it in\n // sync with the value already passed to `dispatchOpenChange`/`setPopupOpenState`.\n const updatedState = {\n ...options.extraState,\n open: nextOpen\n };\n if (isFocusOpen) {\n updatedState.instantType = 'focus';\n } else if (isDismissClose) {\n updatedState.instantType = 'dismiss';\n } else if (isHover) {\n updatedState.instantType = undefined;\n }\n setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n store.update(updatedState);\n };\n if (isHover) {\n // Flush synchronously for hover so `node.getAnimations()` sees the new state.\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n}\n\n/**\n * Sets up trigger data forwarding to the store.\n *\n * @param triggerId Id of the trigger.\n * @param triggerElementRef Ref for the trigger DOM element.\n * @param store The Store instance managing the popup state.\n * @param stateUpdates An object with state updates to apply when the trigger is active.\n */\nexport function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {\n const isMountedByThisTrigger = store.useState('isMountedByTrigger', triggerId);\n const baseRegisterTrigger = useTriggerRegistration(triggerId, store);\n\n // Applies trigger-owned state (active-trigger ownership and payload) when the trigger registers.\n // Stable so payload/`stateUpdates` changes do not change the ref identity (which would needlessly\n // churn registration); it reads the latest closure values when invoked.\n const applyTriggerData = useStableCallback(element => {\n const open = store.select('open');\n const activeTriggerId = store.select('activeTriggerId');\n if (activeTriggerId === triggerId) {\n store.update({\n activeTriggerElement: element,\n ...(open ? stateUpdates : null)\n });\n return;\n }\n if (activeTriggerId == null && open) {\n // If a popup is already open, a detached trigger can mount before any active trigger\n // has been established. Claim the first registered trigger so trigger-owned focus\n // management and ARIA relationships work.\n store.update({\n activeTriggerId: triggerId,\n activeTriggerElement: element,\n ...stateUpdates\n });\n }\n });\n\n // Intentionally NOT stable. Its identity is derived from `baseRegisterTrigger`, which is keyed on\n // `[store, id]`, so when a handle-backed trigger's store pointer swaps the merged ref re-fires —\n // unregistering from the previous store and registering into the new one. This lets a detached\n // trigger follow its handle's currently-attached store across attach/detach/remount. (A stable\n // callback would keep its identity and never re-fire on a store swap.)\n const registerTrigger = React.useCallback(element => {\n baseRegisterTrigger(element);\n if (element) {\n applyTriggerData(element);\n }\n }, [baseRegisterTrigger, applyTriggerData]);\n useIsoLayoutEffect(() => {\n if (isMountedByThisTrigger) {\n store.update({\n activeTriggerElement: triggerElementRef.current,\n ...stateUpdates\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);\n return {\n registerTrigger,\n isMountedByThisTrigger\n };\n}\n/**\n * Keeps trigger registration state synchronized while the popup is open.\n *\n * When a popup opens without an explicit trigger id and exactly one trigger is registered, that\n * trigger is claimed as the active trigger. When the active trigger id is still registered but its\n * element changed, the active element is refreshed. When the active trigger id is missing from the\n * registry but the same element is still registered under a different id (e.g. the rendered trigger\n * carries its own DOM `id` that differs from Base UI's internal trigger id), the active id is\n * reassociated to the registered id instead of being treated as lost. When the active trigger\n * unregisters, the default path preserves existing ownership so non-closing popup families do not\n * silently claim a different trigger while staying open.\n *\n * If `closeOnActiveTriggerUnmount` is enabled, unregistering a previously resolved active trigger\n * requests a close after a microtask so a same-tick replacement trigger with the same id can\n * register first. An active trigger id that has not matched a registered trigger yet is treated as\n * pending and does not request a close.\n *\n * This should be called on the Root part.\n *\n * @param store The Store instance managing the popup state.\n * @param options Options for active trigger unmount behavior.\n */\nexport function useImplicitActiveTrigger(store, options = {}) {\n const {\n closeOnActiveTriggerUnmount = false\n } = options;\n // Distinguishes a trigger that unmounted from a new active trigger that has not hydrated yet.\n const resolvedActiveTriggerIdRef = React.useRef(null);\n const open = store.useState('open');\n const reactiveTriggerCount = store.useState('triggerCount');\n // Subscribe to the active trigger id so the reconciliation below reruns when ownership moves to\n // another trigger while the popup stays open (e.g. a focus/hover handoff between triggers).\n const activeTriggerId = store.useState('activeTriggerId');\n // Subscribe to the active trigger element so the reconciliation reruns when a pending active\n // trigger registers in a commit where the trigger count nets out unchanged (registration\n // forwards the element to the store when the registering trigger matches the active id).\n // Without this, the id would never be marked resolved and a later genuine unmount would be\n // misclassified as pending, disabling `closeOnActiveTriggerUnmount`.\n const reactiveActiveTriggerElement = store.useState('activeTriggerElement');\n useIsoLayoutEffect(() => {\n if (!open) {\n resolvedActiveTriggerIdRef.current = null;\n if (store.state.triggerCount !== 0) {\n store.set('triggerCount', 0);\n }\n return;\n }\n const triggerCount = store.context.triggerElements.size;\n const stateUpdates = {};\n if (store.state.triggerCount !== triggerCount) {\n stateUpdates.triggerCount = triggerCount;\n }\n const currentActiveTriggerId = store.select('activeTriggerId');\n let lostActiveTriggerId = null;\n if (currentActiveTriggerId) {\n const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);\n if (!activeTriggerElement) {\n for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {\n if (triggerElement === store.state.activeTriggerElement) {\n stateUpdates.activeTriggerId = triggerId;\n stateUpdates.activeTriggerElement = triggerElement;\n resolvedActiveTriggerIdRef.current = triggerId;\n break;\n }\n }\n if (stateUpdates.activeTriggerId === undefined) {\n if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {\n lostActiveTriggerId = currentActiveTriggerId;\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = currentActiveTriggerId;\n if (activeTriggerElement !== store.state.activeTriggerElement) {\n stateUpdates.activeTriggerElement = activeTriggerElement;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {\n const iteratorResult = store.context.triggerElements.entries().next();\n if (!iteratorResult.done) {\n const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;\n stateUpdates.activeTriggerId = implicitTriggerId;\n stateUpdates.activeTriggerElement = implicitTriggerElement;\n resolvedActiveTriggerIdRef.current = implicitTriggerId;\n }\n }\n if (stateUpdates.triggerCount !== undefined || stateUpdates.activeTriggerId !== undefined || stateUpdates.activeTriggerElement !== undefined) {\n store.update(stateUpdates);\n }\n if (lostActiveTriggerId) {\n if (closeOnActiveTriggerUnmount) {\n // Defer so a same-tick replacement trigger with the same id can register first.\n queueMicrotask(() => {\n if (store.select('open') && store.select('activeTriggerId') === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {\n const eventDetails = createChangeEventDetails(REASONS.none);\n store.setOpen(false, eventDetails);\n // If closing is canceled, keep the previous active trigger ownership for the\n // still-open popup instead of claiming another trigger implicitly.\n if (!eventDetails.isCanceled) {\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null\n });\n }\n }\n });\n }\n }\n }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);\n}\n\n/**\n * Manages the mounted state of the popup.\n * Sets up the transition status listeners and handles unmounting when needed.\n * Updates the `mounted`, `transitionStatus`, and `preventUnmountingOnClose` states in the store.\n *\n * @param open Whether the popup is open.\n * @param store The Store instance managing the popup state.\n * @param onUnmount Optional callback to be called when the popup is unmounted.\n *\n * @returns A function to forcibly unmount the popup.\n */\nexport function useOpenStateTransitions(open, store, onUnmount) {\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const preventUnmountingOnClose = store.useState('preventUnmountingOnClose');\n // Opening starts a new close cycle. Clear during render so the close-completion hook below\n // reads the synchronized value on the same pass.\n const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;\n store.useSyncedValues({\n mounted,\n transitionStatus,\n preventUnmountingOnClose: syncedPreventUnmountingOnClose\n });\n const forceUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null,\n mounted: false,\n preventUnmountingOnClose: false\n });\n onUnmount?.();\n store.context.onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: mounted && !open && !syncedPreventUnmountingOnClose,\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (!open) {\n forceUnmount();\n }\n }\n });\n return {\n forceUnmount,\n transitionStatus\n };\n}\nexport function usePopupInteractionProps(store, statePart) {\n store.useSyncedValues(statePart);\n useIsoLayoutEffect(() => () => {\n store.update({\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n });\n }, [store]);\n}\nexport function usePopupRootSync(store, open) {\n useIsoLayoutEffect(() => {\n if (!open && store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [open, store]);\n useIsoLayoutEffect(() => () => {\n if (store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [store]);\n}","/**\n * Development-only reverse index of element to registered id, keyed by the owning map.\n *\n * Registration would otherwise have to scan every entry to detect an element claimed by two ids,\n * making the mount of many triggers sharing one handle quadratic. Kept module-scoped, lazily\n * initialized, and read only from `process.env.NODE_ENV` guards so production builds drop it along\n * with the checks.\n */\nlet devElementIdsByMap;\nfunction getDevElementIds(map) {\n devElementIdsByMap ??= new WeakMap();\n let elementIds = devElementIdsByMap.get(map);\n if (!elementIds) {\n elementIds = new WeakMap();\n devElementIdsByMap.set(map, elementIds);\n }\n return elementIds;\n}\n\n/**\n * Data structure to keep track of popup trigger elements by their IDs.\n *\n * Element lookups iterate the id map rather than maintaining a parallel Set. Registration is O(1),\n * while `hasElement` and `hasMatchingElement` are linear in the number of triggers.\n */\nexport class PopupTriggerMap {\n constructor() {\n this.idMap = new Map();\n }\n\n /**\n * Adds a trigger element with the given ID.\n *\n * Note: The provided element is assumed to not be registered under multiple IDs.\n */\n add(id, element) {\n if (process.env.NODE_ENV !== 'production') {\n const elementIds = getDevElementIds(this);\n const existingId = elementIds.get(element);\n if (existingId !== undefined && existingId !== id) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error('Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.');\n }\n\n // Reusing an id for a different element evicts the previous one, so it must lose its claim\n // on the id or a later registration under a different id would be reported as a duplicate.\n const previousElement = this.idMap.get(id);\n if (previousElement !== undefined && previousElement !== element) {\n elementIds.delete(previousElement);\n }\n elementIds.set(element, id);\n }\n this.idMap.set(id, element);\n }\n\n /**\n * Removes the trigger element with the given ID.\n */\n delete(id) {\n if (process.env.NODE_ENV !== 'production') {\n const element = this.idMap.get(id);\n if (element !== undefined) {\n devElementIdsByMap?.get(this)?.delete(element);\n }\n }\n this.idMap.delete(id);\n }\n\n /**\n * Whether the given element is registered as a trigger.\n */\n hasElement(element) {\n for (const registered of this.idMap.values()) {\n if (registered === element) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether there is a registered trigger element matching the given predicate.\n */\n hasMatchingElement(predicate) {\n for (const element of this.idMap.values()) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the trigger element associated with the given ID, or undefined if no such element exists.\n */\n getById(id) {\n return this.idMap.get(id);\n }\n\n /**\n * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].\n */\n entries() {\n return this.idMap.entries();\n }\n\n /**\n * Returns an iterable of all registered trigger elements.\n */\n elements() {\n return this.idMap.values();\n }\n\n /**\n * Returns the number of registered trigger elements.\n */\n get size() {\n return this.idMap.size;\n }\n}","import { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function getEmptyRootContext() {\n return new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements: new PopupTriggerMap(),\n floatingId: undefined,\n syncOnly: false,\n nested: false,\n onOpenChange: undefined\n });\n}","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FloatingRootStore } from \"../../floating-ui-react/components/FloatingRootStore.mjs\";\nimport { getEmptyRootContext } from \"../../floating-ui-react/utils/getEmptyRootContext.mjs\";\n\n/**\n * State common to all popup stores.\n */\n\nexport function createInitialPopupStoreState() {\n return {\n open: false,\n openProp: undefined,\n mounted: false,\n transitionStatus: undefined,\n floatingRootContext: getEmptyRootContext(),\n floatingId: undefined,\n triggerCount: 0,\n preventUnmountingOnClose: false,\n payload: undefined,\n activeTriggerId: null,\n activeTriggerElement: null,\n triggerIdProp: undefined,\n popupElement: null,\n positionerElement: null,\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n };\n}\nexport function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {\n return new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements,\n floatingId,\n syncOnly: true,\n nested,\n onOpenChange: undefined\n });\n}\nconst activeTriggerIdSelector = state => state.triggerIdProp ?? state.activeTriggerId;\nconst openSelector = state => state.openProp ?? state.open;\nconst popupIdSelector = state => {\n const popupId = state.popupElement?.id ?? state.floatingId;\n return popupId || undefined;\n};\nfunction triggerOwnsOpenPopup(state, triggerId) {\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) === triggerId;\n}\nfunction triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {\n if (triggerOwnsOpenPopup(state, triggerId)) {\n return true;\n }\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;\n}\nexport const popupStoreSelectors = {\n open: openSelector,\n mounted: state => state.mounted,\n transitionStatus: state => state.transitionStatus,\n floatingRootContext: state => state.floatingRootContext,\n triggerCount: state => state.triggerCount,\n preventUnmountingOnClose: state => state.preventUnmountingOnClose,\n payload: state => state.payload,\n activeTriggerId: activeTriggerIdSelector,\n activeTriggerElement: state => state.mounted ? state.activeTriggerElement : null,\n popupId: popupIdSelector,\n /**\n * Whether the trigger with the given ID was used to open the popup.\n */\n isTriggerActive: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId,\n /**\n * Whether the popup is open and was activated by a trigger with the given ID.\n */\n isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),\n /**\n * Whether the popup is mounted and was activated by a trigger with the given ID.\n */\n isMountedByTrigger: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId && state.mounted,\n triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,\n /**\n * Popup id for the trigger that currently owns the open popup.\n */\n triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : undefined,\n popupProps: state => state.popupProps,\n popupElement: state => state.popupElement,\n positionerElement: state => state.positionerElement\n};\n\n/**\n * Store members a detached handle-backed trigger reads or invokes for trigger registration and data\n * forwarding. `set`/`update` are included only for trigger-count and trigger-data bookkeeping; on a\n * detached (inert) store they are intentionally no-ops, so a write through them is not guaranteed to\n * be durable. Component handle-store views Pick these from their concrete store (preserving its\n * context and selectors) and add any component-specific trigger-invoked members such as `setOpen`.\n */\n\n/**\n * The subset of a popup store that trigger registration and data forwarding rely on. Narrow enough\n * that an inert store can be passed while detached.\n */","'use client';\n\nimport * as React from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { NOOP } from '@base-ui/utils/empty';\n/**\n * Reads the store currently exposed by a popup handle and subscribes to store-pointer changes.\n * Detached triggers use this to follow a handle as a root attaches or detaches: while no root is\n * attached, the handle exposes its fallback store; once a root attaches, subscribers re-render and\n * read from the live root store.\n *\n * Returns `undefined` when no handle is provided so callers can fall back to their root context.\n *\n * @param handle The popup handle to read from, or `undefined` when the trigger is not handle-bound.\n */\nexport function usePopupHandleStore(handle) {\n const subscribe = React.useCallback(listener => {\n if (handle === undefined) {\n return NOOP;\n }\n return handle.subscribeStore(listener);\n }, [handle]);\n const getSnapshot = React.useCallback(() => {\n return handle === undefined ? undefined : handle.store;\n }, [handle]);\n return useSyncExternalStore(subscribe, getSnapshot, () => handle?.serverStore);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useFloating as usePosition } from '@floating-ui/react-dom';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { useFloatingRootContext } from \"./useFloatingRootContext.mjs\";\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(options = {}) {\n const internalStore = useFloatingRootContext(options);\n const store = options.rootContext || internalStore;\n return useFloatingWithStore(options, store);\n}\n\n/**\n * Base UI's private `useFloating` path. The caller must supply the root store, so this skips the\n * internal root-context hook used by the public Floating UI-compatible API.\n */\nexport function useBaseUIFloating(options) {\n return useFloatingWithStore(options, options.rootContext);\n}\nfunction useFloatingWithStore(options, store) {\n const {\n nodeId,\n externalTree\n } = options;\n const referenceElement = store.useState('referenceElement');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const open = store.useState('open');\n const floatingId = store.useState('floatingId');\n const [positionReference, setPositionReferenceRaw] = React.useState(null);\n const [localDomReference, setLocalDomReference] = React.useState(undefined);\n const [localFloatingElement, setLocalFloatingElement] = React.useState(undefined);\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree(externalTree);\n const storeElements = React.useMemo(() => ({\n reference: referenceElement,\n floating: floatingElement,\n domReference: domReferenceElement\n }), [referenceElement, floatingElement, domReferenceElement]);\n const position = usePosition({\n ...options,\n elements: {\n ...storeElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;\n const syncedFloatingElement = localFloatingElement === undefined ? store.state.floatingElement : localFloatingElement;\n store.useSyncedValue('referenceElement', localDomReference ?? null);\n store.useSyncedValue('domReferenceElement', localDomReference === undefined ? domReferenceElement : localDomReferenceElement);\n store.useSyncedValue('floatingElement', syncedFloatingElement);\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => node.getClientRects(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n setPositionReferenceRaw(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setLocalDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs, setLocalDomReference]);\n const setFloating = React.useCallback(node => {\n setLocalFloatingElement(node);\n position.refs.setFloating(node);\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setFloating,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setFloating, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReferenceElement\n }), [position.elements, domReferenceElement]);\n const context = React.useMemo(() => ({\n ...position,\n dataRef: store.context.dataRef,\n open,\n onOpenChange: store.setOpen,\n events: store.context.events,\n floatingId,\n refs,\n elements,\n nodeId,\n rootStore: store\n }), [position, refs, elements, nodeId, store, open, floatingId]);\n useIsoLayoutEffect(() => {\n if (domReferenceElement) {\n domReferenceRef.current = domReferenceElement;\n }\n }, [domReferenceElement]);\n useIsoLayoutEffect(() => {\n store.context.dataRef.current.floatingContext = context;\n const node = tree?.nodesRef.current.find(n => n.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements,\n rootStore: store\n }), [position, refs, elements, context, store]);\n}","'use client';\n\nimport { useOnMount } from '@base-ui/utils/useOnMount';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { isInteractiveElement } from \"../utils.mjs\";\nexport { isInteractiveElement };\nexport class HoverInteraction {\n constructor() {\n this.pointerType = undefined;\n this.interactedInside = false;\n this.handler = undefined;\n this.blockMouseMove = true;\n this.performedPointerEventsMutation = false;\n this.pointerEventsScopeElement = null;\n this.pointerEventsReferenceElement = null;\n this.pointerEventsFloatingElement = null;\n this.restTimeoutPending = false;\n this.openChangeTimeout = new Timeout();\n this.restTimeout = new Timeout();\n this.handleCloseOptions = undefined;\n }\n static create() {\n return new HoverInteraction();\n }\n dispose = () => {\n this.openChangeTimeout.clear();\n this.restTimeout.clear();\n };\n disposeEffect = () => {\n return this.dispose;\n };\n}\nconst pointerEventsMutationOwnerByScopeElement = new WeakMap();\nexport function clearSafePolygonPointerEventsMutation(instance) {\n if (!instance.performedPointerEventsMutation) {\n return;\n }\n const scopeElement = instance.pointerEventsScopeElement;\n if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {\n instance.pointerEventsScopeElement?.style.removeProperty('pointer-events');\n instance.pointerEventsReferenceElement?.style.removeProperty('pointer-events');\n instance.pointerEventsFloatingElement?.style.removeProperty('pointer-events');\n pointerEventsMutationOwnerByScopeElement.delete(scopeElement);\n }\n instance.performedPointerEventsMutation = false;\n instance.pointerEventsScopeElement = null;\n instance.pointerEventsReferenceElement = null;\n instance.pointerEventsFloatingElement = null;\n}\nexport function applySafePolygonPointerEventsMutation(instance, options) {\n const {\n scopeElement,\n referenceElement,\n floatingElement\n } = options;\n const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);\n if (existingOwner && existingOwner !== instance) {\n clearSafePolygonPointerEventsMutation(existingOwner);\n }\n clearSafePolygonPointerEventsMutation(instance);\n instance.performedPointerEventsMutation = true;\n instance.pointerEventsScopeElement = scopeElement;\n instance.pointerEventsReferenceElement = referenceElement;\n instance.pointerEventsFloatingElement = floatingElement;\n pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);\n scopeElement.style.pointerEvents = 'none';\n referenceElement.style.pointerEvents = 'auto';\n floatingElement.style.pointerEvents = 'auto';\n}\nexport function useHoverInteractionSharedState(store) {\n const data = store.context.dataRef.current;\n const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;\n if (!data.hoverInteractionState) {\n data.hoverInteractionState = instance;\n }\n useOnMount(data.hoverInteractionState.disposeEffect);\n return data.hoverInteractionState;\n}","'use client';\n\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, isInteractiveElement, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, isClickLikeOpenEvent as isClickLikeOpenEventShared, isHoverOpenEvent, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\n/**\n * Provides hover interactions that should be attached to the floating element.\n */\nexport function useHoverFloatingInteraction(context, parameters = {}) {\n const {\n enabled = true,\n closeDelay: closeDelayProp = 0,\n nodeId: nodeIdProp\n } = parameters;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree();\n const parentId = useFloatingParentNodeId();\n const instance = useHoverInteractionSharedState(store);\n const childClosedTimeout = useTimeout();\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const isHoverOpen = useStableCallback(() => {\n return isHoverOpenEvent(dataRef.current.openEvent?.type);\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n instance.pointerType = undefined;\n instance.restTimeoutPending = false;\n instance.interactedInside = false;\n clearPointerEvents();\n }\n }, [open, instance, clearPointerEvents]);\n React.useEffect(() => {\n return clearPointerEvents;\n }, [clearPointerEvents]);\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {\n const ref = domReferenceElement;\n const floatingEl = floatingElement;\n const doc = ownerDocument(floatingElement);\n const parentFloating = tree?.nodesRef.current.find(node => node.id === parentId)?.context?.elements.floating;\n if (parentFloating) {\n parentFloating.style.pointerEvents = '';\n }\n\n // A keep-mounted submenu can appear in the tree before it opens, so a\n // cached scope or parent lookup may resolve to the submenu itself. That\n // would not shield sibling items in the parent menu.\n const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;\n const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest('[data-rootownerid]') ?? doc.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: ref,\n floatingElement: floatingEl\n });\n return () => {\n clearPointerEvents();\n };\n }\n return undefined;\n }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function hasParentChildren() {\n return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);\n }\n function closeWithDelay(event) {\n const closeDelay = getDelay(closeDelayProp, 'close', instance.pointerType);\n const close = () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n };\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, close);\n } else {\n instance.openChangeTimeout.clear();\n close();\n }\n }\n function handleInteractInside(event) {\n const target = getTarget(event);\n if (!isInteractiveElement(target)) {\n instance.interactedInside = false;\n return;\n }\n instance.interactedInside = target?.closest('[aria-haspopup]') != null;\n }\n function onFloatingMouseEnter() {\n instance.openChangeTimeout.clear();\n childClosedTimeout.clear();\n tree?.events.off('floating.closed', onNodeClosed);\n clearPointerEvents();\n }\n function onFloatingMouseLeave(event) {\n if (hasParentChildren() && tree) {\n tree.events.on('floating.closed', onNodeClosed);\n return;\n }\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n // If the mouse is leaving the reference element to another trigger, don't explicitly close the popup\n // as it will be moved.\n return;\n }\n const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;\n const relatedTarget = event.relatedTarget;\n const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some(node => contains(node.context?.elements.floating, relatedTarget));\n if (isMovingIntoDescendantFloating) {\n return;\n }\n\n // If the safePolygon handler is active, let it handle the close logic.\n if (instance.handler) {\n instance.handler(event);\n return;\n }\n clearPointerEvents();\n if (isHoverOpen() && !isClickLikeOpenEvent()) {\n closeWithDelay(event);\n }\n }\n function onNodeClosed(event) {\n if (!tree || !parentId || hasParentChildren()) {\n return;\n }\n // Allow the mouseenter event to fire in case child was closed because mouse moved into parent.\n childClosedTimeout.start(0, () => {\n tree.events.off('floating.closed', onNodeClosed);\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree.events.emit('floating.closed', event);\n });\n }\n const floating = floatingElement;\n return mergeCleanups(floating && addEventListener(floating, 'mouseenter', onFloatingMouseEnter), floating && addEventListener(floating, 'mouseleave', onFloatingMouseLeave), floating && addEventListener(floating, 'pointerdown', handleInteractInside, true), () => {\n tree?.events.off('floating.closed', onNodeClosed);\n });\n }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType } from \"../utils/event.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, getRestMs, isClickLikeOpenEvent as isClickLikeOpenEventShared, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\nconst EMPTY_REF = {\n current: null\n};\n\n/**\n * Provides hover interactions that should be attached to reference or trigger\n * elements.\n */\nexport function useHoverReferenceInteraction(context, props = {}) {\n const {\n enabled = true,\n delay = 0,\n handleClose = null,\n mouseOnly = false,\n restMs = 0,\n move = true,\n triggerElementRef = EMPTY_REF,\n externalTree,\n isActiveTrigger = true,\n getHandleCloseContext,\n isClosing,\n shouldOpen: shouldOpenProp,\n guardStaleOpen = false\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const instance = useHoverInteractionSharedState(store);\n const isHoverCloseActiveRef = React.useRef(false);\n const handleCloseRef = useValueAsRef(handleClose);\n const delayRef = useValueAsRef(delay);\n const restMsRef = useValueAsRef(restMs);\n const enabledRef = useValueAsRef(enabled);\n const shouldOpenRef = useValueAsRef(shouldOpenProp);\n const isClosingRef = useValueAsRef(isClosing);\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const checkShouldOpen = useStableCallback(() => {\n return shouldOpenRef.current?.() !== false;\n });\n const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {\n const allTriggers = store.context.triggerElements;\n\n // Fast path for normal usage where handlers are attached directly to triggers.\n if (allTriggers.hasElement(currentTarget)) {\n return !currentDomReference || !contains(currentDomReference, currentTarget);\n }\n\n // Fallback for delegated/wrapper usage where currentTarget may be outside the trigger map.\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n return allTriggers.hasMatchingElement(trigger => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));\n });\n const cleanupMouseMoveHandler = useStableCallback(() => {\n if (!instance.handler) {\n return;\n }\n const doc = ownerDocument(store.select('domReferenceElement'));\n doc.removeEventListener('mousemove', instance.handler);\n instance.handler = undefined;\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n if (isActiveTrigger) {\n // eslint-disable-next-line no-underscore-dangle\n instance.handleCloseOptions = handleCloseRef.current?.__options;\n }\n React.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);\n\n // When closing before opening, clear the delay timeouts to cancel it\n // from showing.\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function onOpenChangeLocal(details) {\n if (!details.open) {\n isHoverCloseActiveRef.current = details.reason === REASONS.triggerHover;\n cleanupMouseMoveHandler();\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.blockMouseMove = true;\n instance.restTimeoutPending = false;\n } else {\n isHoverCloseActiveRef.current = false;\n }\n }\n events.on('openchange', onOpenChangeLocal);\n return () => {\n events.off('openchange', onOpenChangeLocal);\n };\n }, [enabled, events, instance, cleanupMouseMoveHandler]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function closeWithDelay(event, runElseBranch = true) {\n const closeDelay = getDelay(delayRef.current, 'close', instance.pointerType);\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n });\n } else if (runElseBranch) {\n instance.openChangeTimeout.clear();\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n }\n }\n const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select('domReferenceElement') : null);\n if (!isElement(trigger)) {\n return undefined;\n }\n function onMouseEnter(event) {\n instance.openChangeTimeout.clear();\n instance.blockMouseMove = false;\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n\n // Only rest delay is set; there's no fallback delay.\n // This will be handled by `onMouseMove`.\n const restMsValue = getRestMs(restMsRef.current);\n const openDelay = getDelay(delayRef.current, 'open', instance.pointerType);\n const eventTarget = getTarget(event);\n const currentTarget = event.currentTarget ?? null;\n const currentDomReference = store.select('domReferenceElement');\n let triggerNode = currentTarget;\n\n // Wrapper/delegated mode: resolve the actual trigger from the event target.\n if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {\n for (const triggerElement of store.context.triggerElements.elements()) {\n if (contains(triggerElement, eventTarget)) {\n triggerNode = triggerElement;\n break;\n }\n }\n }\n\n // Wrapper/delegated mode fallback: if the wrapper contains the active trigger,\n // treat this as re-entering that active trigger.\n if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {\n triggerNode = currentDomReference;\n }\n const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);\n const isOpen = store.select('open');\n const isInClosingTransition = isClosingRef.current?.() ?? store.select('transitionStatus') === 'ending';\n const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;\n const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;\n const isRestOnlyDelay = restMsValue > 0 && !openDelay;\n const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;\n const shouldOpen = !isOpen || isOverInactive;\n\n // Open immediately when moving between triggers while open, or during\n // a hover-driven close transition (including same-trigger re-entry).\n if (shouldOpenImmediately) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n return;\n }\n if (isRestOnlyDelay) {\n return;\n }\n if (openDelay) {\n instance.openChangeTimeout.start(openDelay, () => {\n if (shouldOpen && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n });\n } else if (shouldOpen) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n }\n }\n function onMouseLeave(event) {\n if (isClickLikeOpenEvent()) {\n clearPointerEvents();\n return;\n }\n cleanupMouseMoveHandler();\n const domReferenceElement = store.select('domReferenceElement');\n const doc = ownerDocument(domReferenceElement);\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n return;\n }\n if (handleCloseRef.current && handleCloseContextBase) {\n if (!store.select('open')) {\n instance.openChangeTimeout.clear();\n }\n const currentTrigger = triggerElementRef.current;\n instance.handler = handleCloseRef.current({\n ...handleCloseContextBase,\n tree,\n x: event.clientX,\n y: event.clientY,\n onClose() {\n clearPointerEvents();\n cleanupMouseMoveHandler();\n if (enabledRef.current && !isClickLikeOpenEvent() && currentTrigger === store.select('domReferenceElement')) {\n closeWithDelay(event, true);\n }\n }\n });\n doc.addEventListener('mousemove', instance.handler);\n instance.handler(event);\n return;\n }\n const shouldClose = instance.pointerType === 'touch' ? !contains(store.select('floatingElement'), event.relatedTarget) : true;\n if (shouldClose) {\n closeWithDelay(event);\n }\n }\n\n // Backup cancellation for Chrome's dropped `mouseleave` — see `guardStaleOpen`.\n function onMouseOut(event) {\n if (contains(trigger, event.relatedTarget)) {\n return; // moved within the trigger's own subtree\n }\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n }\n const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, 'mouseout', onMouseOut) : undefined;\n if (move) {\n return mergeCleanups(addEventListener(trigger, 'mousemove', onMouseEnter, {\n once: true\n }), addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }\n return mergeCleanups(addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);\n return React.useMemo(() => {\n if (!enabled) {\n return undefined;\n }\n function setPointerRef(event) {\n instance.pointerType = event.pointerType;\n }\n return {\n onPointerDown: setPointerRef,\n onPointerEnter: setPointerRef,\n onMouseMove(event) {\n const {\n nativeEvent\n } = event;\n const trigger = event.currentTarget;\n const currentDomReference = store.select('domReferenceElement');\n const currentOpen = store.select('open');\n const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {\n const floatingElement = store.select('floatingElement');\n if (floatingElement) {\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: trigger,\n floatingElement\n });\n }\n }\n const restMsValue = getRestMs(restMsRef.current);\n if (currentOpen && !isOverInactive || restMsValue === 0) {\n return;\n }\n if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {\n return;\n }\n instance.restTimeout.clear();\n function handleMouseMove() {\n instance.restTimeoutPending = false;\n\n // A delayed hover open should not override a click-like open that happened\n // while the hover delay was pending.\n if (isClickLikeOpenEvent()) {\n return;\n }\n const latestOpen = store.select('open');\n if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, nativeEvent, trigger));\n }\n }\n if (instance.pointerType === 'touch') {\n ReactDOM.flushSync(() => {\n handleMouseMove();\n });\n } else if (isOverInactive && currentOpen) {\n handleMouseMove();\n } else {\n instance.restTimeoutPending = true;\n instance.restTimeout.start(restMsValue, handleMouseMove);\n }\n }\n };\n }, [enabled, instance, isClickLikeOpenEvent, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);\n}","import { isElement } from '@floating-ui/utils/dom';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { contains, getTarget } from \"./utils/element.mjs\";\nimport { getNodeChildren } from \"./utils/nodes.mjs\";\n\n/* eslint-disable no-nested-ternary */\n\nconst CURSOR_SPEED_THRESHOLD = 0.1;\nconst CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;\nconst POLYGON_BUFFER = 0.5;\nfunction hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {\n return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;\n}\nfunction isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {\n let isInsideValue = false;\n if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {\n isInsideValue = !isInsideValue;\n }\n return isInsideValue;\n}\nfunction isInsideRect(pointX, pointY, rect) {\n return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;\n}\nfunction isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {\n const minX = Math.min(x1, x2);\n const maxX = Math.max(x1, x2);\n const minY = Math.min(y1, y2);\n const maxY = Math.max(y1, y2);\n return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;\n}\n/**\n * Generates a safe polygon area that the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nexport function safePolygon(options = {}) {\n const {\n blockPointerEvents = false\n } = options;\n const timeout = new Timeout();\n const fn = ({\n x,\n y,\n placement,\n elements,\n onClose,\n nodeId,\n tree\n }) => {\n const side = placement?.split('-')[0];\n let hasLanded = false;\n let lastX = null;\n let lastY = null;\n let lastCursorTime = typeof performance !== 'undefined' ? performance.now() : 0;\n function isCursorMovingSlowly(nextX, nextY) {\n const currentTime = performance.now();\n const elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return false;\n }\n const deltaX = nextX - lastX;\n const deltaY = nextY - lastY;\n const distanceSquared = deltaX * deltaX + deltaY * deltaY;\n const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return distanceSquared < thresholdSquared;\n }\n function close() {\n timeout.clear();\n onClose();\n }\n return function onMouseMove(event) {\n timeout.clear();\n const domReference = elements.domReference;\n const floating = elements.floating;\n if (!domReference || !floating || side == null || x == null || y == null) {\n return undefined;\n }\n const {\n clientX,\n clientY\n } = event;\n const target = getTarget(event);\n const isLeave = event.type === 'mouseleave';\n const isOverFloatingEl = contains(floating, target);\n const isOverReferenceEl = contains(domReference, target);\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return undefined;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n if (!isLeave) {\n hasLanded = true;\n return undefined;\n }\n }\n\n // Prevent overlapping floating element from being stuck in an open-close\n // loop: https://github.com/floating-ui/floating-ui/issues/1910\n if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {\n return undefined;\n }\n function hasOpenChildNode() {\n return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);\n }\n function closeIfNoOpenChild() {\n if (!hasOpenChildNode()) {\n close();\n }\n }\n\n // If any nested child is open, abort.\n if (hasOpenChildNode()) {\n return undefined;\n }\n const refRect = domReference.getBoundingClientRect();\n const rect = floating.getBoundingClientRect();\n const cursorLeaveFromRight = x > rect.right - rect.width / 2;\n const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n const isFloatingWider = rect.width > refRect.width;\n const isFloatingTaller = rect.height > refRect.height;\n const left = (isFloatingWider ? refRect : rect).left;\n const right = (isFloatingWider ? refRect : rect).right;\n const top = (isFloatingTaller ? refRect : rect).top;\n const bottom = (isFloatingTaller ? refRect : rect).bottom;\n\n // If the pointer is leaving from the opposite side, the \"buffer\" logic\n // creates a point where the floating element remains open, but should be\n // ignored.\n // A constant of 1 handles floating point rounding errors.\n if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {\n closeIfNoOpenChild();\n return undefined;\n }\n\n // Ignore when the cursor is within the rectangular trough between the\n // two elements. Since the triangle is created from the cursor point,\n // which can start beyond the ref element's edge, traversing back and\n // forth from the ref to the floating element can cause it to close. This\n // ensures it always remains open in that case.\n let isInsideTroughRect = false;\n switch (side) {\n case 'top':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);\n break;\n case 'bottom':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);\n break;\n case 'left':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);\n break;\n case 'right':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);\n break;\n default:\n }\n if (isInsideTroughRect) {\n return undefined;\n }\n if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {\n closeIfNoOpenChild();\n return undefined;\n }\n if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {\n closeIfNoOpenChild();\n return undefined;\n }\n let isInsidePolygon = false;\n switch (side) {\n case 'top':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y + POLYGON_BUFFER + 1;\n const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'bottom':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y - POLYGON_BUFFER;\n const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'left':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x + POLYGON_BUFFER + 1;\n const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);\n break;\n }\n case 'right':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x - POLYGON_BUFFER;\n const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);\n break;\n }\n default:\n }\n if (!isInsidePolygon) {\n closeIfNoOpenChild();\n } else if (!hasLanded) {\n timeout.start(40, closeIfNoOpenChild);\n }\n return undefined;\n };\n };\n\n // eslint-disable-next-line no-underscore-dangle\n fn.__options = {\n ...options,\n blockPointerEvents\n };\n return fn;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverRootContext.displayName = \"PopoverRootContext\";\nexport function usePopoverRootContext(optional) {\n const context = React.useContext(PopoverRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.' : _formatErrorMessage(47));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { NOOP } from '@base-ui/utils/empty';\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { NullStore } from \"../../utils/NullStore.mjs\";\nimport { attachPreventUnmountOnClose, createPopupFloatingRootContext, createInitialPopupStoreState, popupStoreSelectors, PopupTriggerMap, setPopupOpenState } from \"../../utils/popups/index.mjs\";\nimport { PATIENT_CLICK_THRESHOLD } from \"../../internals/constants.mjs\";\nconst selectors = {\n ...popupStoreSelectors,\n disabled: state => state.disabled,\n instantType: state => state.instantType,\n openMethod: state => state.openMethod,\n openChangeReason: state => state.openChangeReason,\n modal: state => state.modal,\n focusManagerModal: state => state.focusManagerModal,\n stickIfOpen: state => state.stickIfOpen,\n titleElementId: state => state.titleElementId,\n descriptionElementId: state => state.descriptionElementId,\n openOnHover: state => state.openOnHover,\n closeDelay: state => state.closeDelay,\n adaptiveOrigin: state => state.adaptiveOrigin\n};\n\n/**\n * The store view that detached handle-backed triggers read from. Both the real `PopoverStore` and\n * the inert fallback store satisfy it, so a trigger can read from whichever store the handle\n * currently exposes. Narrowed to the members a trigger actually uses — the trigger-data members plus\n * `setOpen` (called by the focus guards) — so the exposed surface can't bypass the open-change\n * pipeline; on the detached fallback store every one of these mutations is a no-op.\n */\n\nexport class PopoverStore extends ReactStore {\n constructor(initialState, floatingId, nested) {\n const triggerElements = new PopupTriggerMap();\n super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors);\n }\n setOpen = (nextOpen, eventDetails) => {\n const isHover = eventDetails.reason === REASONS.triggerHover;\n const isKeyboardClick = eventDetails.reason === REASONS.triggerPress && eventDetails.event.detail === 0;\n const isDismissClose = !nextOpen && (eventDetails.reason === REASONS.escapeKey || eventDetails.reason == null);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n const activeTriggerId = this.select('activeTriggerId');\n if (!nextOpen && eventDetails.reason === REASONS.closePress && eventDetails.trigger == null && activeTriggerId != null) {\n eventDetails.trigger = this.context.triggerElements.getById(activeTriggerId) ?? this.select('activeTriggerElement') ?? undefined;\n }\n this.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n const updatedState = {\n open: nextOpen,\n openChangeReason: eventDetails.reason\n };\n setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n this.update(updatedState);\n };\n if (isHover) {\n // Only allow \"patient\" clicks to close the popover if it's open.\n // If they clicked within 500ms of the popover opening, keep it open.\n this.set('stickIfOpen', true);\n this.context.stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {\n this.set('stickIfOpen', false);\n });\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n let instantType;\n if (isKeyboardClick) {\n instantType = 'click';\n } else if (isDismissClose) {\n instantType = 'dismiss';\n } else if (eventDetails.reason === REASONS.focusOut) {\n instantType = 'focus';\n }\n this.set('instantType', instantType);\n };\n}\n\n/**\n * Creates the inert fallback store used by detached handle-backed triggers while no\n * `Popover.Root` is attached. It preserves a popover-specific trigger registry in context so\n * detached triggers can register before migrating to the live root store. `setOpen` is a no-op\n * (matching the inert reads/writes of `NullStore`), so a trigger can hand the store to focus-guard\n * helpers that expect `setOpen` without it ever taking effect while detached.\n */\nexport function createNullPopoverStore() {\n const triggerElements = new PopupTriggerMap();\n const store = new NullStore(Object.freeze(createInitialState(undefined, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);\n return Object.assign(store, {\n setOpen: NOOP\n });\n}\nfunction createInitialState(initialState, triggerElements, floatingId, nested = false) {\n const state = {\n ...createInitialPopupStoreState(),\n disabled: false,\n modal: false,\n focusManagerModal: false,\n instantType: undefined,\n openMethod: null,\n openChangeReason: null,\n titleElementId: undefined,\n descriptionElementId: undefined,\n stickIfOpen: true,\n openOnHover: false,\n closeDelay: 0,\n adaptiveOrigin: undefined,\n ...initialState\n };\n if (state.open && initialState?.mounted === undefined) {\n state.mounted = true;\n }\n state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);\n return state;\n}\nfunction createInitialContext(triggerElements) {\n return {\n popupRef: /*#__PURE__*/React.createRef(),\n onOpenChange: undefined,\n onOpenChangeComplete: undefined,\n triggerFocusTargetRef: /*#__PURE__*/React.createRef(),\n beforeContentFocusGuardRef: /*#__PURE__*/React.createRef(),\n stickIfOpenTimeout: new Timeout(),\n triggerElements\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useDismiss, FloatingTree } from \"../../floating-ui-react/index.mjs\";\nimport { PopoverRootContext, usePopoverRootContext } from \"./PopoverRootContext.mjs\";\nimport { PopoverStore } from \"../store/PopoverStore.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { PopupHandleAttachment, useImplicitActiveTrigger, usePopupRootStore, useOpenStateTransitions, usePopupInteractionProps, usePopupRootSync } from \"../../utils/popups/index.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction PopoverRootComponent({\n props\n}) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n modal = false,\n handle,\n triggerId: triggerIdProp,\n defaultTriggerId: defaultTriggerIdProp = null\n } = props;\n const store = usePopoverRootStore(handle, {\n modal,\n open: defaultOpen,\n openProp,\n activeTriggerId: defaultTriggerIdProp,\n triggerIdProp\n });\n store.useControlledProp('openProp', openProp);\n store.useControlledProp('triggerIdProp', triggerIdProp);\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const payload = store.useState('payload');\n store.useContextCallback('onOpenChange', onOpenChange);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);\n usePopupRootSync(store, open);\n useImplicitActiveTrigger(store);\n const {\n forceUnmount\n } = useOpenStateTransitions(open, store, () => {\n store.update({\n stickIfOpen: true,\n openChangeReason: null\n });\n });\n store.useSyncedValues({\n modal\n });\n React.useEffect(() => {\n if (!open) {\n store.context.stickIfOpenTimeout.clear();\n }\n }, [store, open]);\n React.useImperativeHandle(props.actionsRef, () => ({\n unmount: forceUnmount,\n close: () => store.setOpen(false, createChangeEventDetails(REASONS.imperativeAction))\n }), [forceUnmount, store]);\n const shouldRenderInteractions = open || mounted;\n return /*#__PURE__*/_jsxs(PopoverRootContext.Provider, {\n value: store,\n children: [handle && /*#__PURE__*/_jsx(PopupHandleAttachment, {\n handle: handle,\n store: store\n }), shouldRenderInteractions && /*#__PURE__*/_jsx(PopoverInteractions, {\n store: store,\n modal: modal\n }), typeof children === 'function' ? children({\n payload\n }) : children]\n });\n}\n\n/**\n * Groups all parts of the popover.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nexport function PopoverRoot(props) {\n if (usePopoverRootContext(true)) {\n return /*#__PURE__*/_jsx(PopoverRootComponent, {\n props: props\n });\n }\n return /*#__PURE__*/_jsx(FloatingTree, {\n children: /*#__PURE__*/_jsx(PopoverRootComponent, {\n props: props\n })\n });\n}\nfunction usePopoverRootStore(handle, initialState) {\n // The store is owned by this Root instance and created exactly once. It is not tied to the handle:\n // the handle attaches to it, so swapping the handle re-attaches rather than recreating state.\n // Default values are only initial values; controlled values and root state are synced after creation.\n const store = usePopupRootStore((floatingId, nested) => new PopoverStore(initialState, floatingId, nested));\n\n // Popover-specific: dispose the patient-click timeout held in the store's context on unmount.\n React.useEffect(() => store.context.stickIfOpenTimeout.disposeEffect(), [store]);\n return store;\n}\nfunction PopoverInteractions({\n store,\n modal\n}) {\n const floatingRootContext = store.useState('floatingRootContext');\n const dismiss = useDismiss(floatingRootContext, {\n outsidePressEvent: {\n // Ensure `aria-hidden` on outside elements is removed immediately\n // on outside press when trapping focus.\n mouse: modal === 'trap-focus' ? 'sloppy' : 'intentional',\n touch: 'sloppy'\n }\n });\n\n // `useDismiss` is not given an `enabled` option, so it always returns both prop bags. Restore\n // the `EMPTY_OBJECT` fallbacks if that ever changes: the store fields are non-optional.\n // `dismiss.trigger` is always the same object as `dismiss.reference`.\n const triggerProps = dismiss.reference;\n // PopoverPopup already spreads `FOCUSABLE_POPUP_PROPS` directly, so the popup\n // props only need to carry the dismiss handlers.\n const popupProps = dismiss.floating;\n usePopupInteractionProps(store, {\n activeTriggerProps: triggerProps,\n inactiveTriggerProps: triggerProps,\n popupProps\n });\n return null;\n}","import { TransitionStatusDataAttributes, transitionStatusMapping } from \"../internals/stateAttributesMapping.mjs\";\nexport let CommonPopupDataAttributes = function (CommonPopupDataAttributes) {\n /**\n * Present when the popup is open.\n */\n CommonPopupDataAttributes[\"open\"] = \"data-open\";\n /**\n * Present when the popup is closed.\n */\n CommonPopupDataAttributes[\"closed\"] = \"data-closed\";\n /**\n * Present when the popup begins animating in.\n */\n CommonPopupDataAttributes[CommonPopupDataAttributes[\"startingStyle\"] = TransitionStatusDataAttributes.startingStyle] = \"startingStyle\";\n /**\n * Present when the popup is animating out.\n */\n CommonPopupDataAttributes[CommonPopupDataAttributes[\"endingStyle\"] = TransitionStatusDataAttributes.endingStyle] = \"endingStyle\";\n /**\n * Present when the anchor is hidden.\n */\n CommonPopupDataAttributes[\"anchorHidden\"] = \"data-anchor-hidden\";\n /**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type { 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\n CommonPopupDataAttributes[\"side\"] = \"data-side\";\n /**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\n CommonPopupDataAttributes[\"align\"] = \"data-align\";\n return CommonPopupDataAttributes;\n}({});\nexport let CommonTriggerDataAttributes = /*#__PURE__*/function (CommonTriggerDataAttributes) {\n /**\n * Present when the popup is open.\n */\n CommonTriggerDataAttributes[\"popupOpen\"] = \"data-popup-open\";\n /**\n * Present when a pressable trigger is pressed.\n */\n CommonTriggerDataAttributes[\"pressed\"] = \"data-pressed\";\n return CommonTriggerDataAttributes;\n}({});\n\n// Literal keys (instead of enum member references) keep the docs-only enums above\n// tree-shakeable: a runtime reference would retain the whole enum IIFE in every bundle.\nconst TRIGGER_HOOK = {\n 'data-popup-open': ''\n};\nconst PRESSABLE_TRIGGER_HOOK = {\n 'data-popup-open': '',\n 'data-pressed': ''\n};\nconst POPUP_OPEN_HOOK = {\n 'data-open': ''\n};\nconst POPUP_CLOSED_HOOK = {\n 'data-closed': ''\n};\nconst ANCHOR_HIDDEN_HOOK = {\n 'data-anchor-hidden': ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const pressableTriggerOpenStateMapping = {\n open(value) {\n if (value) {\n return PRESSABLE_TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const popupStateMapping = {\n open(value) {\n if (value) {\n return POPUP_OPEN_HOOK;\n }\n return POPUP_CLOSED_HOOK;\n },\n anchorHidden(value) {\n if (value) {\n return ANCHOR_HIDDEN_HOOK;\n }\n return null;\n }\n};\nexport const popupTransitionStateMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};","export const OPEN_DELAY = 300;","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { contains, getNextTabbable, getTabbableAfterElement, getTabbableBeforeElement, isOutsideEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * Minimal store interface required by the focus guard hook.\n * Both PopoverStore and MenuStore satisfy this interface.\n */\n\n/**\n * Provides focus guard handlers for popup triggers (Popover, Menu).\n *\n * When the popup is open, invisible focus guard elements are placed before and after\n * the trigger. These handlers close the popup and move focus to the appropriate\n * tabbable element when the guards receive focus (i.e. when the user tabs out).\n */\nexport function useTriggerFocusGuards(store, triggerElementRef) {\n const preFocusGuardRef = React.useRef(null);\n function handlePreFocusGuardFocus(event) {\n ReactDOM.flushSync(() => {\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent, event.currentTarget));\n });\n const previousTabbable = getTabbableBeforeElement(preFocusGuardRef.current);\n previousTabbable?.focus();\n }\n function handleFocusTargetFocus(event) {\n const positionerElement = store.select('positionerElement');\n if (positionerElement && isOutsideEvent(event, positionerElement)) {\n store.context.beforeContentFocusGuardRef.current?.focus();\n } else {\n ReactDOM.flushSync(() => {\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent, event.currentTarget));\n });\n let nextTabbable = getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current);\n while (nextTabbable !== null && contains(positionerElement, nextTabbable)) {\n const prevTabbable = nextTabbable;\n nextTabbable = getNextTabbable(nextTabbable);\n if (nextTabbable === prevTabbable) {\n break;\n }\n }\n nextTabbable?.focus();\n }\n }\n return {\n preFocusGuardRef,\n handlePreFocusGuardFocus,\n handleFocusTargetFocus\n };\n}","'use client';\n\nimport * as React from 'react';\n/**\n * Provides a cross-browser way to determine the type of the pointer used to click.\n * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.\n * Additionally, this implementation detects if the click was triggered by the keyboard.\n *\n * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.\n */\nexport function useEnhancedClickHandler(handler) {\n const lastClickInteractionTypeRef = React.useRef('');\n const handlePointerDown = React.useCallback(event => {\n if (event.defaultPrevented) {\n return;\n }\n lastClickInteractionTypeRef.current = event.pointerType;\n handler(event, event.pointerType);\n }, [handler]);\n const handleClick = React.useCallback(event => {\n // event.detail has the number of clicks performed on the element. 0 means it was triggered by the keyboard.\n if (event.detail === 0) {\n handler(event, 'keyboard');\n return;\n }\n if ('pointerType' in event) {\n // Chrome and Edge correctly use PointerEvent\n handler(event, event.pointerType);\n } else {\n handler(event, lastClickInteractionTypeRef.current);\n }\n lastClickInteractionTypeRef.current = '';\n }, [handler]);\n return {\n onClick: handleClick,\n onPointerDown: handlePointerDown\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useEnhancedClickHandler } from '@base-ui/utils/useEnhancedClickHandler';\nimport { platform } from '@base-ui/utils/platform';\nimport { useValueChanged } from \"../internals/useValueChanged.mjs\";\nexport function useOpenMethodTriggerProps(open, setOpenMethod) {\n const handleTriggerClick = useStableCallback((_, interactionType) => {\n const isOpen = typeof open === 'function' ? open() : open;\n if (!isOpen) {\n setOpenMethod(interactionType || (\n // On iOS Safari, the hitslop around touch targets means tapping outside an element's\n // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`\n // will be \"\" in that case.\n platform.os.ios ? 'touch' : ''));\n }\n });\n const {\n onClick,\n onPointerDown\n } = useEnhancedClickHandler(handleTriggerClick);\n return React.useMemo(() => ({\n onClick,\n onPointerDown\n }), [onClick, onPointerDown]);\n}\n\n/**\n * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.\n *\n * @param open The open state of the component.\n */\nexport function useOpenInteractionType(open) {\n const [openMethod, setOpenMethod] = React.useState(null);\n const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);\n useValueChanged(open, previousOpen => {\n if (previousOpen && !open) {\n setOpenMethod(null);\n }\n });\n return React.useMemo(() => ({\n openMethod,\n triggerProps\n }), [openMethod, triggerProps]);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { useButton } from \"../../internals/use-button/useButton.mjs\";\nimport { triggerOpenStateMapping, pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { safePolygon, useClick, useHoverReferenceInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { OPEN_DELAY } from \"../utils/constants.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { usePopupHandleStore, useTriggerDataForwarding } from \"../../utils/popups/index.mjs\";\nimport { useTriggerFocusGuards } from \"../../utils/popups/useTriggerFocusGuards.mjs\";\nimport { useOpenMethodTriggerProps } from \"../../utils/useOpenInteractionType.mjs\";\n\n/**\n * A button that opens the popover.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const PopoverTrigger = /*#__PURE__*/React.forwardRef(function PopoverTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n handle,\n payload,\n openOnHover = false,\n delay = OPEN_DELAY,\n closeDelay = 0,\n id: idProp,\n ...elementProps\n } = componentProps;\n const rootStore = usePopoverRootContext(true);\n const handleStore = usePopupHandleStore(handle);\n const store = handleStore ?? rootStore;\n if (!store) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.' : _formatErrorMessage(74));\n }\n const thisTriggerId = useBaseUiId(idProp);\n const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);\n const floatingContext = store.useState('floatingRootContext');\n const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);\n const popupId = store.useState('triggerPopupId', thisTriggerId);\n const triggerElementRef = React.useRef(null);\n const {\n registerTrigger,\n isMountedByThisTrigger\n } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {\n payload,\n disabled,\n openOnHover,\n closeDelay\n });\n const openReason = store.useState('openChangeReason');\n const stickIfOpen = store.useState('stickIfOpen');\n const openMethod = store.useState('openMethod');\n const focusManagerModal = store.useState('focusManagerModal');\n const hoverProps = useHoverReferenceInteraction(floatingContext, {\n enabled: !disabled && openOnHover && (openMethod !== 'touch' || openReason !== REASONS.triggerPress),\n mouseOnly: true,\n move: false,\n handleClose: safePolygon(),\n restMs: delay,\n delay: {\n close: closeDelay\n },\n triggerElementRef,\n isActiveTrigger: isTriggerActive,\n isClosing: () => store.select('transitionStatus') === 'ending'\n });\n const click = useClick(floatingContext, {\n stickIfOpen\n });\n const interactionTypeProps = useOpenMethodTriggerProps(() => store.select('open'), interactionType => {\n store.set('openMethod', interactionType);\n });\n const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const stateAttributesMapping = {\n open(value) {\n if (value && openReason === REASONS.triggerPress) {\n return pressableTriggerOpenStateMapping.open(value);\n }\n return triggerOpenStateMapping.open(value);\n }\n };\n const {\n preFocusGuardRef,\n handlePreFocusGuardFocus,\n handleFocusTargetFocus\n } = useTriggerFocusGuards(store, triggerElementRef);\n const state = {\n disabled,\n open: isOpenedByThisTrigger\n };\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef],\n props: [click.reference, hoverProps, rootTriggerProps, interactionTypeProps, {\n [CLICK_TRIGGER_IDENTIFIER]: '',\n id: thisTriggerId,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpenedByThisTrigger,\n 'aria-controls': popupId\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n\n // A fragment with key is required to ensure that the `element` is mounted to the same DOM node\n // regardless of whether the focus guards are rendered or not.\n const keyedElement = /*#__PURE__*/_jsx(React.Fragment, {\n children: element\n }, thisTriggerId);\n if (isMountedByThisTrigger && !focusManagerModal) {\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(FocusGuard, {\n ref: preFocusGuardRef,\n onFocus: handlePreFocusGuardFocus\n }), keyedElement, /*#__PURE__*/_jsx(FocusGuard, {\n ref: store.context.triggerFocusTargetRef,\n onFocus: handleFocusTargetFocus\n })]\n });\n }\n return keyedElement;\n});\nif (process.env.NODE_ENV !== \"production\") PopoverTrigger.displayName = \"PopoverTrigger\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverPortalContext.displayName = \"PopoverPortalContext\";\nexport function usePopoverPortalContext() {\n const value = React.useContext(PopoverPortalContext);\n if (value === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Popover.Portal> is missing.' : _formatErrorMessage(45));\n }\n return value;\n}","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { PopoverPortalContext } from \"./PopoverPortalContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const PopoverPortal = /*#__PURE__*/React.forwardRef(function PopoverPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const store = usePopoverRootContext();\n const mounted = store.useState('mounted');\n const shouldRender = mounted || keepMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(PopoverPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPortal.displayName = \"PopoverPortal\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const PopoverPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") PopoverPositionerContext.displayName = \"PopoverPositionerContext\";\nexport function usePopoverPositionerContext() {\n const context = React.useContext(PopoverPositionerContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.' : _formatErrorMessage(46));\n }\n return context;\n}","import { clamp, evaluate, getAlignment, getAlignmentAxis, getAxisLength, getPaddingObject } from '@floating-ui/utils';\n/**\n * Fork of the original `arrow` middleware from Floating UI that allows\n * configuring the offset parent.\n */\nexport const baseArrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0,\n offsetParent = 'real'\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = offsetParent === 'real' ? await platform.getOffsetParent?.(element) : elements.floating;\n let clientSize = elements.floating[clientProp] || rects.floating[length];\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await platform.isElement?.(arrowOffsetParent))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n // eslint-disable-next-line no-nested-ternary\n const alignmentOffset = shouldAddOffset ? center < min ? center - min : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nexport const arrow = (options, deps) => ({\n ...baseArrow(options),\n options: [options, deps]\n});","export const hide = {\n name: 'hide',\n async fn(state) {\n const {\n width,\n height,\n x,\n y\n } = state.rects.reference;\n const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;\n // Mirrors Floating UI's `hide()` referenceHidden strategy. Floating UI injects\n // `detectOverflow` into the middleware platform before invoking middleware.\n const overflow = await state.platform.detectOverflow(state, {\n elementContext: 'reference'\n });\n const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;\n return {\n data: {\n referenceHidden: referenceHidden || anchorHidden\n }\n };\n }\n};","export const DEFAULT_SIDES = {\n sideX: 'left',\n sideY: 'top'\n};\n\n// Self-contained stand-in for Floating UI's `Middleware` type. Referencing the real type in\n// store state makes `tsc` declaration emit reference `Platform`/`detectOverflow` from\n// `@floating-ui/core` internals, which fails as non-portable (TS2883) in consuming builds.","'use client';\n\nimport * as React from 'react';\nimport { getSide, getAlignment, getSideAxis } from '@floating-ui/utils';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { autoUpdate, flip, limitShift, offset, shift as floatingShift, size } from \"../floating-ui-react/index.mjs\";\nimport { useBaseUIFloating } from \"../floating-ui-react/hooks/useFloating.mjs\";\nimport { useDirection } from \"./direction-context/DirectionContext.mjs\";\nimport { arrow } from \"../floating-ui-react/middleware/arrow.mjs\";\nimport { hide } from \"../utils/hideMiddleware.mjs\";\nimport { DEFAULT_SIDES } from \"../utils/adaptiveOriginConstants.mjs\";\nconst AVAILABLE_WIDTH_VAR = '--available-width';\nconst AVAILABLE_HEIGHT_VAR = '--available-height';\nfunction getLogicalSide(sideParam, renderedSide, isRtl) {\n const isLogicalSideParam = sideParam === 'inline-start' || sideParam === 'inline-end';\n const logicalRight = isRtl ? 'inline-start' : 'inline-end';\n const logicalLeft = isRtl ? 'inline-end' : 'inline-start';\n return {\n top: 'top',\n right: isLogicalSideParam ? logicalRight : 'right',\n bottom: 'bottom',\n left: isLogicalSideParam ? logicalLeft : 'left'\n }[renderedSide];\n}\nfunction getOffsetData(state, sideParam, isRtl) {\n const {\n rects,\n placement\n } = state;\n const data = {\n side: getLogicalSide(sideParam, getSide(placement), isRtl),\n align: getAlignment(placement) || 'center',\n anchor: {\n width: rects.reference.width,\n height: rects.reference.height\n },\n positioner: {\n width: rects.floating.width,\n height: rects.floating.height\n }\n };\n return data;\n}\n/**\n * Provides standardized anchor positioning behavior for floating elements. Wraps Floating UI's\n * `useFloating` hook.\n */\nexport function useAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useBaseUIFloating);\n}\nexport function useAnchorPositioningWithHook(params, useFloatingHook) {\n const {\n // Public parameters\n anchor,\n positionMethod = 'absolute',\n side: sideParam = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n collisionBoundary,\n collisionPadding: collisionPaddingParam = 5,\n sticky = false,\n arrowPadding = 5,\n disableAnchorTracking = false,\n inline: inlineMiddleware,\n // Private parameters\n keepMounted = false,\n floatingRootContext,\n mounted,\n collisionAvoidance,\n shift,\n nodeId,\n adaptiveOrigin,\n lazyFlip = false,\n externalTree\n } = params;\n const [mountSide, setMountSide] = React.useState(null);\n if (!mounted && mountSide !== null) {\n setMountSide(null);\n }\n const collisionAvoidanceSide = collisionAvoidance.side || 'flip';\n const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';\n const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';\n const shiftCrossAxis = shift?.crossAxis ?? false;\n const shiftRootBoundary = shift?.rootBoundary;\n const anchorFn = typeof anchor === 'function' ? anchor : undefined;\n const anchorFnCallback = useStableCallback(anchorFn);\n const anchorDep = anchorFn ? anchorFnCallback : anchor;\n const anchorValueRef = useValueAsRef(anchor);\n const mountedRef = useValueAsRef(mounted);\n const direction = useDirection();\n const isRtl = direction === 'rtl';\n const side = mountSide || {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'inline-end': isRtl ? 'left' : 'right',\n 'inline-start': isRtl ? 'right' : 'left'\n }[sideParam];\n const placement = align === 'center' ? side : `${side}-${align}`;\n let collisionPadding = collisionPaddingParam;\n if (typeof collisionPadding === 'number') {\n collisionPadding = {\n top: collisionPadding,\n right: collisionPadding,\n bottom: collisionPadding,\n left: collisionPadding\n };\n } else if (collisionPadding) {\n collisionPadding = {\n top: collisionPadding.top || 0,\n right: collisionPadding.right || 0,\n bottom: collisionPadding.bottom || 0,\n left: collisionPadding.left || 0\n };\n }\n\n // Create a bias to the preferred side.\n // On iOS, when the mobile software keyboard opens, the input is exactly centered\n // in the viewport, but this can cause it to flip to the top undesirably.\n // The bias is only applied to `flip()` so it doesn't shift the resting position\n // computed by `shift()` and `size()` away from the requested `collisionPadding`.\n const bias = 1;\n const biasTop = sideParam === 'bottom' ? bias : 0;\n const biasBottom = sideParam === 'top' ? bias : 0;\n const biasLeft = sideParam === 'right' ? bias : 0;\n const biasRight = sideParam === 'left' ? bias : 0;\n const commonCollisionProps = {\n boundary: collisionBoundary === 'clipping-ancestors' ? 'clippingAncestors' : collisionBoundary,\n padding: collisionPadding\n };\n\n // Using a ref assumes that the arrow element is always present in the DOM for the lifetime of the\n // popup. If this assumption ends up being false, we can switch to state to manage the arrow's\n // presence.\n const arrowRef = React.useRef(null);\n\n // Keep these reactive if they're not functions\n const sideOffsetRef = useValueAsRef(sideOffset);\n const alignOffsetRef = useValueAsRef(alignOffset);\n const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;\n const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;\n const middleware = [];\n if (inlineMiddleware) {\n middleware.push(inlineMiddleware);\n }\n middleware.push(offset(state => {\n const data = getOffsetData(state, sideParam, isRtl);\n const sideAxis = typeof sideOffsetRef.current === 'function' ? sideOffsetRef.current(data) : sideOffsetRef.current;\n const alignAxis = typeof alignOffsetRef.current === 'function' ? alignOffsetRef.current(data) : alignOffsetRef.current;\n return {\n mainAxis: sideAxis,\n crossAxis: alignAxis,\n alignmentAxis: alignAxis\n };\n }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));\n const shiftDisabled = collisionAvoidanceAlign === 'none' && collisionAvoidanceSide !== 'shift';\n const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === 'shift');\n const flipMiddleware = collisionAvoidanceSide === 'none' ? null : flip({\n ...commonCollisionProps,\n // Ensure the popup flips if it's been limited by its --available-height and it resizes.\n // Since the size() padding is smaller than the flip() padding, flip() will take precedence.\n padding: {\n top: collisionPadding.top + bias + biasTop,\n right: collisionPadding.right + bias + biasRight,\n bottom: collisionPadding.bottom + bias + biasBottom,\n left: collisionPadding.left + bias + biasLeft\n },\n mainAxis: !shiftCrossAxis && collisionAvoidanceSide === 'flip',\n crossAxis: collisionAvoidanceAlign === 'flip' ? 'alignment' : false,\n fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide\n });\n const shiftMiddleware = shiftDisabled ? null : floatingShift({\n ...commonCollisionProps,\n // Use the Layout Viewport to avoid shifting around when pinch-zooming.\n rootBoundary: shiftRootBoundary,\n mainAxis: collisionAvoidanceAlign !== 'none',\n crossAxis: crossAxisShiftEnabled,\n limiter: sticky || shiftCrossAxis ? undefined : limitShift(limitData => {\n if (!arrowRef.current) {\n return {};\n }\n const {\n width,\n height\n } = arrowRef.current.getBoundingClientRect();\n const sideAxis = getSideAxis(getSide(limitData.placement));\n const arrowSize = sideAxis === 'y' ? width : height;\n const offsetAmount = sideAxis === 'y' ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;\n return {\n offset: arrowSize / 2 + offsetAmount / 2\n };\n })\n }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);\n\n // https://floating-ui.com/docs/flip#combining-with-shift\n if (collisionAvoidanceSide === 'shift' || collisionAvoidanceAlign === 'shift' || align === 'center') {\n middleware.push(shiftMiddleware, flipMiddleware);\n } else {\n middleware.push(flipMiddleware, shiftMiddleware);\n }\n middleware.push(size({\n ...commonCollisionProps,\n apply({\n elements: {\n floating\n },\n availableWidth,\n availableHeight,\n rects\n }) {\n if (!mountedRef.current) {\n return;\n }\n const floatingStyle = floating.style;\n floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);\n floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);\n\n // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.\n const dpr = ownerWindow(floating).devicePixelRatio || 1;\n const {\n x,\n y,\n width,\n height\n } = rects.reference;\n const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;\n const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;\n floatingStyle.setProperty('--anchor-width', `${anchorWidth}px`);\n floatingStyle.setProperty('--anchor-height', `${anchorHeight}px`);\n }\n }), arrow(state => ({\n // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,\n // we'll create a fake element.\n element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),\n padding: arrowPadding,\n offsetParent: 'floating'\n }), [arrowPadding]), {\n name: 'transformOrigin',\n fn(state) {\n const {\n elements,\n middlewareData,\n placement: renderedPlacement,\n rects,\n y\n } = state;\n const currentRenderedSide = getSide(renderedPlacement);\n const currentRenderedAxis = getSideAxis(currentRenderedSide);\n const arrowEl = arrowRef.current;\n const arrowX = middlewareData.arrow?.x || 0;\n const arrowY = middlewareData.arrow?.y || 0;\n const arrowWidth = arrowEl?.clientWidth || 0;\n const arrowHeight = arrowEl?.clientHeight || 0;\n const transformX = arrowX + arrowWidth / 2;\n const transformY = arrowY + arrowHeight / 2;\n const shiftY = Math.abs(middlewareData.shift?.y || 0);\n const halfAnchorHeight = rects.reference.height / 2;\n const sideOffsetValue = typeof sideOffset === 'function' ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;\n const isOverlappingAnchor = shiftY > sideOffsetValue;\n const adjacentTransformOrigin = {\n top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,\n bottom: `${transformX}px ${-sideOffsetValue}px`,\n left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,\n right: `${-sideOffsetValue}px ${transformY}px`\n }[currentRenderedSide];\n const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y}px`;\n elements.floating.style.setProperty('--transform-origin', crossAxisShiftEnabled && currentRenderedAxis === 'y' && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);\n return {};\n }\n }, hide, adaptiveOrigin);\n useIsoLayoutEffect(() => {\n // Ensure positioning doesn't run initially for `keepMounted` elements that\n // aren't initially open.\n if (!mounted && floatingRootContext) {\n floatingRootContext.update({\n referenceElement: null,\n floatingElement: null,\n domReferenceElement: null,\n positionReference: null\n });\n }\n }, [mounted, floatingRootContext]);\n const autoUpdateOptions = React.useMemo(() => ({\n elementResize: !disableAnchorTracking && typeof ResizeObserver !== 'undefined',\n layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== 'undefined'\n }), [disableAnchorTracking]);\n const {\n refs,\n elements,\n x,\n y,\n middlewareData,\n update,\n placement: renderedPlacement,\n context,\n isPositioned,\n floatingStyles: originalFloatingStyles\n } = useFloatingHook({\n rootContext: floatingRootContext,\n open: keepMounted ? mounted : undefined,\n placement,\n middleware,\n strategy: positionMethod,\n whileElementsMounted: keepMounted ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),\n nodeId,\n externalTree\n });\n const {\n sideX,\n sideY\n } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;\n\n // Default to `fixed` when not positioned to prevent `autoFocus` scroll jumps.\n // This ensures the popup is inside the viewport initially before it gets positioned.\n const resolvedPosition = isPositioned ? positionMethod : 'fixed';\n const floatingStyles = React.useMemo(() => {\n let base;\n if (!isPositioned) {\n // Until a position for the current open is computed, ignore any coordinates retained from a\n // previous open (or from a pass that measured the hidden popup as 0x0). Rendering the\n // full-size popup at such stale coordinates can overflow the layout viewport, which makes\n // mobile Chrome zoom the page out and reflow everything the popup is anchored to.\n base = {\n position: resolvedPosition,\n top: 0,\n left: 0\n };\n } else if (adaptiveOrigin) {\n base = {\n position: resolvedPosition,\n [sideX]: x,\n [sideY]: y\n };\n } else {\n base = {\n ...originalFloatingStyles,\n position: resolvedPosition\n };\n }\n\n // Seed the available size vars so consumer `max-height: min(x, var(--available-height))` rules\n // resolve to a valid length on the first positioning pass, before `size()` writes the real\n // values. Without a fallback the unresolved `var()` invalidates the whole declaration, so the\n // popup is measured unconstrained while `flip()` picks its side, against the full content\n // height rather than the capped one. Seeded unconditionally (not only while `!isPositioned`):\n // the keys must stay present with a constant value so React's per-property style diff never\n // rewrites them after mount, preserving the px values `size()` sets imperatively. Moving them\n // into the `!isPositioned` branch makes React remove them once positioned, wiping `size()`'s\n // values and leaving the popup unconstrained.\n base[AVAILABLE_WIDTH_VAR] = '100vw';\n base[AVAILABLE_HEIGHT_VAR] = '100vh';\n if (!isPositioned) {\n base.opacity = 0;\n }\n return base;\n }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);\n const registeredPositionReferenceRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n const resolvedAnchor = typeof anchorValue === 'function' ? anchorValue() : anchorValue;\n const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;\n const finalAnchor = unwrappedElement || null;\n if (finalAnchor !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(finalAnchor);\n registeredPositionReferenceRef.current = finalAnchor;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n\n // Refs from parent components are set after useLayoutEffect runs and are available in useEffect.\n // Therefore, if the anchor is a ref, we need to update the position reference in useEffect.\n if (typeof anchorValue === 'function') {\n return;\n }\n if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(anchorValue.current);\n registeredPositionReferenceRef.current = anchorValue.current;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (keepMounted && mounted && elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);\n }\n return undefined;\n }, [keepMounted, mounted, elements, update, autoUpdateOptions]);\n const renderedSide = getSide(renderedPlacement);\n const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);\n const renderedAlign = getAlignment(renderedPlacement) || 'center';\n const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);\n\n // Locks the flip (makes it \"sticky\") so it doesn't prefer a given placement\n // and flips back lazily, not eagerly. Ideal for filtered lists that change\n // the size of the popup dynamically to avoid unwanted flipping when typing.\n useIsoLayoutEffect(() => {\n if (lazyFlip && mounted && isPositioned && renderedSide !== side) {\n setMountSide(renderedSide);\n }\n }, [lazyFlip, mounted, isPositioned, renderedSide, side]);\n const arrowStyles = React.useMemo(() => ({\n position: 'absolute',\n top: middlewareData.arrow?.y,\n left: middlewareData.arrow?.x\n }), [middlewareData.arrow]);\n const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;\n return React.useMemo(() => ({\n positionerStyles: floatingStyles,\n arrowStyles,\n arrowRef,\n arrowUncentered,\n side: logicalRenderedSide,\n align: renderedAlign,\n physicalSide: renderedSide,\n anchorHidden,\n refs,\n context,\n isPositioned,\n update\n }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update]);\n}\nfunction isRef(param) {\n return param != null && 'current' in param;\n}","import * as React from 'react';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop(props, ref) {\n const {\n cutout,\n ...otherProps\n } = props;\n let clipPath;\n if (cutout) {\n const rect = cutout.getBoundingClientRect();\n clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"presentation\"\n // Ensures Floating UI's outside press detection runs, as it considers\n // it an element that existed when the popup rendered.\n ,\n \"data-base-ui-inert\": \"\",\n ...otherProps,\n style: {\n position: 'fixed',\n inset: 0,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n clipPath\n }\n });\n});\nif (process.env.NODE_ENV !== \"production\") InternalBackdrop.displayName = \"InternalBackdrop\";","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { DISABLED_TRANSITIONS_STYLE } from \"./constants.mjs\";\nexport function getDisabledMountTransitionStyles(transitionStatus) {\n return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;\n}","'use client';\n\nimport { popupStateMapping } from \"./popupStateMapping.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../internals/getDisabledMountTransitionStyles.mjs\";\n/**\n * Renders the shared outer Positioner element used by popup components.\n * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.\n */\nexport function usePositioner(componentProps, state, {\n styles,\n transitionStatus,\n props,\n refs,\n hidden,\n inert = false\n}) {\n const style = {\n ...styles\n };\n if (inert) {\n style.pointerEvents = 'none';\n }\n return useRenderElement('div', componentProps, {\n state,\n ref: refs,\n props: [{\n role: 'presentation',\n hidden,\n style\n }, getDisabledMountTransitionStyles(transitionStatus), props],\n stateAttributesMapping: popupStateMapping\n });\n}","'use client';\n\nimport { isOverflowElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from \"./addEventListener.mjs\";\nimport { platform } from \"./platform/index.mjs\";\nimport { ownerDocument, ownerWindow } from \"./owner.mjs\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { Timeout } from \"./useTimeout.mjs\";\nimport { AnimationFrame } from \"./useAnimationFrame.mjs\";\nlet originalHtmlStyles = {};\nlet originalBodyStyles = {};\nlet originalHtmlScrollBehavior = '';\n\n// The viewport's overflow comes from <html> when it establishes its own scroll container, and\n// propagates from <body> otherwise. An `overflow` style on the other element doesn't lock the page.\nfunction getViewportScroller(html, body) {\n return isOverflowElement(html) ? html : body;\n}\nfunction isPageScrollLocked(win, html, body) {\n return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);\n}\nfunction hasInsetScrollbars(referenceElement) {\n if (typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const win = ownerWindow(doc);\n return win.innerWidth - doc.documentElement.clientWidth > 0;\n}\nfunction supportsStableScrollbarGutter(referenceElement) {\n const supported = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('scrollbar-gutter', 'stable');\n if (!supported || typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const scrollContainer = getViewportScroller(html, body);\n const originalScrollContainerOverflowY = scrollContainer.style.overflowY;\n const originalHtmlStyleGutter = html.style.scrollbarGutter;\n html.style.scrollbarGutter = 'stable';\n scrollContainer.style.overflowY = 'scroll';\n const before = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = 'hidden';\n const after = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = originalScrollContainerOverflowY;\n html.style.scrollbarGutter = originalHtmlStyleGutter;\n return before === after;\n}\nfunction preventScrollOverlayScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n\n // If an `overflow` style is present on <html>, we need to lock it, because a lock on <body>\n // won't have any effect.\n // But if <body> has an `overflow` style (like `overflow-x: hidden`), we need to lock it\n // instead, as sticky elements shift otherwise.\n const elementToLock = getViewportScroller(html, body);\n const originalElementToLockStyles = {\n overflowY: elementToLock.style.overflowY,\n overflowX: elementToLock.style.overflowX\n };\n Object.assign(elementToLock.style, {\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n return () => {\n Object.assign(elementToLock.style, originalElementToLockStyles);\n };\n}\nfunction preventScrollInsetScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n let scrollTop = 0;\n let scrollLeft = 0;\n let updateGutterOnly = false;\n const resizeFrame = AnimationFrame.create();\n\n // Pinch-zoom in Safari causes a shift. Just don't lock scroll if there's any pinch-zoom.\n if (platform.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {\n return () => {};\n }\n function lockScroll() {\n /* DOM reads: */\n\n const htmlStyles = win.getComputedStyle(html);\n const bodyStyles = win.getComputedStyle(body);\n const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || '';\n const hasBothEdges = htmlScrollbarGutterValue.includes('both-edges');\n const scrollbarGutterValue = hasBothEdges ? 'stable both-edges' : 'stable';\n scrollTop = html.scrollTop;\n scrollLeft = html.scrollLeft;\n originalHtmlStyles = {\n scrollbarGutter: html.style.scrollbarGutter,\n overflowY: html.style.overflowY,\n overflowX: html.style.overflowX\n };\n originalHtmlScrollBehavior = html.style.scrollBehavior;\n originalBodyStyles = {\n position: body.style.position,\n height: body.style.height,\n width: body.style.width,\n boxSizing: body.style.boxSizing,\n overflowY: body.style.overflowY,\n overflowX: body.style.overflowX,\n scrollBehavior: body.style.scrollBehavior\n };\n const isScrollableY = html.scrollHeight > html.clientHeight;\n const isScrollableX = html.scrollWidth > html.clientWidth;\n const hasConstantOverflowY = htmlStyles.overflowY === 'scroll' || bodyStyles.overflowY === 'scroll';\n const hasConstantOverflowX = htmlStyles.overflowX === 'scroll' || bodyStyles.overflowX === 'scroll';\n\n // Values can be negative in Firefox\n const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);\n const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);\n\n // Avoid shift due to the default <body> margin. This does cause elements to be clipped\n // with whitespace. Warn if <body> has margins?\n const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);\n const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);\n const elementToLock = getViewportScroller(html, body);\n updateGutterOnly = supportsStableScrollbarGutter(referenceElement);\n\n /*\n * DOM writes:\n * Do not read the DOM past this point!\n */\n\n if (updateGutterOnly) {\n html.style.scrollbarGutter = scrollbarGutterValue;\n elementToLock.style.overflowY = 'hidden';\n elementToLock.style.overflowX = 'hidden';\n return;\n }\n Object.assign(html.style, {\n scrollbarGutter: scrollbarGutterValue,\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n if (isScrollableY || hasConstantOverflowY) {\n html.style.overflowY = 'scroll';\n }\n if (isScrollableX || hasConstantOverflowX) {\n html.style.overflowX = 'scroll';\n }\n Object.assign(body.style, {\n position: 'relative',\n height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',\n width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',\n boxSizing: 'border-box',\n // Assign the longhands that `cleanup` restores, so nothing is left behind.\n overflowY: 'hidden',\n overflowX: 'hidden',\n scrollBehavior: 'unset'\n });\n body.scrollTop = scrollTop;\n body.scrollLeft = scrollLeft;\n html.setAttribute('data-base-ui-scroll-locked', '');\n html.style.scrollBehavior = 'unset';\n }\n function cleanup() {\n Object.assign(html.style, originalHtmlStyles);\n Object.assign(body.style, originalBodyStyles);\n if (!updateGutterOnly) {\n html.scrollTop = scrollTop;\n html.scrollLeft = scrollLeft;\n html.removeAttribute('data-base-ui-scroll-locked');\n html.style.scrollBehavior = originalHtmlScrollBehavior;\n }\n }\n function handleResize() {\n cleanup();\n resizeFrame.request(lockScroll);\n }\n lockScroll();\n const unsubscribeResize = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n cleanup();\n // Sometimes this cleanup can run after test teardown because it is called\n // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling\n // `removeEventListener` when it is no longer available in tests.\n if (typeof win.removeEventListener === 'function') {\n unsubscribeResize();\n }\n };\n}\nclass ScrollLocker {\n lockCount = 0;\n restore = null;\n timeoutLock = Timeout.create();\n timeoutUnlock = Timeout.create();\n acquire(referenceElement) {\n this.lockCount += 1;\n if (this.lockCount === 1 && this.restore === null) {\n this.timeoutLock.start(0, () => this.lock(referenceElement));\n }\n return this.release;\n }\n release = () => {\n this.lockCount -= 1;\n if (this.lockCount === 0 && this.restore) {\n this.timeoutUnlock.start(0, this.unlock);\n }\n };\n unlock = () => {\n if (this.lockCount === 0 && this.restore) {\n this.restore?.();\n this.restore = null;\n }\n };\n lock(referenceElement) {\n if (this.lockCount === 0 || this.restore !== null) {\n return;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n\n // The page is already locked, either by the site author or by a non-Base UI overlay that\n // hasn't cleaned up yet. Leave it alone and wait for the lock to clear before taking over,\n // otherwise we'd snapshot the locked state and restore it after our own lock is released.\n if (isPageScrollLocked(win, html, body)) {\n const observer = new win.MutationObserver(() => {\n if (isPageScrollLocked(win, html, body)) {\n return;\n }\n observer.disconnect();\n this.restore = null;\n this.lock(referenceElement);\n });\n\n // Watch every attribute: locks are applied through inline styles, classes, or attributes\n // paired with a stylesheet (`data-scroll-locked` in react-remove-scroll, for example).\n const options = {\n attributes: true\n };\n observer.observe(html, options);\n observer.observe(body, options);\n this.restore = () => observer.disconnect();\n return;\n }\n const hasOverlayScrollbars = platform.os.ios || !hasInsetScrollbars(referenceElement);\n\n // On iOS, scroll locking does not work if the navbar is collapsed. Due to numerous\n // side effects and bugs that arise on iOS, it must be researched extensively before\n // being enabled to ensure it doesn't cause the following issues:\n // - Textboxes must scroll into view when focused, nor cause a glitchy scroll animation.\n // - The navbar must not force itself into view and cause layout shift.\n // - Scroll containers must not flicker upon closing a popup when it has an exit animation.\n this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);\n }\n}\nconst SCROLL_LOCKER = new ScrollLocker();\n\n/**\n * Locks the scroll of the document when enabled.\n *\n * @param enabled - Whether to enable the scroll lock.\n * @param referenceElement - Element to use as a reference for lock calculations.\n */\nexport function useScrollLock(enabled = true, referenceElement = null) {\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n return SCROLL_LOCKER.acquire(referenceElement);\n }, [enabled, referenceElement]);\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\n\n// Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.\n// This hook re-enables scroll lock only when the popup is effectively full-width.\n// Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side\n// padding still locks scroll, since that leaves too little outside space for a reliable swipe.\nconst VIEWPORT_WIDTH_TOLERANCE_PX = 20;\n\n/**\n * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when\n * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively\n * viewport-sized.\n */\nexport function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {\n const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);\n useIsoLayoutEffect(() => {\n if (!enabled || !touchOpen || positionerElement == null) {\n setTouchOpenShouldLockScroll(false);\n return;\n }\n const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;\n const popupWidth = positionerElement.offsetWidth;\n setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);\n }, [enabled, touchOpen, positionerElement]);\n useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);\n}","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { FloatingNode, useFloatingNodeId } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { PopoverPositionerContext } from \"./PopoverPositionerContext.mjs\";\nimport { useAnchorPositioning } from \"../../internals/useAnchorPositioning.mjs\";\nimport { usePopoverPortalContext } from \"../portal/PopoverPortalContext.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { POPUP_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { useAnimationsFinished } from \"../../internals/useAnimationsFinished.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { useAnchoredPopupScrollLock } from \"../../utils/useAnchoredPopupScrollLock.mjs\";\n\n/**\n * Positions the popover against the trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const PopoverPositioner = /*#__PURE__*/React.forwardRef(function PopoverPositioner(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n anchor,\n // `useAnchorPositioning` applies the same defaults to the undefined values; the names\n // remain destructured to exclude the props from `elementProps`.\n positionMethod,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding,\n arrowPadding,\n sticky,\n disableAnchorTracking = false,\n collisionAvoidance = POPUP_COLLISION_AVOIDANCE,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const keepMounted = usePopoverPortalContext();\n const nodeId = useFloatingNodeId();\n const floatingRootContext = store.useState('floatingRootContext');\n const mounted = store.useState('mounted');\n const open = store.useState('open');\n const openReason = store.useState('openChangeReason');\n const triggerElement = store.useState('activeTriggerElement');\n const modal = store.useState('modal');\n const openMethod = store.useState('openMethod');\n const positionerElement = store.useState('positionerElement');\n const instantType = store.useState('instantType');\n const transitionStatus = store.useState('transitionStatus');\n const adaptiveOrigin = store.useState('adaptiveOrigin');\n const prevTriggerElementRef = React.useRef(null);\n const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);\n const positioning = useAnchorPositioning({\n anchor,\n floatingRootContext,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking,\n keepMounted,\n nodeId,\n collisionAvoidance,\n adaptiveOrigin\n });\n const domReference = floatingRootContext.useState('domReferenceElement');\n\n // When the current trigger element changes, enable transitions on the\n // positioner temporarily\n useIsoLayoutEffect(() => {\n const currentTriggerElement = domReference;\n const prevTriggerElement = prevTriggerElementRef.current;\n if (currentTriggerElement) {\n prevTriggerElementRef.current = currentTriggerElement;\n }\n if (prevTriggerElement && currentTriggerElement && currentTriggerElement !== prevTriggerElement) {\n store.set('instantType', undefined);\n const ac = new AbortController();\n runOnceAnimationsFinish(() => {\n store.set('instantType', 'trigger-change');\n }, ac.signal);\n return () => {\n ac.abort();\n };\n }\n return undefined;\n }, [domReference, runOnceAnimationsFinish, store]);\n const trueModalNonHover = modal === true && openReason !== REASONS.triggerHover;\n useAnchoredPopupScrollLock(open && trueModalNonHover, openMethod === 'touch', positionerElement, triggerElement);\n const setPositionerElement = store.useStateSetter('positionerElement');\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n instant: instantType\n };\n const element = usePositioner(componentProps, state, {\n styles: positioning.positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n return /*#__PURE__*/_jsxs(PopoverPositionerContext.Provider, {\n value: positioning,\n children: [mounted && trueModalNonHover && /*#__PURE__*/_jsx(InternalBackdrop, {\n inert: inertValue(!open),\n cutout: triggerElement\n }), /*#__PURE__*/_jsx(FloatingNode, {\n id: nodeId,\n children: element\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPositioner.displayName = \"PopoverPositioner\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ToolbarRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ToolbarRootContext.displayName = \"ToolbarRootContext\";\nexport function useToolbarRootContext(optional) {\n const context = React.useContext(ToolbarRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : _formatErrorMessage(69));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport const ClosePartContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ClosePartContext.displayName = \"ClosePartContext\";\nexport function useClosePartCount() {\n const [closePartCount, setClosePartCount] = React.useState(0);\n const register = useStableCallback(() => {\n setClosePartCount(count => count + 1);\n return () => {\n setClosePartCount(count => Math.max(0, count - 1));\n };\n });\n const context = React.useMemo(() => ({\n register\n }), [register]);\n return {\n context,\n hasClosePart: closePartCount > 0\n };\n}\nexport function useClosePartRegistration() {\n const context = React.useContext(ClosePartContext);\n useIsoLayoutEffect(() => {\n return context?.register();\n }, [context]);\n}","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { FloatingFocusManager, useHoverFloatingInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { usePopoverRootContext } from \"../root/PopoverRootContext.mjs\";\nimport { usePopoverPositionerContext } from \"../positioner/PopoverPositionerContext.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { COMPOSITE_KEYS } from \"../../internals/composite/composite.mjs\";\nimport { useToolbarRootContext } from \"../../toolbar/root/ToolbarRootContext.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\nimport { ClosePartContext, useClosePartCount } from \"../../utils/closePart.mjs\";\nimport { FOCUSABLE_POPUP_PROPS, createDefaultInitialFocus } from \"../../utils/popups/index.mjs\";\n\n/**\n * A container for the popover contents.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const PopoverPopup = /*#__PURE__*/React.forwardRef(function PopoverPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n initialFocus,\n finalFocus,\n ...elementProps\n } = componentProps;\n const store = usePopoverRootContext();\n const positioner = usePopoverPositionerContext();\n const insideToolbar = useToolbarRootContext(true) != null;\n const {\n context: closePartContext,\n hasClosePart\n } = useClosePartCount();\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const instantType = store.useState('instantType');\n const transitionStatus = store.useState('transitionStatus');\n const popupProps = store.useState('popupProps');\n const titleId = store.useState('titleElementId');\n const descriptionId = store.useState('descriptionElementId');\n const modal = store.useState('modal');\n const mounted = store.useState('mounted');\n const openReason = store.useState('openChangeReason');\n const activeTriggerElement = store.useState('activeTriggerElement');\n const floatingContext = store.useState('floatingRootContext');\n const floatingId = floatingContext.useState('floatingId');\n const disabled = store.useState('disabled');\n const openOnHover = store.useState('openOnHover');\n const closeDelay = store.useState('closeDelay');\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete?.(true);\n }\n }\n });\n useHoverFloatingInteraction(floatingContext, {\n enabled: openOnHover && !disabled,\n closeDelay\n });\n const resolvedInitialFocus = initialFocus === undefined ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;\n const focusManagerModal = modal !== false && hasClosePart;\n store.useSyncedValue('focusManagerModal', focusManagerModal);\n const setPopupElement = store.useStateSetter('popupElement');\n const state = {\n open,\n side: positioner.side,\n align: positioner.align,\n instant: instantType,\n transitionStatus\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, store.context.popupRef, setPopupElement],\n props: [popupProps, {\n id: floatingId,\n role: 'dialog',\n ...FOCUSABLE_POPUP_PROPS,\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n onKeyDown(event) {\n if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {\n event.stopPropagation();\n }\n }\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping: popupTransitionStateMapping\n });\n return /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingContext,\n openInteractionType: openMethod,\n modal: focusManagerModal,\n disabled: !mounted || openReason === REASONS.triggerHover,\n initialFocus: resolvedInitialFocus,\n returnFocus: finalFocus,\n restoreFocus: \"popup\",\n previousFocusableElement: isHTMLElement(activeTriggerElement) ? activeTriggerElement : undefined,\n nextFocusableElement: store.context.triggerFocusTargetRef,\n beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,\n children: /*#__PURE__*/_jsx(ClosePartContext.Provider, {\n value: closePartContext,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") PopoverPopup.displayName = \"PopoverPopup\";","/**\n * Browser half: a toolbar button in the composer trailing row, and the panel\n * it opens. The trigger keeps ContextMeter's chrome (28×28 ghost button,\n * pill radius, hover wash, 14px layers glyph, Tooltip 200ms); the panel\n * itself is a Base UI Popover with enter/exit animation and proper focus\n * management, anchored `side=top align=end` to the trigger.\n *\n * Component strategy: interactive behavior comes from @base-ui/react —\n * Switch for toggles, Collapsible for disclosures,\n * Tabs for the three capability sections, Popover for the shell, Input for\n * the always-visible filter. We write only token skins. Base UI is bundled per-plugin (Plan A):\n * it is a devDependency because tsdown auto-externalizes `dependencies`, and\n * the browser has no node_modules to resolve a leaked require.\n *\n * Information architecture: three sections become tabs (a 320px-wide stacked\n * list forced scrolling past whole sections to reach the next). While the\n * filter query is active the tabs collapse into one flat, fully-expanded\n * result list — a match can come from a description, so hidden detail would\n * make \"why did this row match\" unanswerable.\n *\n * Colors/typography come from the host's `--dsw-*` design tokens with hex\n * fallbacks so the panel never renders unstyled while a token is absent;\n * chips tint via color-mix on the same tokens, so dark mode stays free.\n */\nimport type { McpServerEntry, SkillEntry, SkillLoadState, ToolEntry } from '../contract.js';\nimport { subscribe, getSnapshot, toggle, close, refresh, reportActionError, reset, setCapability } from './store.js';\nimport { filterPayload } from './filter.js';\nimport { MCP_TOOL_ROOT_CLASS, ROW_HEADER_CLASS, ROW_ROOT_CLASS, resolveDisclosure } from './disclosure.js';\nimport { LOCALE_NS, registerLocale } from './locale.js';\nimport type { LocaleService } from './locale.js';\nimport { PANEL_CSS, TOK } from './styles.js';\nimport { capabilitySwitch } from './switch.js';\nimport { PresetToolSection } from './preset-section.js';\nimport { resetPresetTools } from './preset-store.js';\n\nconst ROUTE = '/api/capability-panel';\n\n/** The plugin's issue tracker, surfaced as the panel foot's feedback link. */\nconst FEEDBACK_URL = 'https://github.com/pure-craft/dsh-capability-panel/issues';\n\n// React comes through the module loader's `require`, which resolves the HOST's\n// copy — the runtime calls `apply(ctx, config)`, never `apply(ctx, react)`.\n// tsdown keeps this import external so no second React instance is bundled.\nimport * as React from 'react';\n// Same story for primitives: the module system resolves it to the host graph's\n// row (every shipped UI bundle requires it the same way), keeping Tooltip's\n// theme and i18n context singular. tsdown must NOT bundle it.\nimport {\n IconChevronRightOutline14,\n IconContextInjectionOutline16,\n IconFolderClose16,\n IconSendOutline14,\n IconSearchOutline16,\n IconRefreshOutline14,\n Tooltip,\n} from '@deepseek-ai/dsh-client-ui-primitives';\n// Base UI's `react`/`react/jsx-runtime` imports stay external and resolve to\n// the host instance, exactly like our own (verified against shipped bundles).\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { Input } from '@base-ui/react/input';\nimport { Popover } from '@base-ui/react/popover';\nimport { Tabs } from '@base-ui/react/tabs';\n\ninterface SlotContext {\n readonly slots: {\n inject(name: string, callback: () => (() => void) | void): void;\n register(spec: Record<string, unknown>, component: unknown): () => void;\n };\n /** Cordis lifecycle/event verb, on the dynamic facade's whitelist. */\n on(event: 'connection/reset', listener: () => void): void;\n effect(factory: () => (() => void) | void, label?: string): void;\n /**\n * The host's locale runtime (dsh-client-locale), a hard inject like every\n * shipped UI bundle: dictionaries register into it, and its revision\n * observable re-renders the panel on a language switch.\n */\n readonly locale: LocaleService;\n}\n\ninterface DockProps {\n readonly sessionId?: string;\n /** InputZone owner prop: the live input snapshot (we only read the draft). */\n readonly input?: { readonly draft?: string };\n /**\n * Standard prop published by ui-conversation's input kit: a selector hook\n * over the live input state. Reading `draft` through it subscribes this\n * component — cheap here because the composer cannot be focused while the\n * popover is open, so the draft is still when the read matters.\n */\n readonly useInput?: <T>(selector: (state: { readonly draft: string }) => T) => T;\n /**\n * Standard prop published by ui-conversation's input kit. The panel only\n * fills the draft — submitting stays with the user (Enter / send button).\n */\n readonly inputActions?: {\n setDraft(text: string): void;\n };\n}\n\n/** The host's React, typed loosely because its identity must stay the host's. */\ntype ReactLike = {\n createElement(this: void, type: unknown, props?: unknown, ...children: unknown[]): unknown;\n useState<T>(initial: T): [T, (next: T | ((prev: T) => T)) => void];\n useRef<T>(initial: T): { current: T };\n useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, get: () => T): T;\n useEffect(effect: () => void | (() => void), deps?: readonly unknown[]): void;\n};\n\n/**\n * Order by how much the reader needs to act on it: what fell out of context\n * first, then what is in it, then the rest.\n */\nconst STATE_ORDER: Record<SkillLoadState, number> = { evicted: 0, pruned: 1, loaded: 2, unloaded: 3 };\n\nfunction sortSkills(skills: readonly SkillEntry[]): SkillEntry[] {\n return [...skills].sort(\n (a, b) => STATE_ORDER[a.state] - STATE_ORDER[b.state] || a.name.localeCompare(b.name),\n );\n}\n\nexport function apply(ctx: SlotContext): void {\n const react = React as unknown as ReactLike;\n const h = react.createElement;\n\n // Panel copy follows the host's language switch: dictionaries register into\n // the shared locale runtime, and `t` reads the active locale per call.\n ctx.effect(() => registerLocale(ctx.locale), 'capability-panel: dictionaries');\n const t = ctx.locale.bind(LOCALE_NS);\n // uSES channel over the locale revision: a language switch re-renders the\n // panel even though `t` itself is a stable reference.\n const subscribeLocale = (fn: () => void): (() => void) => ctx.locale.subscribe(fn);\n const getLocaleSnapshot = (): { readonly active: string; readonly revision: number } => ctx.locale.getSnapshot();\n\n // A host restart drops every fact the panel shows; ui-skill clears its\n // caches on the same event. The store's reset also invalidates in-flight\n // answers from the dead connection.\n ctx.on('connection/reset', () => {\n reset();\n resetPresetTools();\n });\n\n // Pseudo-class states can't be expressed inline: one small stylesheet for\n // hover, focus-visible, enter/exit animation, the tabs skin, collapsible\n // height animation, and row-level content-visibility. Colors stay on the\n // same --dsw-* tokens the inline styles use. Lifecycle follows the\n // workspace rule: ctx.effect + data-plugin tag, so HMR/unload removes it\n // and a fresh apply can update the content.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {};\n const style = document.createElement('style');\n style.dataset.plugin = 'dsh-capability-panel';\n style.textContent = PANEL_CSS;\n document.head.appendChild(style);\n return () => { style.remove(); };\n }, 'capability-panel: stylesheet');\n\n /** Host iconography: the panel inspects what lands in the session's context. */\n const layersIcon = (size: number) => h(IconContextInjectionOutline16, { size });\n\n /** Magnifier sitting inside the filter input. */\n const searchIcon = (size: number) => h(IconSearchOutline16, { size });\n\n /** Paper plane: the row action lands the command in the composer,\n * ready for the user's own Enter. */\n const insertIcon = (size: number) => h(IconSendOutline14, { size });\n\n /** Circular arrows: pull a declared-but-offline server's connection up now. */\n const reconnectIcon = (size: number) => h(IconRefreshOutline14, { size });\n\n /** The GitHub mark. Not in the host icon set (brand logos are not shipped\n * there), so this one path is inlined for the feedback link's recognizability. */\n const githubIcon = (size: number) => h(\n 'svg',\n { width: size, height: size, viewBox: '0 0 1024 1024', fill: 'currentColor', 'aria-hidden': true },\n h('path', { d: 'M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9 23.5 23.2 38.1 55.4 38.1 91v112.5c0.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z' }),\n );\n\n ctx.slots.inject('settings.section', () =>\n ctx.slots.register(\n { name: 'settings.section', id: 'capability-panel', order: 25, label: () => t('preset.nav') },\n () => h(PresetToolSection, { t, subscribeLocale, getLocaleSnapshot }),\n ),\n );\n\n ctx.slots.inject('conversation.input.right', () =>\n ctx.slots.register({ name: 'conversation.input.right', id: 'capability-panel', order: 1000 }, (props: DockProps) => {\n const snap = react.useSyncExternalStore(subscribe, getSnapshot);\n // Subscribed for the re-render, not the value: `t` reads the active\n // locale at call time, so a revision bump is all the panel needs.\n react.useSyncExternalStore(subscribeLocale, getLocaleSnapshot);\n // Per-row detail expansion, keyed so a reordered list keeps each row's\n // state. While a filter query is active every visible row is forced\n // open so the text it matched on shows without a second click.\n const [expanded, setExpanded] = react.useState<Record<string, boolean>>({});\n const [query, setQuery] = react.useState('');\n const [tab, setTab] = react.useState('skills');\n // Which server is mid-reconnect: its button spins and disables until the\n // request settles, so a click reads as \"starting\" not \"nothing happened\".\n const [reconnecting, setReconnecting] = react.useState<string | null>(null);\n const sessionId = props.sessionId ?? null;\n\n // Refetch when the panel opens rather than polling: the answer is only\n // interesting while someone is looking at it.\n react.useEffect(() => {\n if (snap.open) void refresh(sessionId);\n }, [snap.open, sessionId]);\n\n // The store owns the open flag (it outlives this component); the\n // Popover is controlled by it and reports its own dismissal intents\n // (outside press, Escape) back through this sync.\n const syncOpen = (open: boolean) => {\n const current = getSnapshot().open;\n if (open && !current) toggle();\n else if (!open && current) close();\n };\n\n // One canonical query drives matching, clear affordance, Escape, and the\n // filtered layout. The old split (`trim()` here, raw query elsewhere)\n // made a spaces-only value look simultaneously filtered and unfiltered.\n const normalizedQuery = query.trim();\n const filtering = normalizedQuery !== '';\n const payload = snap.payload;\n const skillSourceLabel = (skill: SkillEntry): string => {\n const key = `source.${skill.source}`;\n const translated = t(key);\n return translated === key ? skill.source : translated;\n };\n const openSourceFolder = (source: string) => {\n if (sessionId === null) return;\n void fetch(`${ROUTE}/open-folder`, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ sessionId, source }),\n }).then(async (response) => {\n if (!response.ok) {\n const detail = await response.text();\n console.warn(`[capability-panel] cannot open source folder (${response.status}): ${detail}`);\n }\n }).catch((error: unknown) => {\n console.warn('[capability-panel] open source folder request failed', error);\n });\n };\n /**\n * Pull a declared-but-offline server's connection up, then refresh:\n * registration lands asynchronously, and the registry's tools/change\n * broadcast is what re-applies this session's stored positions.\n */\n const reconnectServer = (server: string) => {\n if (reconnecting !== null) return;\n setReconnecting(server);\n void fetch(`${ROUTE}/reconnect`, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ server }),\n }).then(async (response) => {\n if (!response.ok) {\n const detail = await response.text();\n console.warn(`[capability-panel] reconnect failed (${response.status}): ${detail}`);\n reportActionError(t('action.reload.failed', { name: server, error: `HTTP ${response.status}` }));\n }\n await refresh(sessionId);\n }).catch((error: unknown) => {\n console.warn('[capability-panel] reconnect request failed', error);\n reportActionError(t('action.reload.failed', { name: server, error: error instanceof Error ? error.message : String(error) }));\n }).finally(() => {\n // The restart only kicks the connection attempt; the tools land a\n // few seconds later via the client's own retry. Hold the spinner\n // through a short beat so the state visibly settles rather than\n // snapping back to \"not connected\" before registration arrives.\n setTimeout(() => { setReconnecting(null); }, 2500);\n });\n };\n /**\n * Middle ellipsis for long path labels: both ends carry the meaning\n * (`~/…` context, the tail directory), the middle is the expendable\n * part. The full path stays in the hover tooltip.\n */\n const ellipsizeMiddle = (text: string, max = 42): string => {\n if (text.length <= max) return text;\n const head = Math.ceil((max - 1) / 2);\n const tail = Math.floor((max - 1) / 2);\n return `${text.slice(0, head)}…${text.slice(text.length - tail)}`;\n };\n /**\n * Section header for a source group, rendered as a labeled rule:\n * `── 📁 ~/.agents/skills (4) ────────────`. Label rule: preset-bundled\n * entries name their preset; every other group shows its real directory\n * (host-abbreviated `~`/cwd-relative, middle-ellipsized when long), and\n * only groups without a filesystem location fall back to the translated\n * source name. `groupKey` is the grouping identity; `rawSource` is what\n * the open-folder route resolves by.\n */\n const sourceSectionHeader = (groupKey: string, rawSource: string, count: number, first: boolean, path?: string, openable = false) => {\n const label = groupKey.startsWith('preset:')\n ? groupKey.slice(7)\n : path !== undefined\n ? ellipsizeMiddle(path)\n : groupKey === 'host' ? t('source.host') : skillSourceLabel({ source: groupKey } as SkillEntry);\n const rule = (grow: boolean) => h('span', {\n style: grow\n ? { flex: '1', height: '1px', background: TOK.borderStrong }\n : { flex: 'none', width: '16px', height: '1px', background: TOK.borderStrong },\n });\n return h(\n 'div',\n {\n key: `source:${groupKey}`,\n className: 'ci-source-header',\n style: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n margin: first ? '0 0 2px' : '10px 0 2px',\n },\n },\n rule(false),\n h(\n 'span',\n {\n style: {\n flex: 'none',\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n cursor: openable ? 'pointer' : 'default',\n },\n title: openable ? t('source.openFolder', { source: path ?? label }) : undefined,\n onClick: openable ? () => { openSourceFolder(rawSource); } : undefined,\n },\n openable\n ? h(\n 'span',\n {\n className: 'ci-folder-icon',\n style: {\n display: 'inline-grid',\n placeItems: 'center',\n opacity: 0,\n transition: 'opacity 0.15s',\n },\n },\n // The host's own folder glyph — the same set every shipped\n // surface draws from, so it follows theme and density for free.\n h(IconFolderClose16, { size: 12 }),\n )\n : null,\n `${label} (${count})`,\n ),\n rule(true),\n );\n };\n /** Group items by source, preserving order within each group. */\n const groupBySource = <T>(items: readonly T[], getSource: (item: T) => string): [string, T[]][] => {\n const groups = new Map<string, T[]>();\n const order: string[] = [];\n for (const item of items) {\n const source = getSource(item);\n const bucket = groups.get(source);\n if (bucket) bucket.push(item);\n else { groups.set(source, [item]); order.push(source); }\n }\n return order.map((source) => [source, groups.get(source)!]);\n };\n const view = payload === null ? null : filterPayload(payload, normalizedQuery, (skill) => t(`state.${skill.state}`), skillSourceLabel);\n const skills = view === null ? [] : sortSkills(view.skills);\n const mcp = view?.mcp ?? [];\n const systemTools = view?.systemTools ?? [];\n const blocked = payload?.blocked ?? {};\n const totals = {\n skills: payload?.skills.length ?? 0,\n mcp: payload?.mcp.length ?? 0,\n systemTools: payload?.systemTools.length ?? 0,\n };\n const totalAll = totals.skills + totals.mcp + totals.systemTools;\n\n const setOpen = (key: string, open: boolean) => {\n setExpanded((prev) => ({ ...prev, [key]: open }));\n };\n\n /**\n * Stable pill geometry for every skill state: green means loaded, blue\n * means pruned (head/tail still visible), neutral means unloaded, amber\n * means evicted, and the independent red pill records blocked attempts\n * after a capability was disabled.\n */\n const chip = (text: string, color: string) =>\n h(\n 'span',\n {\n style: {\n flex: '0 0 auto',\n fontSize: '11px',\n lineHeight: '16px',\n padding: '1px 7px',\n borderRadius: '999px',\n color,\n background: `color-mix(in srgb, ${color} 14%, transparent)`,\n fontVariantNumeric: 'tabular-nums',\n whiteSpace: 'nowrap',\n },\n },\n text,\n );\n\n // A blocked attempt is the strongest signal a toggle gives: the agent\n // still reached for the capability after the user turned it off.\n const blockedChip = (count: number) => (count > 0 ? chip(t('blocked.count', { count }), TOK.error) : null);\n\n const metaText = (text: string) =>\n h(\n 'span',\n {\n style: {\n flex: '0 0 auto',\n fontSize: '11px',\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n whiteSpace: 'nowrap',\n },\n },\n text,\n );\n\n // Skill state always occupies the same pill-shaped visual slot. Color,\n // not geometry, communicates meaning: loaded is green, pruned is the\n // informational blue of a partially visible result, unloaded stays\n // neutral, and evicted is amber because it may need attention.\n const stateMeta = (skill: SkillEntry) => {\n const text = t(`state.${skill.state}`) + (skill.loadCount > 1 ? ` ×${skill.loadCount}` : '');\n const color =\n skill.state === 'loaded'\n ? TOK.success\n : skill.state === 'pruned'\n ? TOK.info\n : skill.state === 'evicted'\n ? TOK.warn\n : TOK.textTertiary;\n return chip(text, color);\n };\n\n // Base UI Switch renders the button with role/aria-checked wired; we\n // keep the track sizing and token colors.\n const switchControl = (kind: 'skill' | 'mcp-server' | 'mcp-tool' | 'system-tool', name: string, enabled: boolean) =>\n capabilitySwitch({\n checked: enabled,\n disabled: sessionId === null,\n busy: snap.loading,\n label: t(enabled ? 'action.disable' : 'action.enable', { name }),\n onCheckedChange: (checked) => {\n if (sessionId !== null) void setCapability(sessionId, kind, name, checked);\n },\n });\n\n /** Right chevron the disclosure CSS rotates 90° when expanded. */\n const chevronIcon = h(IconChevronRightOutline14, { size: 12 });\n\n const groupLabel = (text: string, first: boolean) =>\n h(\n 'div',\n {\n key: `group:${text}`,\n style: {\n fontWeight: 500,\n color: TOK.textTertiary,\n fontVariantNumeric: 'tabular-nums',\n margin: first ? '0 0 2px' : '12px 0 2px',\n },\n },\n text,\n );\n\n const nameText = (text: string, sourceLabel?: string) =>\n h(\n 'span',\n {\n className: 'ci-name',\n style: {\n flex: '1 1 auto',\n wordBreak: 'break-all',\n color: TOK.textPrimary,\n fontWeight: 500,\n },\n },\n text,\n sourceLabel !== undefined\n ? h(\n 'span',\n {\n style: {\n color: TOK.textTertiary,\n fontWeight: 400,\n fontSize: '11px',\n marginLeft: '2px',\n },\n },\n `· ${sourceLabel}`,\n )\n : null,\n );\n\n /** The trigger's accessible name, localized with its subject. */\n const disclosureAria = (\n subject: string,\n detailKey: 'detail.description' | 'detail.tools',\n disclosure: { open: boolean; disabled: boolean },\n ) => {\n const detail = t(detailKey);\n if (disclosure.disabled) return t('disclosure.pinned', { subject, detail });\n return disclosure.open\n ? t('disclosure.collapse', { subject, detail })\n : t('disclosure.expand', { subject, detail });\n };\n\n /**\n * Shared disclosure row for Skills, MCP tools, and System tools. The\n * trigger owns only chevron + label; trailing actions remain independent\n * buttons and never toggle the description.\n */\n const disclosureRow = (\n key: string,\n enabled: boolean,\n label: string,\n description: string | undefined,\n actions: readonly unknown[],\n className = ROW_ROOT_CLASS,\n sourceLabel?: string,\n ) => {\n const hasDescription = description !== undefined && description !== '';\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n const ariaLabel = disclosureAria(label, 'detail.description', disclosure);\n if (!hasDescription) {\n return h(\n 'div',\n {\n key,\n className,\n style: { opacity: enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h('span', { style: { width: '18px', flex: 'none' } }),\n nameText(label, sourceLabel),\n ...actions,\n ),\n );\n }\n return h(\n Collapsible.Root,\n {\n key,\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setOpen(key, open); },\n className,\n style: { opacity: enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h(\n Collapsible.Trigger,\n {\n className: 'ci-disclosure-trigger',\n disabled: disclosure.disabled,\n 'aria-label': ariaLabel,\n },\n h('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n nameText(label, sourceLabel),\n ),\n ...actions,\n ),\n h(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n h('div', { className: 'ci-description' }, description),\n ),\n );\n };\n\n /**\n * Put a skill's slash command into the composer — never auto-submit:\n * whether to send is the user's call (Enter). A non-empty draft is\n * appended to, never replaced. Works for disabled skills too: the\n * disable shadow keeps userInvocable: true by design.\n *\n * The draft comes from the live input-state selector: the old\n * `props.input` snapshot is gone in newer hosts, and reading a stale\n * snapshot would REPLACE the user's draft instead of appending.\n */\n const composerDraft = props.useInput === undefined ? (props.input?.draft ?? '') : props.useInput((state) => state.draft);\n const insertCommand = (name: string) => {\n const actions = props.inputActions;\n if (actions === undefined) return;\n const draft = composerDraft;\n actions.setDraft(draft.trim() === '' ? `/${name} ` : `${draft} /${name} `);\n close();\n };\n\n const insertButton = (name: string) =>\n h(\n 'button',\n {\n type: 'button',\n className: 'ci-iconbtn ci-send',\n 'aria-label': t('action.insert', { name }),\n disabled: props.inputActions === undefined,\n onClick: () => { insertCommand(name); },\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '20px',\n height: '20px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: props.inputActions === undefined ? 'not-allowed' : 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n insertIcon(12),\n );\n\n const skillRow = (skill: SkillEntry) =>\n disclosureRow(`skill:${skill.name}`, skill.enabled, skill.name, skill.description, [\n stateMeta(skill),\n insertButton(skill.name),\n blockedChip(blocked[skill.name] ?? 0),\n switchControl('skill', skill.name, skill.enabled),\n ], ROW_ROOT_CLASS);\n\n const mcpToolRow = (tool: McpServerEntry['tools'][number], serverEnabled: boolean) =>\n disclosureRow(`mcp-tool:${tool.name}`, tool.enabled, tool.label, tool.description, [\n blockedChip(blocked[tool.name] ?? 0),\n serverEnabled ? switchControl('mcp-tool', tool.name, tool.enabled) : null,\n ], MCP_TOOL_ROOT_CLASS);\n\n const serverRow = (server: McpServerEntry) => {\n const serverBlocked = server.tools.reduce((sum, tool) => sum + (blocked[tool.name] ?? 0), 0);\n const key = `mcp:${server.server}`;\n const disclosure = resolveDisclosure(expanded[key] === true, filtering);\n const ariaLabel = disclosureAria(server.server, 'detail.tools', disclosure);\n // The server root owns state and the panel; only its header owns hover\n // feedback, so nested tool hover never paints the whole server.\n return h(\n Collapsible.Root,\n {\n key,\n open: disclosure.open,\n onOpenChange: (open: boolean) => { setOpen(key, open); },\n style: { opacity: server.enabled ? 1 : 0.55 },\n },\n h(\n 'div',\n { className: ROW_HEADER_CLASS },\n h(\n Collapsible.Trigger,\n {\n className: 'ci-server-trigger',\n disabled: disclosure.disabled,\n 'aria-label': ariaLabel,\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '18px',\n height: '18px',\n padding: 0,\n border: 'none',\n borderRadius: '4px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: disclosure.disabled ? 'default' : 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n h('span', { className: 'ci-chevron', 'aria-hidden': true }, chevronIcon),\n ),\n nameText(server.server),\n server.unavailable === true\n ? // Nothing is registered, so a tool count would be a lie: the\n // listed rows are this session's stored positions, not a\n // roster. Report the state and offer the one action that can\n // still change it.\n h(\n 'span',\n {\n className: 'ci-preset-badge',\n title: t('server.unavailableHint'),\n style: { flex: 'none' },\n },\n t('server.unavailable'),\n )\n : metaText(server.tools.length === 1 ? t('server.tool.one') : t('server.tools', { count: server.tools.length })),\n blockedChip(serverBlocked),\n server.unavailable === true && server.reconnectable === true\n ? h(\n 'button',\n {\n type: 'button',\n // A persistent, bordered state control — not a hover-only\n // icon — so the row always offers its one honest action.\n className: `ci-reconnect${reconnecting === server.server ? ' ci-reconnect-busy' : ''}`,\n disabled: reconnecting !== null,\n 'aria-label': t('action.reload', { name: server.server }),\n title: reconnecting === server.server\n ? t('action.reload.ing', { name: server.server })\n : `${t('action.reload', { name: server.server })}\\n${t('action.reloadHint')}`,\n onClick: () => { reconnectServer(server.server); },\n },\n h('span', { className: 'ci-reconnect-glyph', 'aria-hidden': true }, reconnectIcon(12)),\n t('action.reload.label'),\n )\n : null,\n server.unavailable === true ? null : switchControl('mcp-server', server.server, server.enabled),\n ),\n h(\n Collapsible.Panel,\n { className: 'ci-collapse' },\n h(\n 'div',\n {\n style: {\n marginTop: '2px',\n marginLeft: '4px',\n paddingLeft: '8px',\n borderLeft: `2px solid ${TOK.border}`,\n },\n },\n // One tool per row; each description is a second-level disclosure\n // using the same hover/chevron language as Skills and System tools.\n ...server.tools.map((tool) => mcpToolRow(tool, server.enabled)),\n ),\n ),\n );\n };\n\n const systemRow = (tool: ToolEntry) =>\n disclosureRow(`sys:${tool.name}`, tool.enabled, tool.label, tool.description, [\n blockedChip(blocked[tool.name] ?? 0),\n // run_code is the reserved Code Mode transport: the registry\n // refuses to restrict it, so no switch.\n tool.reserved === true ? null : switchControl('system-tool', tool.name, tool.enabled),\n ]);\n\n const emptyNote = (text: string) =>\n h('div', { key: `empty:${text}`, style: { color: TOK.textTertiary, padding: '8px 2px' } }, text);\n\n\n const notices = [\n snap.loading && payload === null\n ? h('div', { key: 'loading', 'aria-live': 'polite', style: { color: TOK.textTertiary, padding: '4px 0' } }, t('status.loading'))\n : null,\n // A transport failure must not be mistaken for an empty catalog.\n snap.error !== null\n ? h(\n 'div',\n { key: 'error', 'aria-live': 'polite', style: { color: TOK.error, padding: '4px 0' } },\n t('status.error', { error: snap.error }),\n )\n : null,\n // Partial reads are reported, so a short list is never silently wrong.\n // The host note itself stays English (diagnostic payload, keyed by the\n // raw note); the visible label around it is localized.\n payload?.degraded !== undefined\n ? h(\n 'div',\n { key: 'degraded', style: { color: TOK.warn, padding: '2px 0' } },\n ...payload.degraded.map((note) => h('div', { key: note }, t('degraded.item', { note }))),\n )\n : null,\n ];\n\n // Filtered: one flat, fully expanded result list. Otherwise: tabs.\n const body = filtering\n ? [\n view !== null && view.total === 0 ? emptyNote(t('empty.match')) : null,\n skills.length > 0 ? groupLabel(t('group.skills', { shown: skills.length, total: totals.skills }), true) : null,\n ...skills.map(skillRow),\n mcp.length > 0 ? groupLabel(t('group.mcp', { shown: mcp.length, total: totals.mcp }), skills.length === 0) : null,\n ...mcp.map(serverRow),\n systemTools.length > 0\n ? groupLabel(t('group.system', { shown: systemTools.length, total: totals.systemTools }), skills.length === 0 && mcp.length === 0)\n : null,\n ...systemTools.map(systemRow),\n ]\n : [\n h(\n Tabs.Root,\n {\n key: 'tabs',\n value: tab,\n onValueChange: (value: string) => { setTab(value); },\n style: { marginTop: '2px' },\n },\n h(\n Tabs.List,\n { 'aria-label': t('tabs.aria'), className: 'ci-tabs', style: { marginBottom: '6px' } },\n h(Tabs.Tab, { value: 'skills', className: 'ci-tab' }, `${t('tab.skills')} ${totals.skills}`),\n h(Tabs.Tab, { value: 'mcp', className: 'ci-tab' }, `${t('tab.mcp')} ${totals.mcp}`),\n h(Tabs.Tab, { value: 'system', className: 'ci-tab', 'aria-label': t('tab.system.aria', { count: totals.systemTools }) }, `${t('tab.system')} ${totals.systemTools}`),\n ),\n h(\n Tabs.Panel,\n { value: 'skills' },\n skills.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.skills'))\n : h('div', {}, ...groupBySource(skills, (s) => s.group ?? s.source).flatMap(([groupKey, items], i) => [\n sourceSectionHeader(groupKey, items[0]!.source, items.length, i === 0, items.find((item) => item.path !== undefined)?.path, items.some((item) => item.path !== undefined)),\n ...items.map(skillRow),\n ])),\n ),\n h(\n Tabs.Panel,\n { value: 'mcp' },\n mcp.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.mcp'))\n : h('div', {}, ...groupBySource(mcp, (s) => s.source === undefined || s.source === 'host' ? 'host' : `preset:${s.source}`).flatMap(([groupKey, items], i) => [\n sourceSectionHeader(groupKey, items[0]!.source ?? 'host', items.length, i === 0, items.find((item) => item.path !== undefined)?.path, true),\n ...items.map(serverRow),\n ])),\n ),\n h(\n Tabs.Panel,\n { value: 'system' },\n systemTools.length === 0 && payload !== null && !snap.loading\n ? emptyNote(t('empty.system'))\n : h('div', {}, ...systemTools.map(systemRow)),\n ),\n ),\n ];\n\n return h(\n Popover.Root,\n { open: snap.open, onOpenChange: syncOpen },\n // The ContextMeter trigger's chrome, verbatim: 28×28, pill radius,\n // secondary label color, hover-only wash.\n h(\n Tooltip,\n { label: t('trigger.tooltip'), side: 'top', delayMs: 200, disabled: snap.open },\n h(\n Popover.Trigger,\n {\n className: 'ci-trigger',\n 'aria-label': t('trigger.tooltip'),\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '28px',\n height: '28px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textSecondary,\n cursor: 'pointer',\n flex: 'none',\n font: 'inherit',\n },\n },\n layersIcon(14),\n ),\n ),\n h(\n Popover.Portal,\n {},\n h(\n Popover.Positioner,\n { side: 'top', align: 'end', sideOffset: 8, collisionPadding: 8, style: { zIndex: 100 } },\n h(\n Popover.Popup,\n {\n className: 'ci-panel',\n 'aria-label': t('panel.aria'),\n style: {\n boxSizing: 'border-box',\n width: '480px',\n maxHeight: 'min(60vh, var(--available-height, 60vh))',\n overflowY: 'auto',\n padding: '10px 12px',\n background: TOK.menuBg,\n color: TOK.textSecondary,\n border: `1px solid ${TOK.menuBorder}`,\n borderRadius: '12px',\n boxShadow: TOK.menuShadow,\n fontFamily: TOK.fontFamily,\n fontSize: '12px',\n lineHeight: '20px',\n cursor: 'default',\n },\n },\n\n // Header: the filter is always one keystroke away — opening the\n // panel lands focus in this input (first focusable in the popup),\n // so no toggle stands between the user and narrowing the list.\n h(\n 'div',\n { style: { marginBottom: '6px' } },\n h(\n 'div',\n { style: { display: 'flex', alignItems: 'center', gap: '6px' } },\n h(\n 'div',\n { style: { position: 'relative', flex: '1 1 auto', display: 'flex', alignItems: 'center' } },\n h(\n 'span',\n {\n style: {\n position: 'absolute',\n left: '8px',\n color: TOK.textTertiary,\n display: 'grid',\n pointerEvents: 'none',\n },\n },\n searchIcon(12),\n ),\n h(Input, {\n className: 'ci-filter',\n value: query,\n placeholder: t('filter.placeholder'),\n 'aria-label': t('filter.aria'),\n // Not a credential field: keep password managers and the\n // spellchecker out of it.\n autoComplete: 'off',\n spellCheck: false,\n name: 'ci-filter',\n onChange: (event: { target: { value: string } }) => { setQuery(event.target.value); },\n onKeyDown: (event: { key: string; stopPropagation: () => void }) => {\n // With a query, Escape clears it and the panel stays\n // open; empty, it bubbles up and closes the panel.\n if (event.key !== 'Escape' || !filtering) return;\n event.stopPropagation();\n setQuery('');\n },\n style: {\n flex: '1 1 auto',\n minWidth: 0,\n height: '26px',\n boxSizing: 'border-box',\n padding: '0 8px 0 26px',\n border: `1px solid ${TOK.border}`,\n borderRadius: '6px',\n background: TOK.bgBase,\n color: TOK.textPrimary,\n font: 'inherit',\n outline: 'none',\n },\n }),\n ),\n filtering\n ? h(\n 'button',\n {\n type: 'button',\n onClick: () => { setQuery(''); },\n className: 'ci-iconbtn',\n 'aria-label': t('filter.clear'),\n style: {\n display: 'grid',\n placeItems: 'center',\n width: '20px',\n height: '20px',\n padding: 0,\n border: 'none',\n borderRadius: '999px',\n background: 'transparent',\n color: TOK.textTertiary,\n cursor: 'pointer',\n flex: 'none',\n font: 'inherit',\n fontSize: '14px',\n lineHeight: 1,\n },\n },\n '×',\n )\n : null,\n ),\n filtering\n ? h(\n 'div',\n {\n 'aria-live': 'polite',\n style: { marginTop: '4px', color: TOK.textTertiary, fontVariantNumeric: 'tabular-nums' },\n },\n t('filter.count', { shown: view?.total ?? 0, total: totalAll }),\n )\n : null,\n ),\n\n ...notices,\n ...body,\n\n // A quiet feedback link at the panel foot: when the honest\n // \"no tools registered\" state or anything else confuses a user,\n // one click reaches the issue tracker. External, opens in a new\n // tab; rel guards the reverse-tabnabbing vector. The host's own\n // link glyph leads it (right-aligned so it never competes with\n // the list above); label is fully localized via locale keys.\n h(\n 'div',\n { style: { display: 'flex', justifyContent: 'flex-end', marginTop: '10px' } },\n h('a', {\n href: FEEDBACK_URL,\n target: '_blank',\n rel: 'noopener noreferrer',\n className: 'ci-feedback-link',\n title: t('footer.feedbackHint'),\n },\n h('span', { className: 'ci-feedback-icon', 'aria-hidden': true }, githubIcon(12)),\n t('footer.feedback'),\n ),\n ),\n ),\n ),\n ),\n );\n }),\n );\n}\n\nexport const inject = ['slots', 'locale'];\n"],"x_google_ignoreList":[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,cAAY,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;AAEtE,MAAM,aAAa,UAAwC,OAAO,UAAU,WAAW,QAAQ;AAE/F,SAAS,gBAAgB,OAAmC;AAC1D,KAAI,CAACA,WAAS,MAAM,IAAI,OAAO,MAAM,YAAY,SAAU,QAAO;CAClE,MAAM,QAAQ,MAAM;AACpB,KAAI,UAAU,YAAY,UAAU,YAAY,UAAU,aAAa,UAAU,WAAY,QAAO;AACpG,KAAI,OAAO,MAAM,eAAe,aAAa,OAAO,MAAM,iBAAiB,SAAU,QAAO;AAC5F,KAAI,OAAO,MAAM,cAAc,YAAY,OAAO,MAAM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B;CAChB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,uBAAuB;CACvB,mBAAmB;CACnB,mBAAmB;CACnB,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,iBAAiB;CACjB,sBAAsB;CACtB,yBAAyB;CACzB,kBAAkB;CAClB,mBAAmB;CACnB,sBAAsB;CACtB,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,iBAAiB;CACjB,qBAAqB;CACtB;;;;;;AAqBD,SAAgB,eAAe,QAAmC;CAChE,MAAM,YAAY,OAAO,SAAS,WAAW,MAAM,GAAG;CACtD,MAAM,YAAY,OAAO,SAAS,WAAW,MAAM,GAAG;AACtD,cAAa;AACX,aAAW;AACX,aAAW;;;;;;AC7Lf,MAAa,MAAM;CACjB,aAAa;CACb,eAAe;CACf,cAAc;CACd,QAAQ;CAER,cAAc;CACd,UAAU;CACV,WAAW;CACX,aAAa;CACb,YAAY;CACZ,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,YACE;CACF,SAAS;CACT,MAAM;CACN,OAAO;CAGP,MAAM;CACP;AAED,MAAa,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CAEA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACD,CAAC,KAAK,KAAK;;;;AChHZ,SAAgB,cAAc,EAC5B,YACA,SAAS,aACT,MACA,QAAQ,WACP;CAED,MAAM,EACJ,SAAS,iBACPC,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