{"version":3,"file":"pv-components-base.mjs","names":["clamp","computePosition","flip","offset","shift","clamp","getComputedStyle","unwrapElement","toValue","$props","$emit","$emit","$emit","$emit","$slots","$emit","$emit","$emit","$slots","$slots","$slots","$attrs","$emit","$emit","$emit","$emit","$attrs","$attrs","$slots","$slots","$attrs","$attrs","$emit","$emit","$emit","$emit","$emit","$slots","$emit","$emit"],"sources":["../../../src/components/base/PvSpinner/PvSpinner.vue","../../../src/components/base/PvSpinner/PvSpinner.vue","../../../src/components/base/PvButton/helpers.ts","../../../src/web-components/utils.ts","../../../src/components/base/baseProps.ts","../../../src/components/base/PvIcon/PvIcon.vue","../../../src/components/base/PvIcon/PvIcon.vue","../../../src/components/base/PvCounterBadge/PvCounterBadge.vue","../../../src/components/base/PvCounterBadge/PvCounterBadge.vue","../../../src/components/base/PvButton/PvButton.vue","../../../src/components/base/PvButton/PvButton.vue","../../../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../../../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../../../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../../../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../../../node_modules/.pnpm/vue-demi@0.14.10_vue@3.5.32_typescript@5.9.3_/node_modules/vue-demi/lib/index.mjs","../../../../node_modules/.pnpm/@floating-ui+vue@1.1.11_vue@3.5.32_typescript@5.9.3_/node_modules/@floating-ui/vue/dist/floating-ui.vue.mjs","../../../src/composables/useSlotPresence.ts","../../../src/components/base/PvPopoverV2/useHoverPopoverGroup.ts","../../../src/components/base/PvPopoverV2/PvPopoverV2.vue","../../../src/components/base/PvPopoverV2/PvPopoverV2.vue","../../../src/components/base/PvTooltipV2/PvTooltipV2.vue","../../../src/components/base/PvTooltipV2/PvTooltipV2.vue","../../../src/components/base/PvActionButton/PvActionButton.vue","../../../src/components/base/PvActionButton/PvActionButton.vue","../../../src/components/base/AskTqBuddy/useBuddyBrowserRuntime.ts","../../../src/components/base/AskTqBuddy/AskTqBuddy.vue","../../../src/components/base/AskTqBuddy/AskTqBuddy.vue","../../../src/components/base/PvAiButton/PvAiButton.vue","../../../src/components/base/PvAiButton/PvAiButton.vue","../../../src/components/base/PvTooltip/PvTooltip.vue","../../../src/components/base/PvTooltip/PvTooltip.vue","../../../src/components/base/PvButton/PvButtonWithTooltip.vue","../../../src/components/base/PvButton/PvButtonWithTooltip.vue","../../../src/components/base/PvSplitButton/PvSplitButton.vue","../../../src/components/base/PvSplitButton/PvSplitButton.vue","../../../src/components/base/PvReleaseBadge/PvReleaseBadge.vue","../../../src/components/base/PvReleaseBadge/PvReleaseBadge.vue","../../../src/components/base/PvTag/PvTag.vue","../../../src/components/base/PvTag/PvTag.vue","../../../src/components/base/PvPill/PvPill.vue","../../../src/components/base/PvPill/PvPill.vue","../../../src/components/base/PvPopover/PvPopover.vue","../../../src/components/base/PvPopover/PvPopover.vue","../../../src/components/base/PvDropdown/PvDropdown.vue","../../../src/components/base/PvDropdown/PvDropdown.vue","../../../src/components/base/PvAnimatedIcon/PvAnimatedIcon.vue","../../../src/components/base/PvAnimatedIcon/PvAnimatedIcon.vue","../../../src/components/base/PvPopoverMenu/PvPopoverMenu.vue","../../../src/components/base/PvPopoverMenu/PvPopoverMenu.vue","../../../src/components/base/PvSegmentedControl/PvSegmentedControl.vue","../../../src/components/base/PvSegmentedControl/PvSegmentedControl.vue","../../../src/components/base/PvTabList/PvTabList.vue","../../../src/components/base/PvTabList/PvTabList.vue","../../../src/components/base/PvCompanyLogo/PvCompanyLogo.vue","../../../src/components/base/PvCompanyLogo/PvCompanyLogo.vue","../../../src/components/base/PvModal/PvModal.vue","../../../src/components/base/PvModal/PvModal.vue","../../../src/components/base/PvBanner/types.ts","../../../src/components/base/PvBanner/PvBanner.vue","../../../src/components/base/PvBanner/PvBanner.vue","../../../src/components/base/PvEmptyErrorState/PvEmptyErrorState.vue","../../../src/components/base/PvEmptyErrorState/PvEmptyErrorState.vue","../../../src/components/base/PvCompanyTag/PvCompanyTag.vue","../../../src/components/base/PvCompanyTag/PvCompanyTag.vue","../../../src/components/base/PvSuggestionTag/PvSuggestionTag.vue","../../../src/components/base/PvSuggestionTag/PvSuggestionTag.vue","../../../src/components/base/PvAccordion/PvAccordion.vue","../../../src/components/base/PvAccordion/PvAccordion.vue","../../../src/components/base/PvSearchInput/PvSearchInput.vue","../../../src/components/base/PvSearchInput/PvSearchInput.vue","../../../src/functions/dates.ts","../../../src/components/base/PvDatePicker/PvDatePicker.vue","../../../src/components/base/PvDatePicker/PvDatePicker.vue","../../../src/components/base/PvDateTime/useDateTime.ts","../../../src/components/base/PvDateTime/PvDateTime.vue","../../../src/components/base/PvDateTime/PvDateTime.vue","../../../src/composables/useResizable.ts","../../../src/components/base/PvResizeHandle/PvResizeHandle.vue","../../../src/components/base/PvResizeHandle/PvResizeHandle.vue","../../../src/components/base/PvDrawer/PvDrawer.vue","../../../src/components/base/PvDrawer/PvDrawer.vue","../../../src/components/base/PvContext/config.ts","../../../src/components/base/PvContext/PvContextSurface/PvContextSurface.vue","../../../src/components/base/PvContext/PvContextSurface/PvContextSurface.vue","../../../src/components/base/PvContext/PvSpinesEntityFields/PvSpinesEntityFields.vue","../../../src/components/base/PvContext/PvSpinesEntityFields/PvSpinesEntityFields.vue","../../../src/components/base/PvTextArea/PvTextArea.vue","../../../src/components/base/PvTextArea/PvTextArea.vue","../../../src/components/base/PvToggleButton/PvToggleButton.vue","../../../src/components/base/PvToggleButton/PvToggleButton.vue","../../../src/components/base/PvToast/PvToast.vue","../../../src/components/base/PvToast/PvToast.vue","../../../src/components/base/PvContext/PvContextFeedback/PvContextFeedback.vue","../../../src/components/base/PvContext/PvContextFeedback/PvContextFeedback.vue","../../../src/components/base/PvGhostInput/PvGhostInput.vue","../../../src/components/base/PvGhostInput/PvGhostInput.vue","../../../src/components/base/PvTabs/PvTabs.vue","../../../src/components/base/PvTabs/PvTabs.vue","../../../src/components/base/PvBreadcrumbs/PvBreadcrumbs.vue","../../../src/components/base/PvBreadcrumbs/PvBreadcrumbs.vue","../../../src/components/base/PvMenu/PvMenuControlPanel.vue","../../../src/components/base/PvMenu/PvMenuControlPanel.vue","../../../src/components/base/PvAvatar/PvAvatar.vue","../../../src/components/base/PvAvatar/PvAvatar.vue","../../../src/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue","../../../src/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue","../../../src/components/base/PvMenu/PvMenuEmptyState.vue","../../../src/components/base/PvMenu/cascadeUtils.ts","../../../src/components/base/PvMenu/items/PvMenuBaseItem.vue","../../../src/components/base/PvMenu/items/PvMenuBaseItem.vue","../../../src/components/base/PvSwitch/PvSwitch.vue","../../../src/components/base/PvSwitch/PvSwitch.vue","../../../src/components/base/PvMenu/items/PvMenuItemAction.vue","../../../src/components/base/PvMenu/items/PvMenuItemAction.vue","../../../src/components/base/PvMenu/symbols.ts","../../../src/components/base/PvMenu/items/PvMenuItemVariant.vue","../../../src/components/base/PvMenu/items/PvMenuItemVariant.vue","../../../src/components/base/PvMenu/items/PvMenuItem.vue","../../../src/components/base/PvMenu/items/PvMenuItem.vue","../../../src/components/base/PvMenu/PvMenu.vue","../../../src/components/base/PvMenu/PvMenu.vue","../../../src/components/base/PvMultiSelectButton/PvMultiSelectButton.vue","../../../src/components/base/PvMultiSelectButton/PvMultiSelectButton.vue","../../../src/components/base/PvSelectButton/PvSelectButton.vue","../../../src/components/base/PvSelectButton/PvSelectButton.vue","../../../src/components/charts/themes.ts","../../../src/functions/colorPalette.ts","../../../src/functions/colorThemes.ts","../../../src/components/base/PvColorPalette/PvColorPalette.vue","../../../src/components/base/PvColorPalette/PvColorPalette.vue","../../../src/components/base/PvInput/PvInput.vue","../../../src/components/base/PvInput/PvInput.vue","../../../src/components/base/PvColorPicker/PvColorPickerPanel.vue","../../../src/components/base/PvColorPicker/PvColorPickerPanel.vue","../../../src/components/base/PvColorPicker/PvColorPicker.vue","../../../src/components/base/PvColorPicker/PvColorPicker.vue","../../../src/components/base/PvSortableList/PvSortableList.vue","../../../src/components/base/PvSortableList/PvSortableList.vue","../../../src/components/base/PvPagination/usePagination.ts","../../../src/components/base/PvPagination/PvPagination.vue","../../../src/components/base/PvPagination/PvPagination.vue","../../../src/components/base/PvSelectableCard/PvSelectableCard.vue","../../../src/components/base/PvSelectableCard/PvSelectableCard.vue","../../../src/components/layout/PvSidePanel/PvSidePanel.vue","../../../src/components/layout/PvSidePanel/PvSidePanel.vue","../../../src/components/layout/PvSplitPane/PvSplitPane.vue","../../../src/components/layout/PvSplitPane/PvSplitPane.vue","../../../src/components/base/PvHeader/PvHeader.vue","../../../src/components/base/PvHeader/PvHeader.vue","../../../src/components/base/PvCompanyLabel/PvCompanyLabel.vue","../../../src/components/base/PvCompanyLabel/PvCompanyLabel.vue","../../../src/components/base/PvAvatarGroup/PvAvatarGroup.vue","../../../src/components/base/PvAvatarGroup/PvAvatarGroup.vue","../../../src/components/base/PvToggleGroup/PvToggleGroup.vue","../../../src/components/base/PvToggleGroup/PvToggleGroup.vue","../../../src/components/base/PvCheckbox/PvCheckbox.vue","../../../src/components/base/PvCheckbox/PvCheckbox.vue","../../../src/components/base/PvRadioGroup/PvRadioGroup.vue","../../../src/components/base/PvRadioGroup/PvRadioGroup.vue","../../../src/components/base/PvSprite/PvSprite.vue","../../../src/components/base/PvSprite/PvSprite.vue","../../../src/components/base/PvSkeleton/PvSkeleton.vue","../../../src/components/base/PvSkeleton/PvSkeleton.vue","../../../src/components/base/TqLoader/TqLoader.vue","../../../src/components/base/TqLoader/TqLoader.vue","../../../src/components/base/PvFileInput/PvFileInput.vue","../../../src/components/base/PvFileInput/PvFileInput.vue","../../../src/components/base/PvRating/PvRating.vue","../../../src/components/base/PvRating/PvRating.vue","../../../src/components/base/PvCard/PvCard.vue","../../../src/components/base/PvCard/PvCard.vue","../../../src/components/base/PvWidget/PvWidget.vue","../../../src/components/base/PvWidget/PvWidget.vue","../../../src/components/base/PvInsightCard/PvInsightCard.vue","../../../src/components/base/PvInsightCard/PvInsightCard.vue","../../../src/components/base/PvExpandableContent/PvExpandableContent.vue","../../../src/components/base/PvExpandableContent/PvExpandableContent.vue","../../../src/components/base/PvActionBar/PvActionBar.vue","../../../src/components/base/PvActionBar/PvActionBar.vue","../../../src/components/base/PvTree/PvSimpleItemTree.vue","../../../src/components/base/PvTree/PvSimpleItemTree.vue","../../../src/components/base/PvTree/PvTreeReorderIcon.vue","../../../src/components/base/PvTree/PvTreeReorderIcon.vue","../../../src/components/base/PvTree/PvButtonTreeItem.vue","../../../src/components/base/PvTree/PvButtonTreeItem.vue","../../../src/components/base/PvTree/PvCheckboxTreeItem.vue","../../../src/components/base/PvTree/PvCheckboxTreeItem.vue","../../../src/components/base/PvTree/PvTreeConnector.vue","../../../src/components/base/PvTree/PvTreeConnector.vue","../../../src/components/base/PvTree/composables/useTreeIndentation.ts","../../../src/components/base/PvTree/PvTreeConnectorGroup.vue","../../../src/components/base/PvTree/PvTreeConnectorGroup.vue","../../../src/components/base/PvTree/composables/useHoverIcon.ts","../../../src/components/base/PvTree/symbols.ts","../../../src/components/base/PvTree/composables/useDraggingState.ts","../../../src/components/base/PvTree/composables/useDragAndDrop.ts","../../../src/components/base/PvTree/composables/useDragAndDropIndicator.ts","../../../src/components/base/PvTree/PvSimpleNestedTreeItem.vue","../../../src/components/base/PvTree/PvSimpleNestedTreeItem.vue","../../../src/components/base/PvTree/PvSimpleNestedTree.vue","../../../src/components/base/PvTree/PvSimpleNestedTree.vue","../../../src/components/base/PvTree/PvTreeItem.vue","../../../src/components/base/PvTree/PvTreeItem.vue","../../../src/components/base/PvTree/composables/useTreeUpdate.ts","../../../src/components/base/PvTree/PvTree.vue","../../../src/components/base/PvTree/PvTree.vue","../../../src/components/base/PvTree/PvTreeGroup.vue","../../../src/components/base/PvTree/PvTreeGroup.vue","../../../src/components/base/PvProgressBar/PvProgressBar.vue","../../../src/components/base/PvProgressBar/PvProgressBar.vue","../../../src/components/base/PvDistributionBar/PvDistributionBar.vue","../../../src/components/base/PvDistributionBar/PvDistributionBar.vue","../../../src/components/base/PvBoxPlot/helpers.ts","../../../src/components/base/PvBoxPlot/PvBoxPlot.vue","../../../src/components/base/PvBoxPlot/PvBoxPlot.vue","../../../src/components/base/PvRange/PvRange.vue","../../../src/components/base/PvRange/PvRange.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelOptionRow.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelOptionRow.vue","../../../src/components/base/PvFilterPanel/filterOptionValue.ts","../../../src/components/base/PvFilterPanel/filterOptionDisplay.ts","../../../src/components/base/PvFilterPanel/aggregateFilterModel.ts","../../../src/components/base/PvFilterPanel/PvFilterPanelAccordion.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelAccordion.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelAppliedFiltersSection.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelAppliedFiltersSection.vue","../../../src/components/base/PvHorizontalScroller/PvHorizontalScroller.vue","../../../src/components/base/PvHorizontalScroller/PvHorizontalScroller.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelCategoryButtonRow.vue","../../../src/components/base/PvFilterPanel/PvFilterPanelCategoryButtonRow.vue","../../../src/functions/filterSearchDisplay.ts","../../../src/components/base/PvFilterPanel/advancedFilterModel.ts","../../../src/components/base/PvFilterPanel/usePvFilterStore.ts","../../../src/components/base/PvFilterPanel/usePvFilterPanel.ts","../../../src/components/base/PvFilterPanel/PvFilterPanel.vue","../../../src/components/base/PvFilterPanel/PvFilterPanel.vue","../../../src/components/base/PvFilterModal/PvFilterModalSelectItem.vue","../../../src/components/base/PvFilterModal/PvFilterModalSelectItem.vue","../../../src/components/base/PvFilterModal/PvFilterModal.vue","../../../src/components/base/PvFilterModal/PvFilterModal.vue","../../../src/components/base/PvHoverActionMenu/PvHoverActionMenu.vue","../../../src/components/base/PvHoverActionMenu/PvHoverActionMenu.vue","../../../src/components/base/PvQueryBuilderInput/useQueryBuilder.ts","../../../src/components/base/PvQueryBuilderInput/QueryFormatter.vue","../../../src/components/base/PvQueryBuilderInput/QueryFormatter.vue","../../../src/components/base/PvQueryBuilderInput/PvQueryBuilderInput.vue","../../../src/components/base/PvQueryBuilderInput/PvQueryBuilderInput.vue","../../../src/components/base/PvSidebar/helpers.ts","../../../src/components/base/PvSidebar/PvSidebarNavFlyout.vue","../../../src/components/base/PvSidebar/PvSidebarNavFlyout.vue","../../../src/components/base/PvSidebar/PvSidebar.vue","../../../src/components/base/PvSidebar/PvSidebar.vue","../../../src/components/base/PvSidebarV2/helpers.ts","../../../src/components/base/PvSidebarV2/PvSidebarV2NavFlyout.vue","../../../src/components/base/PvSidebarV2/PvSidebarV2NavFlyout.vue","../../../src/components/base/PvSidebarV2/PvSidebarV2.vue","../../../src/components/base/PvSidebarV2/PvSidebarV2.vue","../../../src/components/base/PvTableOfContents/PvTableOfContents.vue","../../../src/components/base/PvTableOfContents/PvTableOfContents.vue","../../../src/components/base/PvStepper/PvStepper.vue","../../../src/components/base/PvStepper/PvStepper.vue","../../../src/components/base/PvEmptyState/PvEmptyState.vue","../../../src/components/base/PvEmptyState/PvEmptyState.vue","../../../src/components/base/PvComponentsConfig/primeVue.config.ts","../../../src/components/base/PvComponentsConfig/usePvComponents.ts","../../../src/components/base/PvMenu/useMenuPosition.ts","../../../src/composables/useColorTheme.ts","../../../src/composables/useCustomColorTheme.ts","../../../src/functions/imageColors.ts","../../../src/composables/useImageColors.ts","../../../src/functions/rum.ts","../../../src/components/base/AskTqBuddy/types.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { PvSpinnerSize, PvSpinnerVariant } from \"./types\";\n\ninterface PvSpinnerProps {\n  /** The size of the spinner. Controls the rendered diameter via a CSS custom property. */\n  size?: PvSpinnerSize;\n  /** The color variant of the spinner. Use \"white\" on dark backgrounds and \"dark\" on light backgrounds. */\n  variant?: PvSpinnerVariant;\n}\n\nconst mapSizeToPx: Record<PvSpinnerSize, string> = {\n  xs: \"0.75rem\",\n  sm: \"1rem\",\n  md: \"1.25rem\",\n  lg: \"1.5rem\",\n  xl: \"2rem\",\n};\n\nconst mapVariantToPvClass: Record<PvSpinnerVariant, string> = {\n  primary: \"pv-spinner\",\n  dark: \"pv-spinner-dark\",\n  white: \"pv-spinner-light\",\n};\n\nwithDefaults(defineProps<PvSpinnerProps>(), {\n  size: \"lg\",\n  variant: \"primary\",\n});\n</script>\n\n<template>\n  <div data-testid=\"pv-spinner\" :class=\"mapVariantToPvClass[variant]\" :style=\"{ '--size': mapSizeToPx[size] }\" />\n</template>\n","<script setup lang=\"ts\">\nimport { PvSpinnerSize, PvSpinnerVariant } from \"./types\";\n\ninterface PvSpinnerProps {\n  /** The size of the spinner. Controls the rendered diameter via a CSS custom property. */\n  size?: PvSpinnerSize;\n  /** The color variant of the spinner. Use \"white\" on dark backgrounds and \"dark\" on light backgrounds. */\n  variant?: PvSpinnerVariant;\n}\n\nconst mapSizeToPx: Record<PvSpinnerSize, string> = {\n  xs: \"0.75rem\",\n  sm: \"1rem\",\n  md: \"1.25rem\",\n  lg: \"1.5rem\",\n  xl: \"2rem\",\n};\n\nconst mapVariantToPvClass: Record<PvSpinnerVariant, string> = {\n  primary: \"pv-spinner\",\n  dark: \"pv-spinner-dark\",\n  white: \"pv-spinner-light\",\n};\n\nwithDefaults(defineProps<PvSpinnerProps>(), {\n  size: \"lg\",\n  variant: \"primary\",\n});\n</script>\n\n<template>\n  <div data-testid=\"pv-spinner\" :class=\"mapVariantToPvClass[variant]\" :style=\"{ '--size': mapSizeToPx[size] }\" />\n</template>\n","import { PvButtonSize } from \"@/components/base/PvButton/types.ts\";\n\nexport const supportedInverseButtonVariants = [\"ghost\"];\n\nconst sizeToClassMap: Record<PvButtonSize, string | undefined> = {\n  md: \"pv-button-small\",\n  lg: undefined,\n  xl: \"pv-button-large\",\n};\n\nexport const pvButtonSizeToClass = (size: PvButtonSize | null | undefined): string | null => {\n  if (size == null || !sizeToClassMap.hasOwnProperty(size)) {\n    return null;\n  }\n  return sizeToClassMap[size] || null;\n};\n","/**\n * Utility functions for web components\n */\n\nimport { ref, getCurrentInstance } from \"vue\";\n\n/**\n * Composable to detect if a component is running as a web component\n * Returns a reactive ref that's set to true/false on mount\n *\n * @returns Reactive ref boolean indicating if running as web component\n *\n * @example\n * import { useIsWebComponent } from '@/web-components/utils';\n *\n * export default {\n *   setup() {\n *     const isWc = useIsWebComponent();\n *     // isWc.value is true if running as web component, false if Vue component\n *   }\n * }\n */\nexport function useIsWebComponent() {\n  const isWc = ref(false);\n  const instance = getCurrentInstance();\n  const root = instance?.root || {};\n  if (\"isCE\" in root && root.isCE === true) {\n    isWc.value = true;\n  }\n  return isWc;\n}\n","export const PvSizes = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2x\"] as const;\nexport type PvSize = (typeof PvSizes)[number];\n\nexport const PvTheme = [\"white\", \"dark\"] as const;\nexport type PvThemes = (typeof PvTheme)[number];\n\nexport const PvVariants = [\"primary\", \"secondary\", \"tertiary\", \"ghost\", \"destructive\", \"transparent\"] as const;\nexport type PvVariants = (typeof PvVariants)[number];\n\nexport const PvColorVariants = [\"default\", \"success\", \"warning\", \"critical\", \"highlight\"] as const;\nexport type PvColorVariants = (typeof PvColorVariants)[number];\n\nexport const PvInputVariants = [\"h1\", \"h2\", \"h3\", \"h4\", \"text-md\", \"text-sm\", \"text-lg\", \"caption\"] as const;\nexport type PvInputVariants = (typeof PvInputVariants)[number];\n\nexport const PvTextInputColors = [\"white\", \"grey\"] as const;\nexport type PvTextInputColors = (typeof PvTextInputColors)[number];\n\nexport const PvOrientations = [\"vertical\", \"horizontal\"] as const;\nexport type PvOrientations = (typeof PvOrientations)[number];\n\nexport const sizeMap: Record<PvSize, string> = {\n  xs: \"12px\",\n  sm: \"16px\",\n  md: \"20px\",\n  lg: \"24px\",\n  xl: \"32px\",\n  \"2x\": \"40px\",\n};\n\nexport const PvIconSizes = [undefined, 10, 12, 16, 20, 24, 32, 64] as const;\nexport type PvIconSize = (typeof PvIconSizes)[number];\n\nexport type PvAlignmentPositions =\n  | \"bottom-left\"\n  | \"bottom-center\"\n  | \"bottom-right\"\n  | \"top-left\"\n  | \"top-center\"\n  | \"top-right\"\n  | \"center-left\"\n  | \"center-right\"\n  | \"right-top\"\n  | \"right-bottom\";\n","<script lang=\"ts\">\nimport { PvIconSizes } from \"../baseProps\";\n</script>\n<script setup lang=\"ts\">\nimport { computed, ref, Ref } from \"vue\";\nimport { useIsWebComponent } from \"@/web-components/utils\";\nimport type { PvIconProps } from \"./types\";\n\nconst props = defineProps<PvIconProps>();\nconst isWeb = useIsWebComponent();\n\nconst globalSpritePath: Ref<string | null> = ref(null);\n\nconst classes = computed(() => ({\n  \"pv-icon\": true,\n  [`pv-icon-${props.size}`]: props.size != null && PvIconSizes.includes(props.size),\n}));\n\nconst svgHref = computed(() => {\n  // If the global sprite path is set, use it\n  if (isWeb.value && globalSpritePath.value) {\n    return `${globalSpritePath.value}#${props.name}`;\n  }\n  return `#${props.name}`;\n});\n\n// @ts-expect-error ignore type error for globalThis\nif (globalThis.__PV_GLOBAL_SPRITE_PATH__) {\n  // We only want to use sprite paths for web components\n  // @ts-expect-error ignore type error for globalThis\n  globalSpritePath.value = globalThis.__PV_GLOBAL_SPRITE_PATH__;\n}\n</script>\n\n<template>\n  <svg data-testid=\"pv-icon\" aria-hidden=\"true\" :class=\"classes\">\n    <use :xlink:href=\"svgHref\"></use>\n  </svg>\n</template>\n","<script lang=\"ts\">\nimport { PvIconSizes } from \"../baseProps\";\n</script>\n<script setup lang=\"ts\">\nimport { computed, ref, Ref } from \"vue\";\nimport { useIsWebComponent } from \"@/web-components/utils\";\nimport type { PvIconProps } from \"./types\";\n\nconst props = defineProps<PvIconProps>();\nconst isWeb = useIsWebComponent();\n\nconst globalSpritePath: Ref<string | null> = ref(null);\n\nconst classes = computed(() => ({\n  \"pv-icon\": true,\n  [`pv-icon-${props.size}`]: props.size != null && PvIconSizes.includes(props.size),\n}));\n\nconst svgHref = computed(() => {\n  // If the global sprite path is set, use it\n  if (isWeb.value && globalSpritePath.value) {\n    return `${globalSpritePath.value}#${props.name}`;\n  }\n  return `#${props.name}`;\n});\n\n// @ts-expect-error ignore type error for globalThis\nif (globalThis.__PV_GLOBAL_SPRITE_PATH__) {\n  // We only want to use sprite paths for web components\n  // @ts-expect-error ignore type error for globalThis\n  globalSpritePath.value = globalThis.__PV_GLOBAL_SPRITE_PATH__;\n}\n</script>\n\n<template>\n  <svg data-testid=\"pv-icon\" aria-hidden=\"true\" :class=\"classes\">\n    <use :xlink:href=\"svgHref\"></use>\n  </svg>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvCounterBadgeSize, PvCounterBadgeVariant } from \"./types\";\n\nexport interface PvCounterBadgeProps {\n  /** Maximum value before showing overflow indicator (e.g. \"99+\") */\n  maxValue?: number;\n  /** Text prefix displayed before the value */\n  prefix?: string;\n  /** Display size of the badge */\n  size?: PvCounterBadgeSize;\n  /** Numeric value to display */\n  value?: number;\n  /** Visual style variant */\n  variant?: PvCounterBadgeVariant;\n  /** Fully rounded */\n  rounded?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCounterBadgeProps>(), {\n  variant: \"primary\",\n  maxValue: 99,\n  size: \"sm\",\n  prefix: \"\",\n});\n\nconst displayValue = computed(() => {\n  if (props.maxValue && props.value && props.value > props.maxValue) {\n    return `${props.maxValue}+`;\n  }\n  if (props.value != null) {\n    return `${props.prefix}${props.value}`;\n  }\n  return \"-\";\n});\n\nconst classes = computed(() => ({\n  \"pv-inline-block pv-inset-square pv-radius pv-text-center\": true,\n  \"pv-badge-md pv-text-body-md\": props.size == \"md\",\n  \"pv-badge-sm pv-text-body-sm\": props.size == \"sm\",\n  \"pv-surface-brand-inverse pv-text-inverse\": props.variant == \"primary\",\n  \"pv-badge-secondary\": props.variant == \"secondary\",\n  \"pv-surface-lighten-5\": props.variant == \"tertiary\",\n  \"pv-text-subdued\": props.variant == \"ghost\" || props.variant == \"tertiary\",\n  \"pv-surface\": props.variant == \"ghost\",\n  \"pv-rounded\": props.rounded,\n}));\n</script>\n<template>\n  <div :class=\"classes\" data-testid=\"pv-counter-badge\">\n    {{ displayValue }}\n  </div>\n</template>\n\n<style scoped>\n.pv-badge-md {\n  --inset-size: 2px 2px;\n  min-height: 20px;\n  max-height: 20px;\n  min-width: 20px;\n  font-weight: 500;\n}\n.pv-badge-sm {\n  --inset-size: 0 2px;\n  min-height: 16px;\n  max-height: 16px;\n  min-width: 16px;\n  font-weight: 500;\n}\n.pv-rounded {\n  border-radius: 50%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvCounterBadgeSize, PvCounterBadgeVariant } from \"./types\";\n\nexport interface PvCounterBadgeProps {\n  /** Maximum value before showing overflow indicator (e.g. \"99+\") */\n  maxValue?: number;\n  /** Text prefix displayed before the value */\n  prefix?: string;\n  /** Display size of the badge */\n  size?: PvCounterBadgeSize;\n  /** Numeric value to display */\n  value?: number;\n  /** Visual style variant */\n  variant?: PvCounterBadgeVariant;\n  /** Fully rounded */\n  rounded?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCounterBadgeProps>(), {\n  variant: \"primary\",\n  maxValue: 99,\n  size: \"sm\",\n  prefix: \"\",\n});\n\nconst displayValue = computed(() => {\n  if (props.maxValue && props.value && props.value > props.maxValue) {\n    return `${props.maxValue}+`;\n  }\n  if (props.value != null) {\n    return `${props.prefix}${props.value}`;\n  }\n  return \"-\";\n});\n\nconst classes = computed(() => ({\n  \"pv-inline-block pv-inset-square pv-radius pv-text-center\": true,\n  \"pv-badge-md pv-text-body-md\": props.size == \"md\",\n  \"pv-badge-sm pv-text-body-sm\": props.size == \"sm\",\n  \"pv-surface-brand-inverse pv-text-inverse\": props.variant == \"primary\",\n  \"pv-badge-secondary\": props.variant == \"secondary\",\n  \"pv-surface-lighten-5\": props.variant == \"tertiary\",\n  \"pv-text-subdued\": props.variant == \"ghost\" || props.variant == \"tertiary\",\n  \"pv-surface\": props.variant == \"ghost\",\n  \"pv-rounded\": props.rounded,\n}));\n</script>\n<template>\n  <div :class=\"classes\" data-testid=\"pv-counter-badge\">\n    {{ displayValue }}\n  </div>\n</template>\n\n<style scoped>\n.pv-badge-md {\n  --inset-size: 2px 2px;\n  min-height: 20px;\n  max-height: 20px;\n  min-width: 20px;\n  font-weight: 500;\n}\n.pv-badge-sm {\n  --inset-size: 0 2px;\n  min-height: 16px;\n  max-height: 16px;\n  min-width: 16px;\n  font-weight: 500;\n}\n.pv-rounded {\n  border-radius: 50%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvButtonProps } from \"./types\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport { pvButtonSizeToClass, supportedInverseButtonVariants } from \"@/components/base/PvButton/helpers.ts\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\n\nconst props = withDefaults(defineProps<PvButtonProps>(), {\n  variant: \"primary\",\n  disabled: false,\n  size: \"lg\",\n  loading: false,\n  inverse: false,\n});\n\nconst computedAriaLabel = computed(() => (!props.label || props.loading ? props.label || props.ariaLabel : undefined));\n\nconst classes = computed(() => {\n  const output = [];\n  if (props.inverse && supportedInverseButtonVariants.includes(props.variant)) {\n    output.push(`pv-button-${props.variant}-inverse`);\n  } else {\n    output.push(`pv-button-${props.variant}`);\n  }\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n</script>\n\n<template>\n  <button type=\"button\" :class=\"classes\" :disabled=\"disabled\" :aria-label=\"computedAriaLabel\" data-testid=\"pv-button\">\n    <PvSpinner v-if=\"loading\" size=\"sm\" />\n    <template v-else>\n      <PvCounterBadge v-if=\"leftCounterBadge\" :value=\"leftCounterBadge\" variant=\"tertiary\" />\n      <PvIcon v-if=\"leftIcon\" :name=\"leftIcon\" data-testid=\"pv-button-left-icon\" />\n      <span v-if=\"label\" data-testid=\"pv-button-label\">{{ label }}</span>\n      <PvCounterBadge v-if=\"rightCounterBadge\" :value=\"rightCounterBadge\" variant=\"tertiary\" />\n      <PvIcon v-if=\"rightIcon\" :name=\"rightIcon\" data-testid=\"pv-button-right-icon\" />\n    </template>\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvButtonProps } from \"./types\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport { pvButtonSizeToClass, supportedInverseButtonVariants } from \"@/components/base/PvButton/helpers.ts\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\n\nconst props = withDefaults(defineProps<PvButtonProps>(), {\n  variant: \"primary\",\n  disabled: false,\n  size: \"lg\",\n  loading: false,\n  inverse: false,\n});\n\nconst computedAriaLabel = computed(() => (!props.label || props.loading ? props.label || props.ariaLabel : undefined));\n\nconst classes = computed(() => {\n  const output = [];\n  if (props.inverse && supportedInverseButtonVariants.includes(props.variant)) {\n    output.push(`pv-button-${props.variant}-inverse`);\n  } else {\n    output.push(`pv-button-${props.variant}`);\n  }\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n</script>\n\n<template>\n  <button type=\"button\" :class=\"classes\" :disabled=\"disabled\" :aria-label=\"computedAriaLabel\" data-testid=\"pv-button\">\n    <PvSpinner v-if=\"loading\" size=\"sm\" />\n    <template v-else>\n      <PvCounterBadge v-if=\"leftCounterBadge\" :value=\"leftCounterBadge\" variant=\"tertiary\" />\n      <PvIcon v-if=\"leftIcon\" :name=\"leftIcon\" data-testid=\"pv-button-left-icon\" />\n      <span v-if=\"label\" data-testid=\"pv-button-label\">{{ label }}</span>\n      <PvCounterBadge v-if=\"rightCounterBadge\" :value=\"rightCounterBadge\" variant=\"tertiary\" />\n      <PvIcon v-if=\"rightIcon\" :name=\"rightIcon\" data-testid=\"pv-button-right-icon\" />\n    </template>\n  </button>\n</template>\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  return {\n    top: 0,\n    right: 0,\n    bottom: 0,\n    left: 0,\n    ...padding\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 { 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  switch (getAlignment(placement)) {\n    case 'start':\n      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\n    case 'end':\n      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n      break;\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    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 min$1 = minPadding;\n    const max = clientSize - arrowDimensions[length] - maxPadding;\n    const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n    const offset = clamp(min$1, 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$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n    const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : 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 overflow = await platform.detectOverflow(state, detectOverflowOptions);\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      const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\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 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      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 && 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            const width = right - left;\n            const height = bottom - top;\n            return {\n              top,\n              bottom,\n              left,\n              right,\n              width,\n              height,\n              x: left,\n              y: 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          const left = minLeft;\n          const right = maxRight;\n          const width = right - left;\n          const height = bottom - top;\n          return {\n            top,\n            bottom,\n            left,\n            right,\n            width,\n            height,\n            x: left,\n            y: 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(getSide(placement));\n      const mainAxis = getOppositeAxis(crossAxis);\n      let mainAxisCoord = coords[mainAxis];\n      let crossAxisCoord = coords[crossAxis];\n      if (checkMainAxis) {\n        const minSide = mainAxis === 'y' ? 'top' : 'left';\n        const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n        const min = mainAxisCoord + overflow[minSide];\n        const max = mainAxisCoord - overflow[maxSide];\n        mainAxisCoord = clamp(min, mainAxisCoord, max);\n      }\n      if (checkCrossAxis) {\n        const minSide = crossAxis === 'y' ? 'top' : 'left';\n        const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n        const min = crossAxisCoord + overflow[minSide];\n        const max = crossAxisCoord - overflow[maxSide];\n        crossAxisCoord = clamp(min, crossAxisCoord, max);\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      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: 0,\n        crossAxis: 0,\n        ...rawOffset\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/**\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      var _state$middlewareData, _state$middlewareData2;\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 noShift = !state.middlewareData.shift;\n      let availableHeight = overflowAvailableHeight;\n      let availableWidth = overflowAvailableWidth;\n      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n        availableWidth = maximumClippingWidth;\n      }\n      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n        availableHeight = maximumClippingHeight;\n      }\n      if (noShift && !alignment) {\n        const xMin = max(overflow.left, 0);\n        const xMax = max(overflow.right, 0);\n        const yMin = max(overflow.top, 0);\n        const yMax = max(overflow.bottom, 0);\n        if (isYAxis) {\n          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n        } else {\n          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : 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","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.ownerDocument.body : 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","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  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n    return false;\n  }\n  return isFixed;\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) {\n    const win = getWindow(domElement);\n    const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n    let currentWin = win;\n    let currentIFrame = getFrameElement(currentWin);\n    while (currentIFrame && offsetParent && 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 || !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 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(element) {\n  const html = getDocumentElement(element);\n  const scroll = getNodeScroll(element);\n  const body = element.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(element);\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) {\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    width = visualViewport.width;\n    height = visualViewport.height;\n    const visualViewportBased = isWebKit();\n    if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n      x = visualViewport.offsetLeft;\n      y = visualViewport.offsetTop;\n    }\n  }\n  const windowScrollbarX = getWindowScrollBarX(html);\n  // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the\n  // visual width of the <html> but this is not considered in the size\n  // of `html.clientWidth`.\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 clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n    if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {\n      width -= clippingStableScrollbarWidth;\n    }\n  } else if (windowScrollbarX <= SCROLLBAR_MAX) {\n    // If the <body> scrollbar is on the left, the width needs to be extended\n    // by the scrollbar amount so there isn't extra space on the right.\n    width += windowScrollbarX;\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 = isHTMLElement(element) ? getScale(element) : createCoords(1);\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') {\n    rect = getViewportRect(element, strategy);\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}\nfunction hasFixedPositionAncestor(element, stopNode) {\n  const parentNode = getParentNode(element);\n  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n    return false;\n  }\n  return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\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 currentContainingBlockComputedStyle = 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    if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n      currentContainingBlockComputedStyle = null;\n    }\n    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n    if (shouldDropCurrentNode) {\n      // Drop non-containing blocks.\n      result = result.filter(ancestor => ancestor !== currentNode);\n    } else {\n      // Record last containing block for next iteration.\n      currentContainingBlockComputedStyle = 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\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  function setLeftRTLScrollbarOffset() {\n    offsets.x = getWindowScrollBarX(documentElement);\n  }\n  if (isOffsetParentAnElement || !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    } else if (documentElement) {\n      setLeftRTLScrollbarOffset();\n    }\n  }\n  if (isFixed && !isOffsetParentAnElement && documentElement) {\n    setLeftRTLScrollbarOffset();\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) {\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      if (ratio !== threshold) {\n        if (!isFirstUpdate) {\n          return refresh();\n        }\n        if (!ratio) {\n          // If the reference is clipped, the ratio is 0. Throttle the refresh\n          // 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      if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n        // It's possible that even though the ratio is reported as 1, the\n        // element is not actually fully within the IntersectionObserver's root\n        // area anymore. This can happen under performance constraints. This may\n        // be a bug in the browser's IntersectionObserver implementation. To\n        // work around this, we compare the element's bounding rect now with\n        // what it was at the time we created the IntersectionObserver. If they\n        // are not equal then the element moved, so we refresh.\n        refresh();\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  refresh(true);\n  return cleanup;\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      passive: true\n    });\n    ancestorResize && ancestor.addEventListener('resize', update);\n  });\n  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : 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 = {\n    platform,\n    ...options\n  };\n  const platformWithCache = {\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 * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n  if (Array.isArray(target)) {\n    target.length = Math.max(target.length, key)\n    target.splice(key, 1, val)\n    return val\n  }\n  target[key] = val\n  return val\n}\n\nexport function del(target, key) {\n  if (Array.isArray(target)) {\n    target.splice(key, 1)\n    return\n  }\n  delete target[key]\n}\n\nexport * from 'vue'\nexport {\n  Vue,\n  Vue2,\n  isVue2,\n  isVue3,\n  install,\n}\n","import { arrow as arrow$1, computePosition } from '@floating-ui/dom';\nexport { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/dom';\nimport { isNode, getNodeName } from '@floating-ui/utils/dom';\nimport { unref, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi';\n\nfunction isComponentPublicInstance(target) {\n  return target != null && typeof target === 'object' && '$el' in target;\n}\nfunction unwrapElement(target) {\n  if (isComponentPublicInstance(target)) {\n    const element = target.$el;\n    return isNode(element) && getNodeName(element) === '#comment' ? null : element;\n  }\n  return target;\n}\n\nfunction toValue(source) {\n  return typeof source === 'function' ? source() : unref(source);\n}\n\n/**\n * Positions an inner element of the floating element such that it is centered to the reference element.\n * @param options The arrow options.\n * @see https://floating-ui.com/docs/arrow\n */\nfunction arrow(options) {\n  return {\n    name: 'arrow',\n    options,\n    fn(args) {\n      const element = unwrapElement(toValue(options.element));\n      if (element == null) {\n        return {};\n      }\n      return arrow$1({\n        element,\n        padding: options.padding\n      }).fn(args);\n    }\n  };\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\n/**\n * Computes the `x` and `y` coordinates that will place the floating element next to a reference element when it is given a certain CSS positioning strategy.\n * @param reference The reference template ref.\n * @param floating The floating template ref.\n * @param options The floating options.\n * @see https://floating-ui.com/docs/vue\n */\nfunction useFloating(reference, floating, options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const whileElementsMountedOption = options.whileElementsMounted;\n  const openOption = computed(() => {\n    var _toValue;\n    return (_toValue = toValue(options.open)) != null ? _toValue : true;\n  });\n  const middlewareOption = computed(() => toValue(options.middleware));\n  const placementOption = computed(() => {\n    var _toValue2;\n    return (_toValue2 = toValue(options.placement)) != null ? _toValue2 : 'bottom';\n  });\n  const strategyOption = computed(() => {\n    var _toValue3;\n    return (_toValue3 = toValue(options.strategy)) != null ? _toValue3 : 'absolute';\n  });\n  const transformOption = computed(() => {\n    var _toValue4;\n    return (_toValue4 = toValue(options.transform)) != null ? _toValue4 : true;\n  });\n  const referenceElement = computed(() => unwrapElement(reference.value));\n  const floatingElement = computed(() => unwrapElement(floating.value));\n  const x = ref(0);\n  const y = ref(0);\n  const strategy = ref(strategyOption.value);\n  const placement = ref(placementOption.value);\n  const middlewareData = shallowRef({});\n  const isPositioned = ref(false);\n  const floatingStyles = computed(() => {\n    const initialStyles = {\n      position: strategy.value,\n      left: '0',\n      top: '0'\n    };\n    if (!floatingElement.value) {\n      return initialStyles;\n    }\n    const xVal = roundByDPR(floatingElement.value, x.value);\n    const yVal = roundByDPR(floatingElement.value, y.value);\n    if (transformOption.value) {\n      return {\n        ...initialStyles,\n        transform: \"translate(\" + xVal + \"px, \" + yVal + \"px)\",\n        ...(getDPR(floatingElement.value) >= 1.5 && {\n          willChange: 'transform'\n        })\n      };\n    }\n    return {\n      position: strategy.value,\n      left: xVal + \"px\",\n      top: yVal + \"px\"\n    };\n  });\n  let whileElementsMountedCleanup;\n  function update() {\n    if (referenceElement.value == null || floatingElement.value == null) {\n      return;\n    }\n    const open = openOption.value;\n    computePosition(referenceElement.value, floatingElement.value, {\n      middleware: middlewareOption.value,\n      placement: placementOption.value,\n      strategy: strategyOption.value\n    }).then(position => {\n      x.value = position.x;\n      y.value = position.y;\n      strategy.value = position.strategy;\n      placement.value = position.placement;\n      middlewareData.value = position.middlewareData;\n      /**\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       */\n      isPositioned.value = open !== false;\n    });\n  }\n  function cleanup() {\n    if (typeof whileElementsMountedCleanup === 'function') {\n      whileElementsMountedCleanup();\n      whileElementsMountedCleanup = undefined;\n    }\n  }\n  function attach() {\n    cleanup();\n    if (whileElementsMountedOption === undefined) {\n      update();\n      return;\n    }\n    if (referenceElement.value != null && floatingElement.value != null) {\n      whileElementsMountedCleanup = whileElementsMountedOption(referenceElement.value, floatingElement.value, update);\n      return;\n    }\n  }\n  function reset() {\n    if (!openOption.value) {\n      isPositioned.value = false;\n    }\n  }\n  watch([middlewareOption, placementOption, strategyOption, openOption], update, {\n    flush: 'sync'\n  });\n  watch([referenceElement, floatingElement], attach, {\n    flush: 'sync'\n  });\n  watch(openOption, reset, {\n    flush: 'sync'\n  });\n  if (getCurrentScope()) {\n    onScopeDispose(cleanup);\n  }\n  return {\n    x: shallowReadonly(x),\n    y: shallowReadonly(y),\n    strategy: shallowReadonly(strategy),\n    placement: shallowReadonly(placement),\n    middlewareData: shallowReadonly(middlewareData),\n    isPositioned: shallowReadonly(isPositioned),\n    floatingStyles,\n    update\n  };\n}\n\nexport { arrow, useFloating };\n","import { computed, onBeforeUnmount, onBeforeUpdate, onMounted, ref, unref, useSlots, watch } from \"vue\";\nimport type { Ref } from \"vue\";\nimport { useIsWebComponent } from \"@/web-components/utils\";\n\ntype MaybeRef<T> = T | Ref<T>;\n\nexport type UseSlotPresenceOptions = {\n  /**\n   * Host element for native slot detection (required for web components).\n   * When running as a web component, light DOM children of this element are inspected.\n   */\n  host?: MaybeRef<HTMLElement | null | undefined>;\n\n  /**\n   * A slots object (useful for tests or to override `useSlots()`).\n   * Only used when running as a Vue component (not a web component).\n   */\n  vueSlots?: Record<string, unknown> | null | undefined;\n\n  /**\n   * Watch light DOM changes so presence updates if children are added/removed.\n   * Only applies to web component mode. Defaults to true.\n   */\n  observe?: boolean;\n\n  /**\n   * Listen to slotchange events on shadow DOM slots.\n   * Only applies to web component mode. Defaults to true.\n   */\n  listenSlotChange?: boolean;\n\n  /**\n   * If true, whitespace-only text nodes count as content in the default slot.\n   * Only applies to web component mode. Defaults to false.\n   */\n  countWhitespaceTextInDefaultSlot?: boolean;\n};\n\nfunction isMeaningfulTextNode(node: Node, countWhitespace: boolean) {\n  if (node.nodeType !== Node.TEXT_NODE) return false;\n  const txt = node.textContent ?? \"\";\n  return countWhitespace ? txt.length > 0 : txt.trim().length > 0;\n}\n\nfunction hasNativeSlottedContent(host: HTMLElement, name: string, countWhitespaceTextInDefaultSlot: boolean): boolean {\n  const slotName = name === \"default\" ? \"\" : name;\n  const nodes = Array.from(host.childNodes);\n\n  if (slotName === \"\") {\n    // Default slot: nodes without a `slot` attribute\n    return nodes.some((n) => {\n      if (n.nodeType === Node.ELEMENT_NODE) {\n        const el = n as Element;\n        return !el.hasAttribute(\"slot\");\n      }\n      return isMeaningfulTextNode(n, countWhitespaceTextInDefaultSlot);\n    });\n  }\n\n  // Named slot: element children with slot=\"name\"\n  return nodes.some((n) => {\n    if (n.nodeType !== Node.ELEMENT_NODE) return false;\n    const el = n as Element;\n    return el.getAttribute(\"slot\") === slotName;\n  });\n}\n\n/**\n * Vue's light DOM custom elements (`shadowRoot: false`) move every child off the\n * host into an internal map during `connectedCallback`, before the component\n * renders, and splice them back in wherever a `<slot>` outlet appears. The host\n * is therefore empty by the time we can inspect it, and this map is the only\n * surviving record of what was slotted. Vue populates it before `setup()` runs\n * and keeps it as the source `_renderSlots()` reads on every update, so it is a\n * stable answer for a slot outlet that is itself gated on slot presence.\n */\ntype LightDomSlotHost = HTMLElement & { _slots?: Record<string, Node[]> };\n\nfunction getParsedLightDomSlots(host: HTMLElement): Record<string, Node[]> | null {\n  if (host.shadowRoot) return null;\n  const slots = (host as LightDomSlotHost)._slots;\n  if (!slots || typeof slots !== \"object\") return null;\n  return slots;\n}\n\nfunction hasParsedSlotContent(\n  slots: Record<string, Node[]>,\n  name: string,\n  countWhitespaceTextInDefaultSlot: boolean,\n): boolean {\n  // Vue keys the default slot as \"default\" and named slots by their `slot` attribute.\n  const nodes = slots[name === \"\" ? \"default\" : name];\n  if (!nodes) return false;\n  return nodes.some((n) => {\n    if (n.nodeType === Node.ELEMENT_NODE) return true;\n    return isMeaningfulTextNode(n, countWhitespaceTextInDefaultSlot);\n  });\n}\n\nfunction getShadowSlotEl(host: HTMLElement, name: string): HTMLSlotElement | null {\n  const sr = host.shadowRoot;\n  if (!sr) return null;\n  if (name === \"default\" || name === \"\") {\n    return sr.querySelector(\"slot:not([name])\");\n  }\n  return sr.querySelector(`slot[name=\"${CSS.escape(name)}\"]`);\n}\n\n/**\n * Reports whether a custom element host has content for `name`, across all three\n * ways slotted content can be held: assigned to a shadow `<slot>`, parsed off the\n * host by Vue in light DOM, or still sitting as a light DOM child.\n *\n * Exported so callers that resolve a slot name dynamically (and so cannot hold a\n * `useSlotPresence` instance per slot) resolve it the same way.\n */\nexport function hasHostSlotContent(\n  host: HTMLElement,\n  name: string,\n  { useShadowSlot = true, countWhitespaceTextInDefaultSlot = false } = {},\n): boolean {\n  const slotEl = useShadowSlot ? getShadowSlotEl(host, name) : null;\n  if (slotEl) {\n    return slotEl.assignedNodes({ flatten: true }).some((n) => {\n      if (n.nodeType === Node.ELEMENT_NODE) return true;\n      return isMeaningfulTextNode(n, countWhitespaceTextInDefaultSlot);\n    });\n  }\n\n  // Light DOM custom element: the host has been drained, so read the slots Vue\n  // parsed off it. Note that Vue only parses on first connect, so children added\n  // to the host later are never rendered either way.\n  const parsedSlots = getParsedLightDomSlots(host);\n  if (parsedSlots) return hasParsedSlotContent(parsedSlots, name, countWhitespaceTextInDefaultSlot);\n\n  return hasNativeSlottedContent(host, name, countWhitespaceTextInDefaultSlot);\n}\n\n/**\n * Returns a computed boolean indicating if a slot has content.\n *\n * Automatically detects if running as a Vue component or web component:\n * - Vue component: checks Vue's slot system via useSlots()\n * - Web component: inspects light DOM children of the host element\n */\nexport function useSlotPresence(slotName: string, options: UseSlotPresenceOptions = {}) {\n  const { host, vueSlots, observe = true, listenSlotChange = true, countWhitespaceTextInDefaultSlot = false } = options;\n\n  const isWebComponent = useIsWebComponent();\n  const slots = vueSlots ?? useSlots();\n\n  // Vue's slots object is updated in place and is not reactive, so a computed\n  // would cache the initial slot table forever. Refresh before each component\n  // update so conditional named slots can appear and disappear at runtime.\n  const vueSlotKey = slotName === \"default\" || slotName === \"\" ? \"default\" : slotName;\n  const readVueSlot = () => !!slots && !!(slots as Record<string, unknown>)[vueSlotKey];\n  const hasVueSlot = ref(readVueSlot());\n  onBeforeUpdate(() => {\n    hasVueSlot.value = readVueSlot();\n  });\n\n  // Native/web-component slot presence\n  const hasNativeSlot = ref(false);\n\n  let mo: MutationObserver | null = null;\n  let shadowRoot: ShadowRoot | null = null;\n\n  const cleanup = () => {\n    if (mo) {\n      mo.disconnect();\n      mo = null;\n    }\n    if (shadowRoot) {\n      shadowRoot.removeEventListener(\"slotchange\", updateNative);\n      shadowRoot = null;\n    }\n  };\n\n  const updateNative = () => {\n    if (!isWebComponent.value) {\n      hasNativeSlot.value = false;\n      return;\n    }\n\n    const el = unref(host);\n    if (!el) {\n      hasNativeSlot.value = false;\n      return;\n    }\n\n    hasNativeSlot.value = hasHostSlotContent(el, slotName, {\n      // Prefer assignedNodes when we can reach the <slot> element in an open shadowRoot\n      useShadowSlot: listenSlotChange,\n      countWhitespaceTextInDefaultSlot,\n    });\n  };\n\n  const attach = () => {\n    if (!isWebComponent.value) return;\n\n    cleanup();\n\n    const el = unref(host);\n    if (!el) {\n      hasNativeSlot.value = false;\n      return;\n    }\n\n    updateNative();\n\n    if (listenSlotChange) {\n      // Listen on the stable root so outlets added by a later render are covered too.\n      shadowRoot = el.shadowRoot;\n      shadowRoot?.addEventListener(\"slotchange\", updateNative);\n    }\n\n    if (observe) {\n      mo = new MutationObserver(() => updateNative());\n      mo.observe(el, {\n        childList: true,\n        subtree: false,\n        attributes: true,\n        attributeFilter: [\"slot\"],\n        characterData: true,\n      });\n    }\n  };\n\n  onMounted(attach);\n  onBeforeUnmount(cleanup);\n\n  // If host ref changes, reattach\n  watch(\n    () => unref(host),\n    () => {\n      if (isWebComponent.value) attach();\n    },\n  );\n\n  // Select presence based on component type\n  const present = computed(() => (isWebComponent.value ? hasNativeSlot.value : hasVueSlot.value));\n\n  return {\n    present,\n    hasVueSlot,\n    hasNativeSlot,\n    refresh: updateNative,\n  };\n}\n","import { onUnmounted, type Ref } from \"vue\";\n\nexport type HoverPopover = {\n  root: Ref<HTMLElement | null>;\n  /** The surface, which may be teleported out of `root`, so popovers nested in it still count as descendants. */\n  floating?: Ref<HTMLElement | null>;\n  /** The `hoverTarget` ancestor, when set: popovers opening inside it are within this one's hover area too. */\n  hoverArea?: Ref<HTMLElement | null>;\n  /** Attempts to close the popover. Returns false if it refused (e.g. disableClickOutsideToClose). */\n  close: () => boolean;\n};\n\nconst onScreen = new Set<HoverPopover>();\n\nconst isAncestorOf = (outer: HoverPopover, inner: HoverPopover) => {\n  const innerRoot = inner.root.value;\n  if (!innerRoot) return false;\n  return Boolean(\n    outer.root.value?.contains(innerRoot) ||\n      outer.floating?.value?.contains(innerRoot) ||\n      outer.hoverArea?.value?.contains(innerRoot),\n  );\n};\n\n/**\n * Keeps at most one dismissible hover popover on screen at a time. Uncoordinated, a sweep\n * across a list of triggers paints a trail: each popover the pointer left is still counting\n * down its `closeDelay` bridge while the next one opens instantly. Ancestors are spared — a\n * nested popover opening means the pointer is still inside the outer one. That includes one opening\n * anywhere in the outer's `hoverTarget` area (e.g. a tooltip on a button in the same row). A popover that\n * refuses to close (disableClickOutsideToClose) stays on screen alongside newly opened ones.\n *\n * Returns a setter for this popover's on-screen state.\n */\nexport const useHoverPopoverGroup = (popover: HoverPopover) => {\n  onUnmounted(() => onScreen.delete(popover));\n\n  return (isOpen: boolean) => {\n    if (!isOpen) {\n      onScreen.delete(popover);\n      return;\n    }\n    for (const other of [...onScreen]) {\n      if (other !== popover && !isAncestorOf(other, popover) && other.close()) onScreen.delete(other);\n    }\n    onScreen.add(popover);\n  };\n};\n","<script lang=\"ts\">\n/**\n * Every popover uses this same `anchor-name`. That is safe — and deliberate —\n * because each instance also declares `anchor-scope` for this name on its root,\n * which confines the name to that subtree. Two instances therefore cannot see\n * each other's anchor, so no per-instance identifier has to be generated (and\n * there is nothing for instances to collide on, including copies of this module\n * loaded from different bundles).\n *\n * Scoping just this name, rather than `anchor-scope: all`, leaves any other\n * anchor-positioned content inside the popover (e.g. charts) untouched.\n */\nconst PV_POPOVER_V2_ANCHOR = \"--pv-popover-v2-anchor\";\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, nextTick, onMounted, onUnmounted, ref, watch, type CSSProperties } from \"vue\";\nimport { AlignedPlacement, flip, offset, Placement, useFloating, type Middleware } from \"@floating-ui/vue\";\nimport { onClickOutside, useDebounceFn, useElementBounding, useElementHover } from \"@vueuse/core\";\nimport { PvPopoverV2Props } from \"@/components/base/PvPopoverV2/types.ts\";\nimport { PvAlignmentPositions } from \"@/components/base/baseProps.ts\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport { useHoverPopoverGroup } from \"@/components/base/PvPopoverV2/useHoverPopoverGroup.ts\";\n\nconst props = withDefaults(defineProps<PvPopoverV2Props>(), {\n  disableAutoPlacement: false,\n  position: \"bottom-left\",\n  positioningStrategy: \"absolute\",\n  disableInteractive: false,\n  enableClickToggle: false,\n  enableGroupSync: false,\n  useTeleport: false,\n  disableClickOutsideToClose: false,\n  showOnHover: false,\n  delay: 25,\n  closeDelay: 200,\n  zIndex: 10,\n  teleportLocation: \"body\",\n  disabled: false,\n  cssCustomProperties: () => ({}),\n});\n\nconst isOpen = defineModel<boolean>();\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot, hasNativeSlot } = useSlotPresence(\"content\", { host: customElementHost });\nconst hasContent = computed(() => (customElementHost ? hasNativeSlot.value : hasVueSlot.value));\n\n// This is the clipping-safe path used by more than 99% of observed customer\n// sessions. Older browsers keep the existing Floating UI behavior below.\nconst useNativePopover =\n  typeof HTMLElement !== \"undefined\" &&\n  typeof HTMLElement.prototype.showPopover === \"function\" &&\n  typeof CSS !== \"undefined\" &&\n  typeof CSS.supports === \"function\" &&\n  [\n    \"anchor-name: --pv-anchor\",\n    \"position-area: bottom\",\n    \"position-try-fallbacks: flip-block\",\n    \"position-visibility: anchors-visible\",\n    // Required: the shared anchor name is only collision-free because each\n    // instance scopes it. Without `anchor-scope` every popover would resolve to\n    // the last same-named anchor in the document, so such browsers must keep the\n    // Floating UI path below instead.\n    `anchor-scope: ${PV_POPOVER_V2_ANCHOR}`,\n  ].every((query) => CSS.supports(query));\n\nconst isMounted = ref(false);\nconst root = ref<HTMLElement | null>(null);\nconst triggerWrapper = ref<HTMLElement | null>(null);\nconst reference = ref<HTMLElement | null>(null);\nconst floating = ref<HTMLElement | null>(null);\n\n// `hoverTarget` widens the hover area to an ancestor of the trigger; the trigger still anchors.\nconst hoverElement = computed(\n  () => (props.hoverTarget && triggerWrapper.value?.closest<HTMLElement>(props.hoverTarget)) || triggerWrapper.value,\n);\nconst triggerHovered = useElementHover(hoverElement);\nconst floatingHovered = useElementHover(floating);\nconst triggerFocused = ref(false);\nconst floatingFocused = ref(false);\nconst hoverLatchedOff = ref(false);\n\nconst syncHoverGroup = useHoverPopoverGroup({\n  root,\n  floating,\n  hoverArea: computed(() => (props.hoverTarget ? hoverElement.value : null)),\n  close: () => {\n    if (props.disableClickOutsideToClose) return false;\n    closeNow();\n    return true;\n  },\n});\n\nconst placementMapping: Record<PvAlignmentPositions, AlignedPlacement | Placement> = {\n  \"top-center\": \"top\",\n  \"bottom-center\": \"bottom\",\n  \"center-left\": \"left\",\n  \"center-right\": \"right\",\n  \"right-top\": \"right-start\",\n  \"right-bottom\": \"right-end\",\n  \"top-left\": \"top-start\",\n  \"top-right\": \"top-end\",\n  \"bottom-left\": \"bottom-start\",\n  \"bottom-right\": \"bottom-end\",\n};\n\nconst nativePlacementMapping: Record<PvAlignmentPositions, { area: string; margin: string }> = {\n  \"top-center\": { area: \"top\", margin: \"margin-block-end\" },\n  \"bottom-center\": { area: \"bottom\", margin: \"margin-block-start\" },\n  \"center-left\": { area: \"left\", margin: \"margin-inline-end\" },\n  \"center-right\": { area: \"right\", margin: \"margin-inline-start\" },\n  \"right-top\": { area: \"span-bottom right\", margin: \"margin-inline-start\" },\n  \"right-bottom\": { area: \"span-top right\", margin: \"margin-inline-start\" },\n  \"top-left\": { area: \"top span-right\", margin: \"margin-block-end\" },\n  \"top-right\": { area: \"top span-left\", margin: \"margin-block-end\" },\n  \"bottom-left\": { area: \"bottom span-right\", margin: \"margin-block-start\" },\n  \"bottom-right\": { area: \"bottom span-left\", margin: \"margin-block-start\" },\n};\n\nconst popoverType = computed(() => (props.showOnHover || props.disableClickOutsideToClose ? \"manual\" : \"auto\"));\n// Confine this instance's anchor name to its own subtree, so every popover can\n// share one constant name without their anchors resolving to each other.\nconst rootStyle = computed(() => ({\n  width: \"fit-content\",\n  ...(useNativePopover ? { \"anchor-scope\": PV_POPOVER_V2_ANCHOR } : undefined),\n  ...props.cssCustomProperties,\n}));\nconst triggerStyle = computed(() => (useNativePopover ? { \"anchor-name\": PV_POPOVER_V2_ANCHOR } : undefined));\nconst nativePopoverStyles = computed(() => {\n  const placement = nativePlacementMapping[props.position];\n  return {\n    \"position-anchor\": PV_POPOVER_V2_ANCHOR,\n    \"position-area\": placement.area,\n    \"position-try-fallbacks\": props.disableAutoPlacement\n      ? undefined\n      : \"flip-block, flip-inline, flip-block flip-inline\",\n    [placement.margin]: `${props.offset ?? 0}px`,\n  };\n});\n\nlet updateLegacyPosition = () => {};\nlet getLegacyFloatingStyles: () => CSSProperties = () => ({});\n\nif (!useNativePopover) {\n  const middleware: Middleware[] = [];\n  if (!props.disableAutoPlacement) {\n    middleware.push(flip({ fallbackStrategy: \"initialPlacement\" }));\n  }\n  if (props.offset) {\n    middleware.push(offset(props.offset));\n  }\n\n  const legacyFloating = useFloating(reference, floating, {\n    placement: placementMapping[props.position],\n    strategy: props.positioningStrategy,\n    middleware,\n  });\n  updateLegacyPosition = legacyFloating.update;\n  getLegacyFloatingStyles = () => legacyFloating.floatingStyles.value;\n\n  const elementBounds = useElementBounding(reference);\n  const handleBoundsChange = useDebounceFn(() => {\n    if (isOpen.value) updateLegacyPosition();\n  }, 5);\n  watch([elementBounds.top, elementBounds.left, elementBounds.width, elementBounds.height], handleBoundsChange);\n\n  const ignoreForClickOutside = computed(() => [\n    floating.value,\n    \".p-datepicker-panel\",\n    ...(props.ignoreClickOutsideClasses?.map((className) => `.${className}`) ?? []),\n  ]);\n  onClickOutside(\n    root,\n    () => {\n      if (!props.disableClickOutsideToClose) setPopoverState(false);\n    },\n    { ignore: ignoreForClickOutside },\n  );\n}\n\nconst legacyPopoverStyles = computed(() => ({\n  ...getLegacyFloatingStyles(),\n  zIndex: props.zIndex,\n}));\n\nlet openDelayTimeout: ReturnType<typeof setTimeout> | undefined;\nlet closeDelayTimeout: ReturnType<typeof setTimeout> | undefined;\n\nconst clearOpenDelayTimeout = () => {\n  if (openDelayTimeout) clearTimeout(openDelayTimeout);\n  openDelayTimeout = undefined;\n};\n\nconst clearCloseDelayTimeout = () => {\n  if (closeDelayTimeout) clearTimeout(closeDelayTimeout);\n  closeDelayTimeout = undefined;\n};\n\nconst setPopoverState = (state: boolean) => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n  if (state && (props.disabled || !hasContent.value)) return;\n  if (state && props.delay > 0 && (props.showOnHover || !useNativePopover)) {\n    openDelayTimeout = setTimeout(() => {\n      isOpen.value = true;\n      openDelayTimeout = undefined;\n    }, props.delay);\n  } else {\n    isOpen.value = state;\n  }\n};\n\nconst closeNow = () => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n  isOpen.value = false;\n};\n\nconst syncNativeSurface = () => {\n  const surface = floating.value;\n  if (!surface || !isMounted.value || !hasContent.value) return;\n  if (isOpen.value) surface.showPopover();\n  else surface.hidePopover();\n};\n\n// A surface hidden under the pointer does not reliably get a `mouseleave` -\n// WebKit keeps reporting the stale hover until the pointer moves again - so the\n// surface only counts while it is actually showing. Otherwise closing from\n// inside the popover (a close button, Escape) would immediately reopen it.\nconst surfaceEngaged = computed(() => Boolean(isOpen.value) && (floatingHovered.value || floatingFocused.value));\n\nconst isHovered = computed(() => {\n  if (!props.showOnHover || hoverLatchedOff.value) return false;\n  return props.disableInteractive\n    ? triggerHovered.value || triggerFocused.value\n    : triggerHovered.value || triggerFocused.value || surfaceEngaged.value;\n});\n\nwatch([triggerHovered, triggerFocused, floatingFocused], ([hovered, focused, floatingFocusedValue]) => {\n  if (!hovered && !focused && !floatingFocusedValue) hoverLatchedOff.value = false;\n});\n\n// A mouse click leaves the trigger focused after the pointer has moved on, so only\n// keyboard focus (`:focus-visible`) should hold a hover popover open.\nconst handleTriggerFocusIn = ({ target }: FocusEvent) => {\n  triggerFocused.value = !props.disabled && target instanceof HTMLElement && target.matches(\":focus-visible\");\n};\n\n// Tabbing from the trigger into the content blurs the trigger, so the content\n// itself must also be tracked or the popover would close mid-tab.\nconst handleFloatingFocusIn = ({ target }: FocusEvent) => {\n  floatingFocused.value = !props.disabled && target instanceof HTMLElement && target.matches(\":focus-visible\");\n};\n\nconst handleFloatingFocusOut = () => {\n  floatingFocused.value = false;\n};\n\nconst handleTriggerClick = () => {\n  if (props.showOnHover) {\n    if (props.disableClickOutsideToClose) return;\n    // A pending open still counts as showing, so clicking through it dismisses.\n    if (!isOpen.value && !openDelayTimeout && props.enableClickToggle) {\n      // The pointer never left, so no fresh hover event will clear the latch.\n      hoverLatchedOff.value = false;\n      setPopoverState(true);\n      return;\n    }\n    hoverLatchedOff.value = true;\n    closeNow();\n    return;\n  }\n  setPopoverState(openDelayTimeout ? false : !isOpen.value);\n};\n\nconst handleToggle = (event: Event) => {\n  const open = (event as ToggleEvent).newState === \"open\";\n  if (isOpen.value !== open) isOpen.value = open;\n};\n\nconst handleKeydown = (event: KeyboardEvent) => {\n  if (useNativePopover && popoverType.value === \"manual\" && event.key === \"Escape\" && isOpen.value) {\n    event.preventDefault();\n    event.stopPropagation();\n    setPopoverState(false);\n  }\n};\n\nconst FOCUSABLE_SELECTOR =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\nconst focusableWithin = (element: HTMLElement | null) =>\n  element ? Array.from(element.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) : [];\n\n// A teleported surface sits away from the trigger in the DOM, so Tab from the trigger would skip its content.\nconst bridgesKeyboardFocus = computed(\n  () => props.useTeleport && !useNativePopover && props.showOnHover && !props.disabled,\n);\n\nconst handleTriggerKeydown = (event: KeyboardEvent) => {\n  if (!bridgesKeyboardFocus.value || event.key !== \"Tab\" || event.shiftKey || !isOpen.value) return;\n  const [first] = focusableWithin(floating.value);\n  if (!first) return;\n  event.preventDefault();\n  // Set before focusing: the trigger's focusout would otherwise close the popover before this focus lands.\n  floatingFocused.value = true;\n  first.focus();\n};\n\nconst handleFloatingKeydown = (event: KeyboardEvent) => {\n  if (!bridgesKeyboardFocus.value) return;\n  const [trigger] = focusableWithin(triggerWrapper.value);\n  if (event.key === \"Escape\") {\n    event.preventDefault();\n    event.stopPropagation();\n    hoverLatchedOff.value = true;\n    closeNow();\n    trigger?.focus();\n    return;\n  }\n  if (event.key !== \"Tab\") return;\n  const items = focusableWithin(floating.value);\n  if (event.shiftKey && document.activeElement === items[0]) {\n    event.preventDefault();\n    trigger?.focus();\n  } else if (!event.shiftKey && document.activeElement === items[items.length - 1]) {\n    // Not prevented: focus moves on from the trigger, so leaving the popover forwards never traps the user.\n    hoverLatchedOff.value = true;\n    closeNow();\n    trigger?.focus();\n  }\n};\n\nwatch(isOpen, async (open) => {\n  if (props.showOnHover && props.enableGroupSync) syncHoverGroup(Boolean(open));\n  if (!useNativePopover) {\n    if (open) updateLegacyPosition();\n    return;\n  }\n  await nextTick();\n  syncNativeSurface();\n});\n\nwatch(isHovered, (hovered) => {\n  if (!props.showOnHover) return;\n  if (hovered) {\n    // Opening (or the pointer re-entered the trigger/popover): cancel any\n    // pending close so the bridge holds the popover open.\n    setPopoverState(true);\n    return;\n  }\n  // The pointer left both the trigger and the popover. Cancel any pending\n  // delayed open so the popover can't flash open after the pointer is gone.\n  clearOpenDelayTimeout();\n  if (props.closeDelay > 0) {\n    // Defer the close so the pointer can bridge the gap from the trigger to the\n    // popover. If it lands on either, `isHovered` flips back to true and the\n    // branch above cancels this timeout.\n    clearCloseDelayTimeout();\n    closeDelayTimeout = setTimeout(() => {\n      closeDelayTimeout = undefined;\n      if (!isHovered.value) setPopoverState(false);\n    }, props.closeDelay);\n  } else {\n    setPopoverState(false);\n  }\n});\n\nwatch(hasContent, (present) => {\n  if (!present) {\n    closeNow();\n  } else if (useNativePopover && isOpen.value) {\n    nextTick(syncNativeSurface);\n  }\n});\n\nonMounted(() => {\n  reference.value = triggerWrapper.value;\n  isMounted.value = true;\n  if (isOpen.value) nextTick(() => (useNativePopover ? syncNativeSurface() : updateLegacyPosition()));\n});\n\nonUnmounted(() => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n});\n\nwatch(\n  () => props.disabled,\n  (disabled) => {\n    if (!disabled) {\n      if (isHovered.value) setPopoverState(true);\n      return;\n    }\n    if (triggerFocused.value) triggerFocused.value = false;\n    if (floatingFocused.value) floatingFocused.value = false;\n    setPopoverState(false);\n  },\n);\n</script>\n\n<template>\n  <div ref=\"root\" :style=\"rootStyle\" @keydown=\"handleKeydown\">\n    <div\n      ref=\"triggerWrapper\"\n      :style=\"triggerStyle\"\n      @click=\"handleTriggerClick\"\n      @focusin=\"handleTriggerFocusIn\"\n      @focusout=\"triggerFocused = false\"\n      @keydown=\"handleTriggerKeydown\"\n    >\n      <slot name=\"trigger\"> </slot>\n    </div>\n\n    <div\n      v-if=\"isMounted && useNativePopover && hasContent\"\n      ref=\"floating\"\n      class=\"pv-floating pv-floating-native\"\n      :popover=\"popoverType\"\n      :style=\"nativePopoverStyles\"\n      @toggle=\"handleToggle\"\n      @focusin=\"handleFloatingFocusIn\"\n      @focusout=\"handleFloatingFocusOut\"\n    >\n      <slot name=\"content\" v-if=\"!disabled\"></slot>\n    </div>\n\n    <Teleport v-else-if=\"hasContent\" :to=\"teleportLocation\" :disabled=\"!props.useTeleport || disabled\">\n      <div\n        ref=\"floating\"\n        class=\"pv-floating\"\n        v-show=\"isOpen\"\n        :style=\"legacyPopoverStyles\"\n        @focusin=\"handleFloatingFocusIn\"\n        @focusout=\"handleFloatingFocusOut\"\n        @keydown=\"handleFloatingKeydown\"\n      >\n        <slot name=\"content\"></slot>\n      </div>\n    </Teleport>\n  </div>\n</template>\n","<script lang=\"ts\">\n/**\n * Every popover uses this same `anchor-name`. That is safe — and deliberate —\n * because each instance also declares `anchor-scope` for this name on its root,\n * which confines the name to that subtree. Two instances therefore cannot see\n * each other's anchor, so no per-instance identifier has to be generated (and\n * there is nothing for instances to collide on, including copies of this module\n * loaded from different bundles).\n *\n * Scoping just this name, rather than `anchor-scope: all`, leaves any other\n * anchor-positioned content inside the popover (e.g. charts) untouched.\n */\nconst PV_POPOVER_V2_ANCHOR = \"--pv-popover-v2-anchor\";\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, nextTick, onMounted, onUnmounted, ref, watch, type CSSProperties } from \"vue\";\nimport { AlignedPlacement, flip, offset, Placement, useFloating, type Middleware } from \"@floating-ui/vue\";\nimport { onClickOutside, useDebounceFn, useElementBounding, useElementHover } from \"@vueuse/core\";\nimport { PvPopoverV2Props } from \"@/components/base/PvPopoverV2/types.ts\";\nimport { PvAlignmentPositions } from \"@/components/base/baseProps.ts\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport { useHoverPopoverGroup } from \"@/components/base/PvPopoverV2/useHoverPopoverGroup.ts\";\n\nconst props = withDefaults(defineProps<PvPopoverV2Props>(), {\n  disableAutoPlacement: false,\n  position: \"bottom-left\",\n  positioningStrategy: \"absolute\",\n  disableInteractive: false,\n  enableClickToggle: false,\n  enableGroupSync: false,\n  useTeleport: false,\n  disableClickOutsideToClose: false,\n  showOnHover: false,\n  delay: 25,\n  closeDelay: 200,\n  zIndex: 10,\n  teleportLocation: \"body\",\n  disabled: false,\n  cssCustomProperties: () => ({}),\n});\n\nconst isOpen = defineModel<boolean>();\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot, hasNativeSlot } = useSlotPresence(\"content\", { host: customElementHost });\nconst hasContent = computed(() => (customElementHost ? hasNativeSlot.value : hasVueSlot.value));\n\n// This is the clipping-safe path used by more than 99% of observed customer\n// sessions. Older browsers keep the existing Floating UI behavior below.\nconst useNativePopover =\n  typeof HTMLElement !== \"undefined\" &&\n  typeof HTMLElement.prototype.showPopover === \"function\" &&\n  typeof CSS !== \"undefined\" &&\n  typeof CSS.supports === \"function\" &&\n  [\n    \"anchor-name: --pv-anchor\",\n    \"position-area: bottom\",\n    \"position-try-fallbacks: flip-block\",\n    \"position-visibility: anchors-visible\",\n    // Required: the shared anchor name is only collision-free because each\n    // instance scopes it. Without `anchor-scope` every popover would resolve to\n    // the last same-named anchor in the document, so such browsers must keep the\n    // Floating UI path below instead.\n    `anchor-scope: ${PV_POPOVER_V2_ANCHOR}`,\n  ].every((query) => CSS.supports(query));\n\nconst isMounted = ref(false);\nconst root = ref<HTMLElement | null>(null);\nconst triggerWrapper = ref<HTMLElement | null>(null);\nconst reference = ref<HTMLElement | null>(null);\nconst floating = ref<HTMLElement | null>(null);\n\n// `hoverTarget` widens the hover area to an ancestor of the trigger; the trigger still anchors.\nconst hoverElement = computed(\n  () => (props.hoverTarget && triggerWrapper.value?.closest<HTMLElement>(props.hoverTarget)) || triggerWrapper.value,\n);\nconst triggerHovered = useElementHover(hoverElement);\nconst floatingHovered = useElementHover(floating);\nconst triggerFocused = ref(false);\nconst floatingFocused = ref(false);\nconst hoverLatchedOff = ref(false);\n\nconst syncHoverGroup = useHoverPopoverGroup({\n  root,\n  floating,\n  hoverArea: computed(() => (props.hoverTarget ? hoverElement.value : null)),\n  close: () => {\n    if (props.disableClickOutsideToClose) return false;\n    closeNow();\n    return true;\n  },\n});\n\nconst placementMapping: Record<PvAlignmentPositions, AlignedPlacement | Placement> = {\n  \"top-center\": \"top\",\n  \"bottom-center\": \"bottom\",\n  \"center-left\": \"left\",\n  \"center-right\": \"right\",\n  \"right-top\": \"right-start\",\n  \"right-bottom\": \"right-end\",\n  \"top-left\": \"top-start\",\n  \"top-right\": \"top-end\",\n  \"bottom-left\": \"bottom-start\",\n  \"bottom-right\": \"bottom-end\",\n};\n\nconst nativePlacementMapping: Record<PvAlignmentPositions, { area: string; margin: string }> = {\n  \"top-center\": { area: \"top\", margin: \"margin-block-end\" },\n  \"bottom-center\": { area: \"bottom\", margin: \"margin-block-start\" },\n  \"center-left\": { area: \"left\", margin: \"margin-inline-end\" },\n  \"center-right\": { area: \"right\", margin: \"margin-inline-start\" },\n  \"right-top\": { area: \"span-bottom right\", margin: \"margin-inline-start\" },\n  \"right-bottom\": { area: \"span-top right\", margin: \"margin-inline-start\" },\n  \"top-left\": { area: \"top span-right\", margin: \"margin-block-end\" },\n  \"top-right\": { area: \"top span-left\", margin: \"margin-block-end\" },\n  \"bottom-left\": { area: \"bottom span-right\", margin: \"margin-block-start\" },\n  \"bottom-right\": { area: \"bottom span-left\", margin: \"margin-block-start\" },\n};\n\nconst popoverType = computed(() => (props.showOnHover || props.disableClickOutsideToClose ? \"manual\" : \"auto\"));\n// Confine this instance's anchor name to its own subtree, so every popover can\n// share one constant name without their anchors resolving to each other.\nconst rootStyle = computed(() => ({\n  width: \"fit-content\",\n  ...(useNativePopover ? { \"anchor-scope\": PV_POPOVER_V2_ANCHOR } : undefined),\n  ...props.cssCustomProperties,\n}));\nconst triggerStyle = computed(() => (useNativePopover ? { \"anchor-name\": PV_POPOVER_V2_ANCHOR } : undefined));\nconst nativePopoverStyles = computed(() => {\n  const placement = nativePlacementMapping[props.position];\n  return {\n    \"position-anchor\": PV_POPOVER_V2_ANCHOR,\n    \"position-area\": placement.area,\n    \"position-try-fallbacks\": props.disableAutoPlacement\n      ? undefined\n      : \"flip-block, flip-inline, flip-block flip-inline\",\n    [placement.margin]: `${props.offset ?? 0}px`,\n  };\n});\n\nlet updateLegacyPosition = () => {};\nlet getLegacyFloatingStyles: () => CSSProperties = () => ({});\n\nif (!useNativePopover) {\n  const middleware: Middleware[] = [];\n  if (!props.disableAutoPlacement) {\n    middleware.push(flip({ fallbackStrategy: \"initialPlacement\" }));\n  }\n  if (props.offset) {\n    middleware.push(offset(props.offset));\n  }\n\n  const legacyFloating = useFloating(reference, floating, {\n    placement: placementMapping[props.position],\n    strategy: props.positioningStrategy,\n    middleware,\n  });\n  updateLegacyPosition = legacyFloating.update;\n  getLegacyFloatingStyles = () => legacyFloating.floatingStyles.value;\n\n  const elementBounds = useElementBounding(reference);\n  const handleBoundsChange = useDebounceFn(() => {\n    if (isOpen.value) updateLegacyPosition();\n  }, 5);\n  watch([elementBounds.top, elementBounds.left, elementBounds.width, elementBounds.height], handleBoundsChange);\n\n  const ignoreForClickOutside = computed(() => [\n    floating.value,\n    \".p-datepicker-panel\",\n    ...(props.ignoreClickOutsideClasses?.map((className) => `.${className}`) ?? []),\n  ]);\n  onClickOutside(\n    root,\n    () => {\n      if (!props.disableClickOutsideToClose) setPopoverState(false);\n    },\n    { ignore: ignoreForClickOutside },\n  );\n}\n\nconst legacyPopoverStyles = computed(() => ({\n  ...getLegacyFloatingStyles(),\n  zIndex: props.zIndex,\n}));\n\nlet openDelayTimeout: ReturnType<typeof setTimeout> | undefined;\nlet closeDelayTimeout: ReturnType<typeof setTimeout> | undefined;\n\nconst clearOpenDelayTimeout = () => {\n  if (openDelayTimeout) clearTimeout(openDelayTimeout);\n  openDelayTimeout = undefined;\n};\n\nconst clearCloseDelayTimeout = () => {\n  if (closeDelayTimeout) clearTimeout(closeDelayTimeout);\n  closeDelayTimeout = undefined;\n};\n\nconst setPopoverState = (state: boolean) => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n  if (state && (props.disabled || !hasContent.value)) return;\n  if (state && props.delay > 0 && (props.showOnHover || !useNativePopover)) {\n    openDelayTimeout = setTimeout(() => {\n      isOpen.value = true;\n      openDelayTimeout = undefined;\n    }, props.delay);\n  } else {\n    isOpen.value = state;\n  }\n};\n\nconst closeNow = () => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n  isOpen.value = false;\n};\n\nconst syncNativeSurface = () => {\n  const surface = floating.value;\n  if (!surface || !isMounted.value || !hasContent.value) return;\n  if (isOpen.value) surface.showPopover();\n  else surface.hidePopover();\n};\n\n// A surface hidden under the pointer does not reliably get a `mouseleave` -\n// WebKit keeps reporting the stale hover until the pointer moves again - so the\n// surface only counts while it is actually showing. Otherwise closing from\n// inside the popover (a close button, Escape) would immediately reopen it.\nconst surfaceEngaged = computed(() => Boolean(isOpen.value) && (floatingHovered.value || floatingFocused.value));\n\nconst isHovered = computed(() => {\n  if (!props.showOnHover || hoverLatchedOff.value) return false;\n  return props.disableInteractive\n    ? triggerHovered.value || triggerFocused.value\n    : triggerHovered.value || triggerFocused.value || surfaceEngaged.value;\n});\n\nwatch([triggerHovered, triggerFocused, floatingFocused], ([hovered, focused, floatingFocusedValue]) => {\n  if (!hovered && !focused && !floatingFocusedValue) hoverLatchedOff.value = false;\n});\n\n// A mouse click leaves the trigger focused after the pointer has moved on, so only\n// keyboard focus (`:focus-visible`) should hold a hover popover open.\nconst handleTriggerFocusIn = ({ target }: FocusEvent) => {\n  triggerFocused.value = !props.disabled && target instanceof HTMLElement && target.matches(\":focus-visible\");\n};\n\n// Tabbing from the trigger into the content blurs the trigger, so the content\n// itself must also be tracked or the popover would close mid-tab.\nconst handleFloatingFocusIn = ({ target }: FocusEvent) => {\n  floatingFocused.value = !props.disabled && target instanceof HTMLElement && target.matches(\":focus-visible\");\n};\n\nconst handleFloatingFocusOut = () => {\n  floatingFocused.value = false;\n};\n\nconst handleTriggerClick = () => {\n  if (props.showOnHover) {\n    if (props.disableClickOutsideToClose) return;\n    // A pending open still counts as showing, so clicking through it dismisses.\n    if (!isOpen.value && !openDelayTimeout && props.enableClickToggle) {\n      // The pointer never left, so no fresh hover event will clear the latch.\n      hoverLatchedOff.value = false;\n      setPopoverState(true);\n      return;\n    }\n    hoverLatchedOff.value = true;\n    closeNow();\n    return;\n  }\n  setPopoverState(openDelayTimeout ? false : !isOpen.value);\n};\n\nconst handleToggle = (event: Event) => {\n  const open = (event as ToggleEvent).newState === \"open\";\n  if (isOpen.value !== open) isOpen.value = open;\n};\n\nconst handleKeydown = (event: KeyboardEvent) => {\n  if (useNativePopover && popoverType.value === \"manual\" && event.key === \"Escape\" && isOpen.value) {\n    event.preventDefault();\n    event.stopPropagation();\n    setPopoverState(false);\n  }\n};\n\nconst FOCUSABLE_SELECTOR =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\nconst focusableWithin = (element: HTMLElement | null) =>\n  element ? Array.from(element.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) : [];\n\n// A teleported surface sits away from the trigger in the DOM, so Tab from the trigger would skip its content.\nconst bridgesKeyboardFocus = computed(\n  () => props.useTeleport && !useNativePopover && props.showOnHover && !props.disabled,\n);\n\nconst handleTriggerKeydown = (event: KeyboardEvent) => {\n  if (!bridgesKeyboardFocus.value || event.key !== \"Tab\" || event.shiftKey || !isOpen.value) return;\n  const [first] = focusableWithin(floating.value);\n  if (!first) return;\n  event.preventDefault();\n  // Set before focusing: the trigger's focusout would otherwise close the popover before this focus lands.\n  floatingFocused.value = true;\n  first.focus();\n};\n\nconst handleFloatingKeydown = (event: KeyboardEvent) => {\n  if (!bridgesKeyboardFocus.value) return;\n  const [trigger] = focusableWithin(triggerWrapper.value);\n  if (event.key === \"Escape\") {\n    event.preventDefault();\n    event.stopPropagation();\n    hoverLatchedOff.value = true;\n    closeNow();\n    trigger?.focus();\n    return;\n  }\n  if (event.key !== \"Tab\") return;\n  const items = focusableWithin(floating.value);\n  if (event.shiftKey && document.activeElement === items[0]) {\n    event.preventDefault();\n    trigger?.focus();\n  } else if (!event.shiftKey && document.activeElement === items[items.length - 1]) {\n    // Not prevented: focus moves on from the trigger, so leaving the popover forwards never traps the user.\n    hoverLatchedOff.value = true;\n    closeNow();\n    trigger?.focus();\n  }\n};\n\nwatch(isOpen, async (open) => {\n  if (props.showOnHover && props.enableGroupSync) syncHoverGroup(Boolean(open));\n  if (!useNativePopover) {\n    if (open) updateLegacyPosition();\n    return;\n  }\n  await nextTick();\n  syncNativeSurface();\n});\n\nwatch(isHovered, (hovered) => {\n  if (!props.showOnHover) return;\n  if (hovered) {\n    // Opening (or the pointer re-entered the trigger/popover): cancel any\n    // pending close so the bridge holds the popover open.\n    setPopoverState(true);\n    return;\n  }\n  // The pointer left both the trigger and the popover. Cancel any pending\n  // delayed open so the popover can't flash open after the pointer is gone.\n  clearOpenDelayTimeout();\n  if (props.closeDelay > 0) {\n    // Defer the close so the pointer can bridge the gap from the trigger to the\n    // popover. If it lands on either, `isHovered` flips back to true and the\n    // branch above cancels this timeout.\n    clearCloseDelayTimeout();\n    closeDelayTimeout = setTimeout(() => {\n      closeDelayTimeout = undefined;\n      if (!isHovered.value) setPopoverState(false);\n    }, props.closeDelay);\n  } else {\n    setPopoverState(false);\n  }\n});\n\nwatch(hasContent, (present) => {\n  if (!present) {\n    closeNow();\n  } else if (useNativePopover && isOpen.value) {\n    nextTick(syncNativeSurface);\n  }\n});\n\nonMounted(() => {\n  reference.value = triggerWrapper.value;\n  isMounted.value = true;\n  if (isOpen.value) nextTick(() => (useNativePopover ? syncNativeSurface() : updateLegacyPosition()));\n});\n\nonUnmounted(() => {\n  clearOpenDelayTimeout();\n  clearCloseDelayTimeout();\n});\n\nwatch(\n  () => props.disabled,\n  (disabled) => {\n    if (!disabled) {\n      if (isHovered.value) setPopoverState(true);\n      return;\n    }\n    if (triggerFocused.value) triggerFocused.value = false;\n    if (floatingFocused.value) floatingFocused.value = false;\n    setPopoverState(false);\n  },\n);\n</script>\n\n<template>\n  <div ref=\"root\" :style=\"rootStyle\" @keydown=\"handleKeydown\">\n    <div\n      ref=\"triggerWrapper\"\n      :style=\"triggerStyle\"\n      @click=\"handleTriggerClick\"\n      @focusin=\"handleTriggerFocusIn\"\n      @focusout=\"triggerFocused = false\"\n      @keydown=\"handleTriggerKeydown\"\n    >\n      <slot name=\"trigger\"> </slot>\n    </div>\n\n    <div\n      v-if=\"isMounted && useNativePopover && hasContent\"\n      ref=\"floating\"\n      class=\"pv-floating pv-floating-native\"\n      :popover=\"popoverType\"\n      :style=\"nativePopoverStyles\"\n      @toggle=\"handleToggle\"\n      @focusin=\"handleFloatingFocusIn\"\n      @focusout=\"handleFloatingFocusOut\"\n    >\n      <slot name=\"content\" v-if=\"!disabled\"></slot>\n    </div>\n\n    <Teleport v-else-if=\"hasContent\" :to=\"teleportLocation\" :disabled=\"!props.useTeleport || disabled\">\n      <div\n        ref=\"floating\"\n        class=\"pv-floating\"\n        v-show=\"isOpen\"\n        :style=\"legacyPopoverStyles\"\n        @focusin=\"handleFloatingFocusIn\"\n        @focusout=\"handleFloatingFocusOut\"\n        @keydown=\"handleFloatingKeydown\"\n      >\n        <slot name=\"content\"></slot>\n      </div>\n    </Teleport>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance } from \"vue\";\nimport { PvTooltipV2Props } from \"./types\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence.ts\";\n\nconst props = withDefaults(defineProps<PvTooltipV2Props>(), {\n  variant: \"dark\",\n  position: \"top-center\",\n  size: \"md\",\n  disableInteractive: false,\n  delay: 0,\n  showOnHover: true,\n});\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot: hasVueContent, hasNativeSlot: hasCustomElementContent } = useSlotPresence(\"content\", {\n  host: customElementHost,\n});\nconst hasContentSlot = computed(() => (customElementHost ? hasCustomElementContent.value : hasVueContent.value));\nconst hasTooltipContent = computed(() => !!props.description || hasContentSlot.value);\n</script>\n\n<template>\n  <PvPopoverV2 v-bind=\"$props\">\n    <template #trigger>\n      <slot name=\"trigger\">\n        <p>{{ label }}</p>\n      </slot>\n    </template>\n    <template v-if=\"hasTooltipContent\" #content>\n      <div\n        class=\"pv-tooltip-v2-content\"\n        role=\"tooltip\"\n        :data-variant=\"variant\"\n        :class=\"{ 'pv-tooltip-v2-content-small': size === 'sm' }\"\n      >\n        <slot name=\"content\">\n          {{ description }}\n        </slot>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance } from \"vue\";\nimport { PvTooltipV2Props } from \"./types\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence.ts\";\n\nconst props = withDefaults(defineProps<PvTooltipV2Props>(), {\n  variant: \"dark\",\n  position: \"top-center\",\n  size: \"md\",\n  disableInteractive: false,\n  delay: 0,\n  showOnHover: true,\n});\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot: hasVueContent, hasNativeSlot: hasCustomElementContent } = useSlotPresence(\"content\", {\n  host: customElementHost,\n});\nconst hasContentSlot = computed(() => (customElementHost ? hasCustomElementContent.value : hasVueContent.value));\nconst hasTooltipContent = computed(() => !!props.description || hasContentSlot.value);\n</script>\n\n<template>\n  <PvPopoverV2 v-bind=\"$props\">\n    <template #trigger>\n      <slot name=\"trigger\">\n        <p>{{ label }}</p>\n      </slot>\n    </template>\n    <template v-if=\"hasTooltipContent\" #content>\n      <div\n        class=\"pv-tooltip-v2-content\"\n        role=\"tooltip\"\n        :data-variant=\"variant\"\n        :class=\"{ 'pv-tooltip-v2-content-small': size === 'sm' }\"\n      >\n        <slot name=\"content\">\n          {{ description }}\n        </slot>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport { PvAlignmentPositions, PvIconSize, PvSize } from \"../baseProps\";\n\nconst props = withDefaults(\n  defineProps<{\n    icon: string;\n    disabled?: boolean;\n    size?: Extract<PvSize, \"xs\" | \"sm\" | \"md\" | \"lg\">;\n    tooltipText: string;\n    tooltipPosition?: PvAlignmentPositions;\n    /** When false, the button is hidden until a `.pv-label` ancestor is hovered (used by menu actions). */\n    alwaysShow?: boolean;\n  }>(),\n  {\n    disabled: false,\n    size: \"md\",\n    tooltipPosition: \"top-center\",\n    alwaysShow: true,\n  },\n);\n\nconst emit = defineEmits<{ click: [MouseEvent] }>();\n\nconst mapToIconSize: Record<string, PvIconSize> = {\n  xs: 12,\n  sm: undefined,\n  md: 20,\n  lg: 24,\n};\n\nconst handleClick = (event: MouseEvent) => {\n  if (!props.disabled) {\n    emit(\"click\", event);\n  }\n};\n</script>\n\n<template>\n  <PvTooltipV2 :position=\"tooltipPosition\" :disable-interactive=\"true\" :use-teleport=\"true\">\n    <template #trigger>\n      <button\n        type=\"button\"\n        class=\"pv-button-link-tertiary\"\n        :class=\"{ 'pv-action-button-reveal-on-hover': !alwaysShow }\"\n        style=\"--button-icon-only-padding: 0px\"\n        :aria-label=\"tooltipText\"\n        :disabled=\"disabled\"\n        @click.stop=\"handleClick\"\n      >\n        <PvIcon :name=\"icon\" :size=\"mapToIconSize[size]\" />\n      </button>\n    </template>\n    <template #content v-if=\"tooltipText\">\n      {{ tooltipText }}\n    </template>\n  </PvTooltipV2>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport { PvAlignmentPositions, PvIconSize, PvSize } from \"../baseProps\";\n\nconst props = withDefaults(\n  defineProps<{\n    icon: string;\n    disabled?: boolean;\n    size?: Extract<PvSize, \"xs\" | \"sm\" | \"md\" | \"lg\">;\n    tooltipText: string;\n    tooltipPosition?: PvAlignmentPositions;\n    /** When false, the button is hidden until a `.pv-label` ancestor is hovered (used by menu actions). */\n    alwaysShow?: boolean;\n  }>(),\n  {\n    disabled: false,\n    size: \"md\",\n    tooltipPosition: \"top-center\",\n    alwaysShow: true,\n  },\n);\n\nconst emit = defineEmits<{ click: [MouseEvent] }>();\n\nconst mapToIconSize: Record<string, PvIconSize> = {\n  xs: 12,\n  sm: undefined,\n  md: 20,\n  lg: 24,\n};\n\nconst handleClick = (event: MouseEvent) => {\n  if (!props.disabled) {\n    emit(\"click\", event);\n  }\n};\n</script>\n\n<template>\n  <PvTooltipV2 :position=\"tooltipPosition\" :disable-interactive=\"true\" :use-teleport=\"true\">\n    <template #trigger>\n      <button\n        type=\"button\"\n        class=\"pv-button-link-tertiary\"\n        :class=\"{ 'pv-action-button-reveal-on-hover': !alwaysShow }\"\n        style=\"--button-icon-only-padding: 0px\"\n        :aria-label=\"tooltipText\"\n        :disabled=\"disabled\"\n        @click.stop=\"handleClick\"\n      >\n        <PvIcon :name=\"icon\" :size=\"mapToIconSize[size]\" />\n      </button>\n    </template>\n    <template #content v-if=\"tooltipText\">\n      {{ tooltipText }}\n    </template>\n  </PvTooltipV2>\n</template>\n","import { onBeforeUnmount, onMounted, ref, watch, type Ref } from \"vue\";\n\ninterface Bounds {\n  devicePixelRatio: number;\n  height: number;\n  left: number;\n  top: number;\n  width: number;\n}\n\ninterface Pointer {\n  lastMoved: number;\n  x: number;\n  y: number;\n}\n\ninterface PointerCapabilities {\n  finePointer: boolean;\n  reducedMotion: boolean;\n}\n\ninterface BuddyBrowserRuntimeOptions {\n  onBoundsChange: (resized: boolean) => void;\n  shouldTrackPointer: (capabilities: PointerCapabilities) => boolean;\n}\n\nexport function useBuddyBrowserRuntime(\n  element: Ref<SVGSVGElement | undefined>,\n  { onBoundsChange, shouldTrackPointer }: BuddyBrowserRuntimeOptions,\n) {\n  const animationAvailable = ref(false);\n  const finePointer = ref(false);\n  const intersecting = ref(true);\n  const reducedMotion = ref(false);\n  const visible = ref(true);\n  const bounds: Bounds = { devicePixelRatio: 1, height: 0, left: 0, top: 0, width: 0 };\n  const pointer: Pointer = { lastMoved: -Infinity, x: 0, y: 0 };\n\n  let browserDocument: Document | undefined;\n  let browserWindow: Window | undefined;\n  let finePointerQuery: MediaQueryList | undefined;\n  let frameId: number | undefined;\n  let intersectionObserver: IntersectionObserver | undefined;\n  let pointerListening = false;\n  let reducedMotionQuery: MediaQueryList | undefined;\n  let resizeObserver: ResizeObserver | undefined;\n\n  function cancelFrame() {\n    const id = frameId;\n    frameId = undefined;\n    if (id !== undefined) browserWindow?.cancelAnimationFrame?.(id);\n  }\n\n  function requestFrame(callback: FrameRequestCallback) {\n    if (frameId !== undefined || !browserWindow?.requestAnimationFrame) return;\n    frameId = browserWindow.requestAnimationFrame((timestamp) => {\n      frameId = undefined;\n      callback(timestamp);\n    });\n  }\n\n  function updateBounds() {\n    if (!element.value) return;\n    const rect = element.value.getBoundingClientRect();\n    const devicePixelRatio = browserWindow?.devicePixelRatio || 1;\n    const resized = rect.width !== bounds.width || devicePixelRatio !== bounds.devicePixelRatio;\n    bounds.devicePixelRatio = devicePixelRatio;\n    bounds.height = rect.height;\n    bounds.left = rect.left;\n    bounds.top = rect.top;\n    bounds.width = rect.width;\n    onBoundsChange(resized);\n  }\n\n  function onFinePointerChange(event: MediaQueryListEvent) {\n    finePointer.value = event.matches;\n  }\n\n  function onPointerMove(event: PointerEvent) {\n    pointer.x = event.clientX;\n    pointer.y = event.clientY;\n    pointer.lastMoved = (browserWindow?.performance.now() ?? event.timeStamp) / 1000;\n  }\n\n  function onReducedMotionChange(event: MediaQueryListEvent) {\n    reducedMotion.value = event.matches;\n  }\n\n  function onVisibilityChange() {\n    visible.value = !browserDocument?.hidden;\n  }\n\n  function syncPointerListeners() {\n    const shouldListen = shouldTrackPointer({\n      finePointer: finePointer.value,\n      reducedMotion: reducedMotion.value,\n    });\n    if (!browserWindow || shouldListen === pointerListening) return;\n    pointerListening = shouldListen;\n    if (shouldListen) {\n      updateBounds();\n      browserWindow.addEventListener(\"pointermove\", onPointerMove, { passive: true });\n      browserWindow.addEventListener(\"scroll\", updateBounds, { capture: true, passive: true });\n    } else {\n      browserWindow.removeEventListener(\"pointermove\", onPointerMove);\n      browserWindow.removeEventListener(\"scroll\", updateBounds, true);\n    }\n  }\n\n  watch(\n    () =>\n      shouldTrackPointer({\n        finePointer: finePointer.value,\n        reducedMotion: reducedMotion.value,\n      }),\n    syncPointerListeners,\n    { flush: \"post\" },\n  );\n\n  onMounted(() => {\n    browserDocument = globalThis.document;\n    browserWindow = globalThis.window;\n    if (!browserDocument || !browserWindow) return;\n\n    animationAvailable.value = typeof browserWindow.requestAnimationFrame === \"function\";\n    visible.value = !browserDocument.hidden;\n    finePointerQuery = browserWindow.matchMedia?.(\"(hover: hover) and (pointer: fine)\");\n    reducedMotionQuery = browserWindow.matchMedia?.(\"(prefers-reduced-motion: reduce)\");\n    finePointer.value = finePointerQuery?.matches ?? false;\n    reducedMotion.value = reducedMotionQuery?.matches ?? false;\n\n    finePointerQuery?.addEventListener?.(\"change\", onFinePointerChange);\n    reducedMotionQuery?.addEventListener?.(\"change\", onReducedMotionChange);\n    browserDocument.addEventListener(\"visibilitychange\", onVisibilityChange);\n    browserWindow.addEventListener(\"resize\", updateBounds, { passive: true });\n\n    const IntersectionObserverConstructor = globalThis.IntersectionObserver;\n    if (IntersectionObserverConstructor && element.value) {\n      const observer = new IntersectionObserverConstructor((entries) => {\n        intersecting.value = entries[0]?.isIntersecting ?? true;\n      });\n      intersectionObserver = observer;\n      observer.observe(element.value);\n    }\n    const ResizeObserverConstructor = globalThis.ResizeObserver;\n    if (ResizeObserverConstructor && element.value) {\n      const observer = new ResizeObserverConstructor(updateBounds);\n      resizeObserver = observer;\n      observer.observe(element.value);\n    }\n\n    updateBounds();\n    syncPointerListeners();\n  });\n\n  onBeforeUnmount(() => {\n    cancelFrame();\n    resizeObserver?.disconnect();\n    intersectionObserver?.disconnect();\n    finePointerQuery?.removeEventListener?.(\"change\", onFinePointerChange);\n    reducedMotionQuery?.removeEventListener?.(\"change\", onReducedMotionChange);\n    browserDocument?.removeEventListener(\"visibilitychange\", onVisibilityChange);\n    browserWindow?.removeEventListener(\"pointermove\", onPointerMove);\n    browserWindow?.removeEventListener(\"resize\", updateBounds);\n    browserWindow?.removeEventListener(\"scroll\", updateBounds, true);\n  });\n\n  return {\n    animationAvailable,\n    bounds,\n    cancelFrame,\n    finePointer,\n    intersecting,\n    pointer,\n    reducedMotion,\n    requestFrame,\n    updateBounds,\n    visible,\n  };\n}\n","<script lang=\"ts\">\nconst GRAIN_FRAMES = 8;\nconst GRAIN_TILE = 256;\n\nconst noiseFrames: string[] = [];\nlet noiseGenerationScheduled = false;\nlet noiseUnavailable = false;\n\nfunction createNoiseFrame() {\n  const browserDocument = globalThis.document;\n  if (!browserDocument) return;\n  const canvas = browserDocument.createElement(\"canvas\");\n  canvas.width = canvas.height = GRAIN_TILE;\n  const context = canvas.getContext(\"2d\");\n  if (!context) return;\n  const image = context.createImageData(GRAIN_TILE, GRAIN_TILE);\n  for (let index = 0; index < image.data.length; index += 4) {\n    // Roughly gaussian deviation from mid-grey becomes a light or dark speck with matching alpha.\n    const deviation = (Math.random() + Math.random() + Math.random()) / 1.5 - 1;\n    const value = deviation > 0 ? 255 : 0;\n    image.data[index] = image.data[index + 1] = image.data[index + 2] = value;\n    // Light specks are a touch stronger than dark ones so the grain reads as texture, not dirt.\n    image.data[index + 3] = Math.abs(deviation) * (deviation > 0 ? 75 : 45);\n  }\n  context.putImageData(image, 0, 0);\n  return canvas.toDataURL();\n}\n\nfunction getFirstNoiseFrame() {\n  if (noiseFrames.length === 0 && !noiseUnavailable) {\n    const frame = createNoiseFrame();\n    if (frame) noiseFrames.push(frame);\n    else noiseUnavailable = true;\n  }\n  return noiseFrames[0];\n}\n\n/** Generates animated film frames one at a time without blocking mount or animation startup. */\nfunction prepareNoiseFrames() {\n  if (noiseGenerationScheduled || noiseUnavailable || noiseFrames.length >= GRAIN_FRAMES) return;\n  noiseGenerationScheduled = true;\n  const generate = () => {\n    noiseGenerationScheduled = false;\n    const frame = createNoiseFrame();\n    if (!frame) {\n      noiseUnavailable = true;\n      return;\n    }\n    noiseFrames.push(frame);\n    prepareNoiseFrames();\n  };\n  const browserWindow = globalThis.window;\n  if (!browserWindow) {\n    noiseGenerationScheduled = false;\n    return;\n  }\n  if (typeof browserWindow.requestIdleCallback === \"function\")\n    browserWindow.requestIdleCallback(generate, { timeout: 500 });\n  else browserWindow.setTimeout(generate, 0);\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId, watch } from \"vue\";\nimport type { AskTqBuddyEmote, AskTqBuddyProps } from \"./types\";\nimport { useBuddyBrowserRuntime } from \"./useBuddyBrowserRuntime\";\n\ninterface Pose {\n  bodyY: number;\n  glow: number;\n  gradientSpeed: number;\n  gx: number;\n  gy: number;\n  happy: number;\n  leftHeight: number;\n  leftWidth: number;\n  rightHeight: number;\n  rightWidth: number;\n  rotation: number;\n  scaleX: number;\n  scaleY: number;\n  sheen: number;\n  spread: number;\n}\n\ninterface FrameOffsets {\n  bodyY: number;\n  leftY: number;\n  rightY: number;\n  rotation: number;\n  scale: number;\n  scaleX: number;\n  scaleY: number;\n}\n\ninterface Blink {\n  duration: number;\n  side: \"both\" | \"left\" | \"right\";\n  start: number;\n}\n\n/** Body and eye geometry in mascot units, where the body is a 191-unit square. */\ninterface Shape {\n  bodyRadius: number;\n  eyeHeight: number;\n  eyeRadius: number;\n  eyeWidth: number;\n  homeX: number;\n  homeY: number;\n  spread: number;\n}\n\n/** SVG affine matrix `[a, b, c, d, e, f]`. */\ntype Matrix = readonly [number, number, number, number, number, number];\n\ninterface Box {\n  height: number;\n  width: number;\n  x: number;\n  y: number;\n}\n\nconst props = withDefaults(defineProps<AskTqBuddyProps>(), {\n  animated: false,\n  calm: false,\n  emote: \"idle\",\n  size: \"md\",\n  theme: \"default\",\n  variant: \"default\",\n});\n\nconst BODY_SIZE = 191;\nconst BODY_CENTER = BODY_SIZE / 2;\n// Every size is a multiple of 16px, so a 1/14 body-width gutter puts the body at exactly 7/8 of the\n// rendered width and lands its resting edges on whole device pixels instead of blurring across two.\nconst VIEWBOX_PADDING = BODY_SIZE / 14;\nconst VIEWBOX_SIZE = BODY_SIZE + VIEWBOX_PADDING * 2;\nconst VIEWBOX = `${-VIEWBOX_PADDING} ${-VIEWBOX_PADDING} ${VIEWBOX_SIZE} ${VIEWBOX_SIZE}`;\nconst MASK_BOUNDS = { height: 391, width: 391, x: -100, y: -100 };\n// Emote motion is authored against the default eye: 19x43, 73 apart, resting 16.5 right of center and 29 up.\nconst BASE_EYE_WIDTH = 19;\nconst BASE_EYE_HEIGHT = 43;\nconst BASE_SPREAD = 73;\nconst BASE_HOME_X = 16.5;\nconst BASE_HOME_Y = -29;\n// Solid and mono share the hand-drawn icon geometry (about 3x7px eyes on a 20px body).\nconst SOLID_SHAPE = { bodyRadius: 38, eyeHeight: 66, eyeRadius: 7, eyeWidth: 28, homeX: 14.5, homeY: -24, spread: 57 };\nconst SHAPES = {\n  default: { bodyRadius: 12, eyeHeight: 43, eyeRadius: 2.4, eyeWidth: 19, homeX: 16.5, homeY: -29, spread: 73 },\n  halloween: { bodyRadius: 48, eyeHeight: 30, eyeRadius: 2, eyeWidth: 34, homeX: 12, homeY: -26, spread: 74 },\n  mono: SOLID_SHAPE,\n  outline: { bodyRadius: 38, eyeHeight: 57, eyeRadius: 5, eyeWidth: 19, homeX: 9.5, homeY: -19.5, spread: 38 },\n  solid: SOLID_SHAPE,\n} satisfies Record<string, Shape>;\nconst OUTLINE_STROKE = 19;\nconst RING_STROKE = 3.5;\nconst RING_INSET = -8;\nconst RING_RADIUS_OFFSET = 7;\nconst SHEEN_STRENGTH = 0.6;\n// Fallbacks for the shared `--sheen-*` tokens (see `.pv-sheen`) when Pit Viper CSS isn't loaded.\n// Angle is in degrees, duration in seconds, width as a fraction of the body.\nconst SHEEN_DEFAULTS = { angle: 108, duration: 1.9, width: 0.33 };\nconst CANDLE_FLICKER = 0.6;\nconst EYE_GLOW = 0.6;\nconst GRAIN_SIZE = 64;\nconst GRAIN_FPS = 14;\n// Skip every other callback on displays above ~100Hz (120Hz renders at 60fps, 144Hz at 72fps); 60-90Hz renders every frame.\nconst MIN_FRAME_INTERVAL = 10;\nconst SPRING_POSITION_EPSILON = 0.0001;\nconst SPRING_VELOCITY_EPSILON = 0.001;\n// Control-point distance that makes a cubic Bezier approximate a quarter circle.\nconst KAPPA = 0.5522847498;\nconst REST: Pose = {\n  bodyY: 0,\n  glow: 0,\n  gradientSpeed: 0,\n  gx: BASE_HOME_X,\n  gy: BASE_HOME_Y,\n  happy: 0,\n  leftHeight: BASE_EYE_HEIGHT,\n  leftWidth: BASE_EYE_WIDTH,\n  rightHeight: BASE_EYE_HEIGHT,\n  rightWidth: BASE_EYE_WIDTH,\n  rotation: 0,\n  scaleX: 1,\n  scaleY: 1,\n  sheen: 0,\n  spread: BASE_SPREAD,\n};\nconst POSE_KEYS = Object.keys(REST) as (keyof Pose)[];\nconst DEFAULT_SPRING = [170, 0.58] as const;\nconst SPRINGS: Partial<Record<keyof Pose, readonly [number, number]>> = {\n  glow: [20, 1],\n  gradientSpeed: [5, 1],\n  gx: [340, 0.78],\n  gy: [340, 0.78],\n  happy: [220, 0.75],\n  sheen: [14, 1],\n};\n// Calm mode: seconds between beats (a blink or a glance), how long a glance holds, and motion speed factors.\nconst CALM_BEAT_SECONDS = [12, 18] as const;\nconst CALM_FIRST_BEAT_SECONDS = [6, 12] as const;\nconst CALM_GLANCE_HOLD_SECONDS = [2, 3.5] as const;\nconst CALM_IDLE_SPEED = 0.5;\nconst CALM_CURIOUS_SPEED = 0.75;\nconst BLINK_SECONDS = 0.17;\nconst STATIC_POSES: Record<AskTqBuddyEmote, Partial<Pose>> = {\n  boo: { gx: 0, gy: -26, leftHeight: 62, leftWidth: 30, rightHeight: 62, rightWidth: 30 },\n  confused: { gx: -4, gy: -27, leftHeight: 29, rightHeight: 48, rotation: -7 },\n  curious: { gy: -20, leftHeight: 50, leftWidth: 21, rightHeight: 50, rightWidth: 21 },\n  greeting: { gx: 0, gy: -20, happy: 1 },\n  happy: { gx: 0, gy: -20, happy: 1 },\n  idle: {},\n  listening: { glow: 1, gx: 0, gy: -14, leftHeight: 49, leftWidth: 20, rightHeight: 49, rightWidth: 20 },\n  sleeping: { gx: 2, gy: -6, leftHeight: 5, leftWidth: 22, rightHeight: 5, rightWidth: 22, scaleY: 0.985 },\n  talking: { gx: 6, gy: -24 },\n  thinking: { gx: -8, gy: -40, leftHeight: 33, rightHeight: 40, rotation: -3, sheen: 1 },\n  working: { gx: 0, gy: -16, leftHeight: 34, rightHeight: 34, sheen: 1 },\n};\n\nconst halloween = computed(() => props.theme === \"halloween\");\nconst silhouette = computed(() => props.variant === \"mono\" || props.variant === \"solid\");\nconst textured = computed(() => props.variant === \"default\");\nconst shape = computed<Shape>(() => (halloween.value ? SHAPES.halloween : SHAPES[props.variant]));\nconst grainOpacity = computed(() => (halloween.value ? 0.8 : 0.7));\nconst triangleStroke = computed(() => Math.max(0.01, shape.value.eyeRadius * 2));\nconst happyStroke = computed(() => (10 * shape.value.eyeWidth) / BASE_EYE_WIDTH);\n\nlet activeAnimated = props.animated;\nlet activeCalm = props.calm;\nlet activeEmote = props.emote;\nlet activeHalloween = props.theme === \"halloween\";\nlet activeTextured = props.variant === \"default\";\nlet activeVariant = props.variant;\nlet activeShape = activeHalloween ? SHAPES.halloween : SHAPES[activeVariant];\nlet activeRingStrength = activeHalloween ? 0.8 : 1;\n\nfunction syncRenderOptions() {\n  activeAnimated = props.animated;\n  activeCalm = props.calm;\n  activeEmote = props.emote;\n  activeHalloween = props.theme === \"halloween\";\n  activeTextured = props.variant === \"default\";\n  activeVariant = props.variant;\n  activeShape = activeHalloween ? SHAPES.halloween : SHAPES[activeVariant];\n  activeRingStrength = activeHalloween ? 0.8 : 1;\n}\n\nconst svgRef = ref<SVGSVGElement>();\nconst bodyRef = ref<SVGPathElement>();\nconst clipRef = ref<SVGPathElement>();\nconst gradientRef = ref<SVGLinearGradientElement>();\nconst leftEyeRef = ref<SVGRectElement | SVGPathElement>();\nconst rightEyeRef = ref<SVGRectElement | SVGPathElement>();\nconst leftHappyRef = ref<SVGPathElement>();\nconst rightHappyRef = ref<SVGPathElement>();\nconst ringRef = ref<SVGPathElement>();\nconst sheenRef = ref<SVGRectElement>();\nconst candleRef = ref<SVGRectElement>();\nconst litRef = ref<SVGGElement>();\nconst grainRef = ref<SVGRectElement>();\nconst noiseRef = ref<SVGImageElement>();\n\nconst browser = useBuddyBrowserRuntime(svgRef, {\n  onBoundsChange: (resized) => {\n    if (resized && isStatic()) renderStaticPose();\n  },\n  shouldTrackPointer: ({ finePointer, reducedMotion }) =>\n    props.animated && props.emote === \"curious\" && finePointer && !reducedMotion,\n});\nconst { bounds, pointer } = browser;\n\nconst attributeCache = new WeakMap<Element, Record<string, string | null>>();\n\nfunction attributesFor(element: Element) {\n  let attributes = attributeCache.get(element);\n  if (!attributes) {\n    attributes = Object.create(null) as Record<string, string | null>;\n    attributeCache.set(element, attributes);\n  }\n  return attributes;\n}\n\nfunction setAttribute(element: Element, name: string, value: string) {\n  const attributes = attributesFor(element);\n  if (attributes[name] === value) return;\n  element.setAttribute(name, value);\n  attributes[name] = value;\n}\n\nfunction removeAttribute(element: Element, name: string) {\n  const attributes = attributesFor(element);\n  if (attributes[name] === null) return;\n  if (element.hasAttribute(name)) element.removeAttribute(name);\n  attributes[name] = null;\n}\n\nfunction setOpacity(element: SVGElement, value: string) {\n  const attributes = attributesFor(element);\n  if (attributes[\"style.opacity\"] === value) return;\n  element.style.opacity = value;\n  attributes[\"style.opacity\"] = value;\n}\n\nfunction removeOpacity(element: SVGElement) {\n  const attributes = attributesFor(element);\n  if (attributes[\"style.opacity\"] === null) return;\n  element.style.removeProperty(\"opacity\");\n  attributes[\"style.opacity\"] = null;\n}\n\nconst id = `pv-ask-tq-buddy-${useId().replaceAll(\":\", \"\")}`;\nconst gradientId = `${id}-gradient`;\nconst sheenId = `${id}-sheen`;\nconst clipId = `${id}-clip`;\nconst noiseId = `${id}-noise`;\nconst glowId = `${id}-glow`;\nconst candleId = `${id}-candle`;\nconst maskId = `${id}-mask`;\nconst eyesId = `${id}-eyes`;\n\nconst current: Pose = { ...REST };\nconst velocity = Object.fromEntries(Object.keys(REST).map((key) => [key, 0])) as Record<keyof Pose, number>;\nconst glancing = { next: 0.8, x: 0, y: 0 };\nlet blinks: Blink[] = [];\nlet elapsed = 0;\nlet gradientPhase = 0;\nlet sheenTime = 0;\nlet sheen = { ...SHEEN_DEFAULTS };\nlet nextGrain = 0;\nlet grainImage: SVGImageElement | undefined;\nlet lastFrame = 0;\nlet lastRender = -Infinity;\nlet nextBlink = firstBlinkDelay();\n// Springs run at this fraction of their normal speed this frame; calm mode lowers it.\nlet motionSpeed = 1;\nlet happyEyesVisible = false;\nlet ringVisible = false;\nlet sheenVisible = false;\n\nfunction randomBetween(min: number, max: number) {\n  return min + Math.random() * (max - min);\n}\n\nfunction firstBlinkDelay() {\n  return props.calm ? randomBetween(...CALM_FIRST_BEAT_SECONDS) : randomBetween(0.8, 3);\n}\n\nfunction clamp(value: number, min: number, max: number) {\n  return Math.max(min, Math.min(max, value));\n}\n\nfunction easeOutBack(progress: number) {\n  const overshoot = 1.9;\n  return 1 + (overshoot + 1) * Math.pow(progress - 1, 3) + overshoot * Math.pow(progress - 1, 2);\n}\n\n/** Viewbox units covered by one device pixel, or 0 before layout is known. */\nfunction unitsPerDevicePixel() {\n  return bounds.width > 0 ? VIEWBOX_SIZE / (bounds.width * bounds.devicePixelRatio) : 0;\n}\n\n/**\n * Browsers paint an SVG from its top-left corner rounded to a whole device pixel, at its exact scale, so the\n * device pixel grid starts at the viewbox origin wherever the buddy lands in the page layout.\n */\nfunction snapToDevicePixel(value: number, unit: number) {\n  return Math.round((value + VIEWBOX_PADDING) / unit) * unit - VIEWBOX_PADDING;\n}\n\n/** Snaps a span's edges to the device pixel grid so a resting pose renders crisp instead of half-covered. */\nfunction snapSpan(start: number, length: number, unit: number) {\n  const snappedStart = snapToDevicePixel(start, unit);\n  const snappedLength = Math.max(unit, Math.round(length / unit) * unit);\n  return { length: snappedLength, start: snappedStart };\n}\n\n/** Snaps a box to the device pixel grid of `unit` viewbox units per pixel, or leaves it as is when 0. */\nfunction snapBox(box: Box, unit: number): Box {\n  if (unit <= 0) return box;\n  const horizontal = snapSpan(box.x, box.width, unit);\n  const vertical = snapSpan(box.y, box.height, unit);\n  return { height: vertical.length, width: horizontal.length, x: horizontal.start, y: vertical.start };\n}\n\nfunction insetBox({ height, width, x, y }: Box, inset: number): Box {\n  return { height: height - inset * 2, width: width - inset * 2, x: x + inset, y: y + inset };\n}\n\n/** Tilt about the body center, then squash and stretch from the bottom edge, then hop. */\nfunction bodyMatrix(rotation: number, scaleX: number, scaleY: number, bodyY: number): Matrix {\n  const radians = (rotation * Math.PI) / 180;\n  const cos = Math.cos(radians);\n  const sin = Math.sin(radians);\n  const rotate: Matrix = [\n    cos,\n    sin,\n    -sin,\n    cos,\n    BODY_CENTER - cos * BODY_CENTER + sin * BODY_CENTER,\n    BODY_CENTER - sin * BODY_CENTER - cos * BODY_CENTER,\n  ];\n  const scale: Matrix = [scaleX, 0, 0, scaleY, BODY_CENTER * (1 - scaleX), BODY_SIZE * (1 - scaleY)];\n  const [a, b, c, d, e, f] = multiply(rotate, scale);\n  return [a, b, c, d, e, f + bodyY];\n}\n\nfunction multiply([a, b, c, d, e, f]: Matrix, [g, h, i, j, k, l]: Matrix): Matrix {\n  return [a * g + c * h, b * g + d * h, a * i + c * j, b * i + d * j, a * k + c * l + e, b * k + d * l + f];\n}\n\nfunction point([a, b, c, d, e, f]: Matrix, x: number, y: number) {\n  return `${(a * x + c * y + e).toFixed(3)} ${(b * x + d * y + f).toFixed(3)}`;\n}\n\nfunction matrixAttribute([a, b, c, d, e, f]: Matrix) {\n  return `matrix(${a.toFixed(5)} ${b.toFixed(5)} ${c.toFixed(5)} ${d.toFixed(5)} ${e.toFixed(3)} ${f.toFixed(3)})`;\n}\n\n/** A rounded rectangle mapped through `matrix`. Beziers are affine invariant, so the result is exact. */\nfunction roundedRectPath(matrix: Matrix, { height, width, x: left, y: top }: Box, radius: number) {\n  const right = left + width;\n  const bottom = top + height;\n  const r = clamp(radius, 0, Math.min(width, height) / 2);\n  const k = r * (1 - KAPPA);\n  const p = (x: number, y: number) => point(matrix, x, y);\n  return [\n    `M${p(left + r, top)}`,\n    `L${p(right - r, top)}`,\n    `C${p(right - k, top)} ${p(right, top + k)} ${p(right, top + r)}`,\n    `L${p(right, bottom - r)}`,\n    `C${p(right, bottom - k)} ${p(right - k, bottom)} ${p(right - r, bottom)}`,\n    `L${p(left + r, bottom)}`,\n    `C${p(left + k, bottom)} ${p(left, bottom - k)} ${p(left, bottom - r)}`,\n    `L${p(left, top + r)}`,\n    `C${p(left, top + k)} ${p(left + k, top)} ${p(left + r, top)}Z`,\n  ].join(\" \");\n}\n\nfunction createOffsets(): FrameOffsets {\n  return {\n    bodyY: 0,\n    leftY: 0,\n    rightY: 0,\n    rotation: 0,\n    scale: 1,\n    scaleX: 0,\n    scaleY: 0,\n  };\n}\n\nconst frameTarget: Pose = { ...REST };\nconst frameOffsets = createOffsets();\n\nfunction resetOffsets() {\n  frameOffsets.bodyY = 0;\n  frameOffsets.leftY = 0;\n  frameOffsets.rightY = 0;\n  frameOffsets.rotation = 0;\n  frameOffsets.scale = 1;\n  frameOffsets.scaleX = 0;\n  frameOffsets.scaleY = 0;\n}\n\nfunction blink(side: Blink[\"side\"] = \"both\", duration = BLINK_SECONDS, delay = 0) {\n  blinks.push({ duration, side, start: elapsed + delay });\n}\n\nfunction autoBlink(min: number, max: number) {\n  if (elapsed <= nextBlink) return;\n  if (activeCalm) {\n    blink(\"both\", BLINK_SECONDS / motionSpeed);\n    nextBlink = elapsed + randomBetween(...CALM_BEAT_SECONDS);\n    return;\n  }\n  blink();\n  if (Math.random() < 0.22) blink(\"both\", BLINK_SECONDS, 0.28);\n  nextBlink = elapsed + randomBetween(min, max);\n}\n\n/** Kicks the springs so the buddy perks up, as if reacting to a keystroke. */\nfunction poke(amount: number) {\n  velocity.scaleY += 0.9 * amount;\n  velocity.leftHeight += 150 * amount;\n  velocity.rightHeight += 150 * amount;\n}\n\n/** One slow beat every 12-18 seconds: either a blink, or a small glance that drifts back home. */\nfunction applyCalmIdle(target: Pose) {\n  motionSpeed = CALM_IDLE_SPEED;\n  if (elapsed > glancing.next) {\n    glancing.x = 0;\n    glancing.y = 0;\n    glancing.next = Infinity;\n  }\n  if (elapsed > nextBlink) {\n    if (Math.random() < 0.5) {\n      blink(\"both\", BLINK_SECONDS / motionSpeed);\n    } else {\n      glancing.x = randomBetween(-10, 10);\n      glancing.y = randomBetween(-6, 5);\n      glancing.next = elapsed + randomBetween(...CALM_GLANCE_HOLD_SECONDS);\n    }\n    nextBlink = elapsed + randomBetween(...CALM_BEAT_SECONDS);\n  }\n  target.gx += glancing.x;\n  target.gy += glancing.y;\n}\n\nfunction applyIdle(target: Pose, offsets: FrameOffsets) {\n  if (activeCalm) {\n    applyCalmIdle(target);\n    return;\n  }\n  offsets.scaleY += 0.012 * Math.sin(elapsed * 2.1);\n  if (elapsed > glancing.next) {\n    const returnHome = Math.random() < 0.35;\n    glancing.x = returnHome ? 0 : randomBetween(-14, 14);\n    glancing.y = returnHome ? 0 : randomBetween(-9, 7);\n    glancing.next = elapsed + randomBetween(1.6, 3.8);\n  }\n  target.gx += glancing.x;\n  target.gy += glancing.y;\n  autoBlink(2.5, 5);\n}\n\nfunction applyCurious(target: Pose, offsets: FrameOffsets, now: number) {\n  if (!browser.finePointer.value || now - pointer.lastMoved > 2.5) {\n    applyIdle(target, offsets);\n    return;\n  }\n\n  const width = Math.max(bounds.width, 80);\n  const dx = (pointer.x - (bounds.left + bounds.width / 2)) / width;\n  const dy = (pointer.y - (bounds.top + bounds.height / 2)) / width;\n  target.gx = 36 * Math.tanh(dx * 1.3);\n  target.gy = 46 * Math.tanh(dy * 1.3);\n  target.rotation = 5 * Math.tanh(dx * 0.8);\n  if (Math.abs(dx) < 0.3 && Math.abs(dy) < 0.3) {\n    target.leftHeight = target.rightHeight = 50;\n    target.leftWidth = target.rightWidth = 21;\n  }\n  if (activeCalm) motionSpeed = CALM_CURIOUS_SPEED;\n  else offsets.scaleY += 0.01 * Math.sin(elapsed * 2.1);\n  autoBlink(2.5, 5);\n}\n\nfunction applyEmote(emote: AskTqBuddyEmote, target: Pose, offsets: FrameOffsets, dt: number, now: number) {\n  switch (emote) {\n    case \"curious\":\n      applyCurious(target, offsets, now);\n      break;\n    case \"greeting\": {\n      const period = 4.4;\n      const cycle = elapsed % period;\n      if (cycle < 0.75) offsets.scale = Math.max(0, easeOutBack(cycle / 0.75));\n      if (cycle > period - 0.35) offsets.scale = 1 - Math.pow((cycle - (period - 0.35)) / 0.35, 2);\n      if (cycle < 0.9) {\n        target.gx = 0;\n        target.gy = -20;\n      } else if (cycle < 1.45) {\n        target.gx = -30;\n        target.gy = -26;\n      } else if (cycle < 2) {\n        target.gx = 32;\n        target.gy = -26;\n      } else {\n        target.gx = 4;\n        target.gy = -20;\n      }\n      if (cycle > 2.15 && cycle - dt <= 2.15) blink(\"right\", 0.38);\n      if (cycle > 2.6 && cycle < 3.5) {\n        target.happy = 1;\n        offsets.rotation += 4 * Math.sin((cycle - 2.6) * 14) * (1 - (cycle - 2.6) / 0.9);\n      }\n      break;\n    }\n    case \"listening\":\n      Object.assign(target, STATIC_POSES.listening, {\n        rotation: 3 * Math.sin(elapsed * 0.8),\n        scaleX: 1.02,\n        scaleY: 1.02,\n      });\n      offsets.bodyY -= 2 * Math.sin(elapsed * 2.4);\n      if (Math.random() < dt * 5) poke(0.6);\n      autoBlink(2.5, 4.5);\n      break;\n    case \"thinking\":\n      Object.assign(target, STATIC_POSES.thinking, {\n        gradientSpeed: 80,\n        gx: -16 + 16 * Math.sin(elapsed * 1.3),\n        gy: -42 + 3 * Math.sin(elapsed * 2.1),\n      });\n      offsets.scaleY += 0.008 * Math.sin(elapsed * 2.6);\n      autoBlink(3, 6);\n      break;\n    case \"working\": {\n      Object.assign(target, STATIC_POSES.working, { gradientSpeed: 200 });\n      const wave = elapsed * 6.8;\n      const left = Math.max(0, Math.sin(wave));\n      const right = Math.max(0, Math.sin(wave - Math.PI));\n      offsets.leftY -= 13 * left;\n      offsets.rightY -= 13 * right;\n      target.leftHeight += 6 * left - 4 * (1 - left);\n      target.rightHeight += 6 * right - 4 * (1 - right);\n      break;\n    }\n    case \"talking\": {\n      Object.assign(target, STATIC_POSES.talking);\n      const envelope = clamp(Math.sin(elapsed * 1.15) + 0.6, 0, 1);\n      const syllable = Math.abs(Math.sin(elapsed * 9.5)) * (0.65 + 0.35 * Math.sin(elapsed * 3.3));\n      const speech = syllable * envelope;\n      offsets.leftY -= 5 * speech;\n      offsets.rightY -= 5 * speech;\n      target.leftHeight += 7 * speech;\n      target.rightHeight += 7 * speech;\n      offsets.scaleY += 0.022 * speech;\n      offsets.scaleX -= 0.012 * speech;\n      autoBlink(2, 4);\n      break;\n    }\n    case \"happy\": {\n      Object.assign(target, STATIC_POSES.happy);\n      const cycle = elapsed % 1.9;\n      if (cycle < 0.9) {\n        const progress = (cycle % 0.45) / 0.45;\n        const height = Math.sin(Math.PI * progress);\n        const landing = Math.max(0, 1 - Math.min(progress, 1 - progress) / 0.12);\n        offsets.bodyY -= 22 * height;\n        offsets.scaleY += 0.05 * height - 0.07 * landing;\n        offsets.scaleX += -0.03 * height + 0.06 * landing;\n        offsets.rotation += 5 * Math.sin(cycle * 7);\n      }\n      break;\n    }\n    case \"confused\": {\n      Object.assign(target, STATIC_POSES.confused, {\n        gx: -4 + 13 * Math.sign(Math.sin(elapsed * 0.9 + 0.4)),\n      });\n      const cycle = elapsed % 3.4;\n      offsets.rotation += 6 * Math.sin(cycle * 28) * Math.exp(-cycle * 5);\n      offsets.bodyY -= 3 * Math.exp(-cycle * 6);\n      autoBlink(2.5, 4);\n      break;\n    }\n    case \"sleeping\":\n      Object.assign(target, STATIC_POSES.sleeping);\n      offsets.scaleY += 0.028 * Math.sin(elapsed * 1.4);\n      break;\n    case \"boo\": {\n      // Hides and peeks around, then jumps out.\n      const cycle = elapsed % 3.2;\n      if (cycle < 1.1) {\n        Object.assign(target, {\n          gx: 18 * Math.sin(cycle * 5),\n          gy: -10,\n          leftHeight: 22,\n          rightHeight: 22,\n          scaleX: 1.05,\n          scaleY: 0.86,\n        });\n      } else {\n        const progress = cycle - 1.1;\n        Object.assign(target, STATIC_POSES.boo);\n        offsets.scale = 1 + 0.22 * Math.exp(-progress * 5) * Math.cos(progress * 18);\n        offsets.rotation += 7 * Math.sin(progress * 34) * Math.exp(-progress * 4);\n        offsets.bodyY -= 14 * Math.exp(-progress * 6);\n      }\n      break;\n    }\n    case \"idle\":\n    default:\n      applyIdle(target, offsets);\n  }\n}\n\nfunction render(pose: Pose, offsets: FrameOffsets = createOffsets(), pixelSnap = false) {\n  if (\n    !bodyRef.value ||\n    !clipRef.value ||\n    !gradientRef.value ||\n    !leftEyeRef.value ||\n    !rightEyeRef.value ||\n    !leftHappyRef.value ||\n    !rightHappyRef.value\n  ) {\n    return;\n  }\n\n  const scale = offsets.scale;\n  const scaleX = (pose.scaleX + offsets.scaleX) * scale;\n  const scaleY = (pose.scaleY + offsets.scaleY) * scale;\n  const bodyY = pose.bodyY + offsets.bodyY;\n  const rotation = pose.rotation + offsets.rotation;\n  const unit = unitsPerDevicePixel();\n  // Moving frames keep sub-pixel precision so motion stays smooth; only an untransformed resting body is snapped.\n  const snapUnit = pixelSnap && rotation === 0 && scaleX === 1 && scaleY === 1 && bodyY === 0 ? unit : 0;\n\n  // Firefox rasterizes an element whose transform changes every frame as a texture and rotates it without\n  // edge anti-aliasing, which stair-steps the body outline. Baking the motion into path geometry (and into\n  // per-element matrices for the eyes, sheen, grain, and gradient) keeps every edge vector-rendered and smooth.\n  const matrix = bodyMatrix(rotation, scaleX, scaleY, bodyY);\n  const transform = matrixAttribute(matrix);\n  const { bodyRadius, eyeHeight, eyeRadius, eyeWidth, homeX, homeY, spread: shapeSpread } = activeShape;\n  const body = snapBox({ height: BODY_SIZE, width: BODY_SIZE, x: 0, y: 0 }, snapUnit);\n  const bodyPath = roundedRectPath(matrix, body, bodyRadius);\n  if (activeTextured) setAttribute(clipRef.value, \"d\", bodyPath);\n  if (activeVariant === \"outline\") {\n    // The outline is stroked inside the body bounds; at rest it is a whole number of device pixels thick.\n    const stroke = snapUnit > 0 ? Math.max(unit, Math.round(OUTLINE_STROKE / unit) * unit) : OUTLINE_STROKE;\n    setAttribute(\n      bodyRef.value,\n      \"d\",\n      roundedRectPath(matrix, insetBox(body, stroke / 2), Math.max(0, bodyRadius - stroke / 2)),\n    );\n    setAttribute(bodyRef.value, \"stroke-width\", stroke.toFixed(3));\n  } else {\n    setAttribute(bodyRef.value, \"d\", bodyPath);\n  }\n\n  let leftBlink = 1;\n  let rightBlink = 1;\n  let activeBlinks = 0;\n  for (const entry of blinks) {\n    const progress = (elapsed - entry.start) / entry.duration;\n    if (progress >= 0 && progress <= 1) {\n      const amount = 1 - 0.94 * Math.sin(Math.PI * progress);\n      if (entry.side !== \"right\") leftBlink = Math.min(leftBlink, amount);\n      if (entry.side !== \"left\") rightBlink = Math.min(rightBlink, amount);\n    }\n    if (progress <= 1) blinks[activeBlinks++] = entry;\n  }\n  blinks.length = activeBlinks;\n\n  const happy = clamp(pose.happy, 0, 1);\n  const widthScale = eyeWidth / BASE_EYE_WIDTH;\n  const heightScale = eyeHeight / BASE_EYE_HEIGHT;\n  const spread = (shapeSpread * pose.spread) / BASE_SPREAD;\n  const gx = pose.gx + homeX - BASE_HOME_X;\n  const gy = pose.gy + homeY - BASE_HOME_Y;\n  const leftX = BODY_CENTER + gx - spread / 2;\n  const rightX = BODY_CENTER + gx + spread / 2;\n  const leftY = BODY_CENTER + gy + offsets.leftY;\n  const rightY = BODY_CENTER + gy + offsets.rightY;\n  const leftWidth = pose.leftWidth * widthScale * (1 + (1 - leftBlink) * 0.25);\n  const rightWidth = pose.rightWidth * widthScale * (1 + (1 - rightBlink) * 0.25);\n  const leftHeight = pose.leftHeight * heightScale * leftBlink * (1 - happy * 0.92);\n  const rightHeight = pose.rightHeight * heightScale * rightBlink * (1 - happy * 0.92);\n\n  if (activeHalloween) {\n    renderTriangleEye(leftEyeRef.value, matrix, leftX, leftY, leftWidth, leftHeight);\n    renderTriangleEye(rightEyeRef.value, matrix, rightX, rightY, rightWidth, rightHeight);\n    // Layered sines read as an organic candle flame.\n    const flame =\n      0.5 +\n      0.5 *\n        (0.5 * Math.sin(elapsed * 11.3) + 0.3 * Math.sin(elapsed * 17.9 + 1.3) + 0.2 * Math.sin(elapsed * 29.1 + 2.1));\n    // Flat icons keep solid eyes; a flickering opacity would leave mono's cutout half see-through.\n    if (activeTextured && litRef.value) setOpacity(litRef.value, (1 - CANDLE_FLICKER * 0.35 * flame).toFixed(3));\n    else if (litRef.value) removeOpacity(litRef.value);\n    if (candleRef.value) {\n      setOpacity(candleRef.value, (0.85 - CANDLE_FLICKER * 0.55 * flame).toFixed(3));\n      setAttribute(candleRef.value, \"transform\", transform);\n    }\n  } else {\n    renderEye(leftEyeRef.value, transform, leftX, leftY, leftWidth, leftHeight, eyeRadius, snapUnit);\n    renderEye(rightEyeRef.value, transform, rightX, rightY, rightWidth, rightHeight, eyeRadius, snapUnit);\n  }\n\n  const happyOpacity = happy.toFixed(3);\n  if (happyOpacity !== \"0.000\" || happyEyesVisible) {\n    renderHappyEye(leftHappyRef.value, matrix, leftX, leftY, widthScale, happyOpacity, happy);\n    renderHappyEye(rightHappyRef.value, matrix, rightX, rightY, widthScale, happyOpacity, happy);\n    happyEyesVisible = happyOpacity !== \"0.000\";\n  }\n\n  if (activeTextured) {\n    setAttribute(\n      gradientRef.value,\n      \"gradientTransform\",\n      `${transform} rotate(${gradientPhase.toFixed(2)} ${BODY_CENTER} ${BODY_CENTER})`,\n    );\n  }\n\n  if (sheenRef.value) {\n    const sheenOpacity = (clamp(pose.sheen, 0, 1) * SHEEN_STRENGTH).toFixed(3);\n    if (sheenOpacity !== \"0.000\" || sheenVisible) {\n      setAttribute(sheenRef.value, \"opacity\", sheenOpacity);\n      sheenVisible = sheenOpacity !== \"0.000\";\n      if (sheenVisible) {\n        const width = sheen.width * BODY_SIZE;\n        const start = -46 - width;\n        const progress = (sheenTime % sheen.duration) / sheen.duration;\n        setAttribute(sheenRef.value, \"width\", width.toFixed(1));\n        setAttribute(\n          sheenRef.value,\n          \"transform\",\n          `${transform} translate(${(start + progress * (310 - start)).toFixed(1)} 0) skewX(${90 - sheen.angle})`,\n        );\n      }\n    }\n  }\n\n  if (ringRef.value && (pose.glow > 0 || ringVisible)) {\n    const glowOpacity =\n      pose.glow > 0\n        ? (clamp(pose.glow, 0, 1) * activeRingStrength * (0.4 + 0.3 * Math.sin(elapsed * 3.2))).toFixed(3)\n        : \"0.000\";\n    setAttribute(ringRef.value, \"opacity\", glowOpacity);\n    ringVisible = glowOpacity !== \"0.000\";\n    if (ringVisible) {\n      setAttribute(\n        ringRef.value,\n        \"d\",\n        roundedRectPath(matrix, insetBox(body, RING_INSET), bodyRadius + RING_RADIUS_OFFSET),\n      );\n      // At small sizes the ring would thin below one device pixel and shimmer as it pulses, so keep a pixel floor.\n      setAttribute(ringRef.value, \"stroke-width\", Math.max(RING_STROKE, unit).toFixed(3));\n    }\n  }\n\n  if (activeTextured) renderGrain(transform, !isStatic());\n}\n\nfunction renderEye(\n  element: SVGRectElement | SVGPathElement,\n  transform: string,\n  centerX: number,\n  centerY: number,\n  width: number,\n  height: number,\n  radius: number,\n  snapUnit: number,\n) {\n  const minWidth = Math.max(0.5, width);\n  const minHeight = Math.max(0.5, height);\n  const box = snapBox(\n    { height: minHeight, width: minWidth, x: centerX - minWidth / 2, y: centerY - minHeight / 2 },\n    snapUnit,\n  );\n  setAttribute(element, \"x\", box.x.toFixed(3));\n  setAttribute(element, \"y\", box.y.toFixed(3));\n  setAttribute(element, \"width\", box.width.toFixed(3));\n  setAttribute(element, \"height\", box.height.toFixed(3));\n  setAttribute(element, \"rx\", Math.min(radius, box.width / 2, box.height / 2).toFixed(3));\n  setAttribute(element, \"transform\", transform);\n}\n\n/** A jack-o'-lantern eye: an upward triangle that blinking squashes flat. Its stroke rounds the corners. */\nfunction renderTriangleEye(\n  element: SVGRectElement | SVGPathElement,\n  matrix: Matrix,\n  centerX: number,\n  centerY: number,\n  width: number,\n  height: number,\n) {\n  const halfWidth = Math.max(0.5, width) / 2;\n  const halfHeight = Math.max(0.5, height) / 2;\n  setAttribute(\n    element,\n    \"d\",\n    `M${point(matrix, centerX - halfWidth, centerY + halfHeight)} L${point(matrix, centerX + halfWidth, centerY + halfHeight)} L${point(matrix, centerX, centerY - halfHeight)}Z`,\n  );\n}\n\nfunction renderHappyEye(\n  element: SVGPathElement,\n  matrix: Matrix,\n  centerX: number,\n  centerY: number,\n  widthScale: number,\n  opacity: string,\n  happy: number,\n) {\n  setAttribute(element, \"opacity\", opacity);\n  if (opacity === \"0.000\") return;\n  // The arc rises into place as it fades in.\n  const drop = 6 * (1 - happy);\n  const halfWidth = 14 * widthScale;\n  setAttribute(\n    element,\n    \"d\",\n    `M${point(matrix, centerX - halfWidth, centerY + 7 + drop)} Q${point(matrix, centerX, centerY - 13 + drop)} ${point(matrix, centerX + halfWidth, centerY + 7 + drop)}`,\n  );\n}\n\nfunction renderGrain(transform: string, animating: boolean) {\n  if (!grainRef.value || !noiseRef.value) return;\n  const firstFrame = getFirstNoiseFrame();\n  if (!firstFrame) {\n    setAttribute(grainRef.value, \"display\", \"none\");\n    return;\n  }\n  removeAttribute(grainRef.value, \"display\");\n  const imageChanged = grainImage !== noiseRef.value;\n  if (imageChanged) grainImage = noiseRef.value;\n  if (imageChanged || (animating && elapsed >= nextGrain)) {\n    nextGrain = elapsed + 1 / GRAIN_FPS;\n    const index = animating ? Math.floor(Math.random() * noiseFrames.length) : 0;\n    setAttribute(noiseRef.value, \"href\", noiseFrames[index] ?? firstFrame);\n    grainRef.value.dataset.offsetX = animating ? randomBetween(0, GRAIN_SIZE).toFixed(1) : \"0\";\n    grainRef.value.dataset.offsetY = animating ? randomBetween(0, GRAIN_SIZE).toFixed(1) : \"0\";\n  }\n  setAttribute(\n    grainRef.value,\n    \"transform\",\n    `${transform} translate(${grainRef.value.dataset.offsetX} ${grainRef.value.dataset.offsetY})`,\n  );\n}\n\n// WebKit ignores CSS masks on SVG children, so `.pv-sheen` can't be applied directly.\n// The sweep runs in JS instead, timed and shaped by the same tokens.\nfunction readSheenTokens() {\n  if (!svgRef.value) return;\n  const style = svgRef.value.ownerDocument.defaultView?.getComputedStyle(svgRef.value);\n  if (!style) return;\n  const durationValue = style.getPropertyValue(\"--sheen-duration\").trim();\n  const duration = Number.parseFloat(durationValue) / (durationValue.endsWith(\"ms\") ? 1000 : 1);\n  const angle = Number.parseFloat(style.getPropertyValue(\"--sheen-angle\"));\n  const width = Number.parseFloat(style.getPropertyValue(\"--sheen-width\"));\n  sheen = {\n    angle: Number.isFinite(angle) ? angle : SHEEN_DEFAULTS.angle,\n    duration: duration > 0 ? duration : SHEEN_DEFAULTS.duration,\n    width: width > 0 ? width / 100 : SHEEN_DEFAULTS.width,\n  };\n}\n\nfunction renderStaticPose() {\n  Object.assign(current, REST, STATIC_POSES[props.emote]);\n  gradientPhase = 0;\n  sheenTime = 0;\n  render(current, createOffsets(), true);\n}\n\nfunction isStatic() {\n  return !activeAnimated || browser.reducedMotion.value || !browser.animationAvailable.value;\n}\n\nfunction frame(nowMilliseconds: number) {\n  if (!activeAnimated || !browser.visible.value || browser.reducedMotion.value || !browser.intersecting.value) return;\n  if (nowMilliseconds - lastRender < MIN_FRAME_INTERVAL) {\n    scheduleFrame();\n    return;\n  }\n  lastRender = nowMilliseconds;\n\n  const now = nowMilliseconds / 1000;\n  const dt = lastFrame ? Math.min(0.05, now - lastFrame) : 0;\n  lastFrame = now;\n  elapsed += dt;\n\n  Object.assign(frameTarget, REST);\n  resetOffsets();\n  motionSpeed = 1;\n  applyEmote(activeEmote, frameTarget, frameOffsets, dt, now);\n\n  for (const key of POSE_KEYS) {\n    const delta = frameTarget[key] - current[key];\n    if (Math.abs(delta) < SPRING_POSITION_EPSILON && Math.abs(velocity[key]) < SPRING_VELOCITY_EPSILON) {\n      current[key] = frameTarget[key];\n      velocity[key] = 0;\n      continue;\n    }\n    const [baseStiffness, dampingRatio] = SPRINGS[key] ?? DEFAULT_SPRING;\n    // A spring's frequency goes with the square root of its stiffness, so scale stiffness by speed squared.\n    const stiffness = baseStiffness * motionSpeed * motionSpeed;\n    const damping = 2 * Math.sqrt(stiffness) * dampingRatio;\n    velocity[key] += (stiffness * delta - damping * velocity[key]) * dt;\n    current[key] += velocity[key] * dt;\n  }\n\n  gradientPhase = (gradientPhase + current.gradientSpeed * dt) % 360;\n  if (current.sheen > 0.01) sheenTime += dt;\n  render(current, frameOffsets);\n  scheduleFrame();\n}\n\nfunction scheduleFrame() {\n  if (\n    !activeAnimated ||\n    browser.reducedMotion.value ||\n    !browser.visible.value ||\n    !browser.intersecting.value ||\n    !browser.animationAvailable.value\n  ) {\n    return;\n  }\n  if (activeTextured) prepareNoiseFrames();\n  browser.requestFrame(frame);\n}\n\nfunction resetFrameClock() {\n  lastFrame = 0;\n  lastRender = -Infinity;\n}\n\nwatch(\n  () => [props.animated, props.calm, props.emote, props.theme, props.variant],\n  () => {\n    syncRenderOptions();\n    elapsed = 0;\n    glancing.next = 0.8;\n    blinks = [];\n    nextBlink = firstBlinkDelay();\n    nextGrain = 0;\n    if (isStatic()) {\n      browser.cancelFrame();\n      renderStaticPose();\n    } else {\n      resetFrameClock();\n      scheduleFrame();\n    }\n  },\n  // Theme and variant swap which shapes exist, so render after the DOM has been patched.\n  { flush: \"post\" },\n);\n\nwatch(\n  browser.visible,\n  (visible) => {\n    if (!visible) {\n      browser.cancelFrame();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nwatch(\n  browser.intersecting,\n  (intersecting) => {\n    if (!intersecting) {\n      browser.cancelFrame();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nwatch(\n  browser.reducedMotion,\n  (reducedMotion) => {\n    if (reducedMotion || !activeAnimated) {\n      browser.cancelFrame();\n      renderStaticPose();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nonMounted(() => {\n  browser.updateBounds();\n  readSheenTokens();\n  if (isStatic()) renderStaticPose();\n  else scheduleFrame();\n});\n</script>\n\n<template>\n  <svg\n    ref=\"svgRef\"\n    class=\"pv-ask-tq-buddy\"\n    :data-calm=\"calm || undefined\"\n    :data-emote=\"emote\"\n    :data-size=\"size\"\n    :data-theme=\"theme\"\n    :data-variant=\"variant\"\n    data-testid=\"pv-ask-tq-buddy\"\n    :aria-label=\"`asktq-${emote}`\"\n    role=\"img\"\n    :viewBox=\"VIEWBOX\"\n    shape-rendering=\"geometricPrecision\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n  >\n    <defs>\n      <linearGradient\n        :id=\"gradientId\"\n        ref=\"gradientRef\"\n        gradientUnits=\"userSpaceOnUse\"\n        x1=\"29\"\n        y1=\"36.5\"\n        x2=\"279\"\n        y2=\"292\"\n      >\n        <stop class=\"pv-ask-tq-buddy__gradient-start\" />\n        <stop class=\"pv-ask-tq-buddy__gradient-end\" offset=\"1\" />\n      </linearGradient>\n      <clipPath :id=\"clipId\">\n        <path ref=\"clipRef\" />\n      </clipPath>\n      <template v-if=\"textured\">\n        <linearGradient :id=\"sheenId\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\">\n          <stop class=\"pv-ask-tq-buddy__sheen-stop\" stop-opacity=\"0\" />\n          <stop class=\"pv-ask-tq-buddy__sheen-stop pv-ask-tq-buddy__sheen-peak\" offset=\".5\" />\n          <stop class=\"pv-ask-tq-buddy__sheen-stop\" offset=\"1\" stop-opacity=\"0\" />\n        </linearGradient>\n        <pattern :id=\"noiseId\" patternUnits=\"userSpaceOnUse\" :width=\"GRAIN_SIZE\" :height=\"GRAIN_SIZE\">\n          <image ref=\"noiseRef\" :width=\"GRAIN_SIZE\" :height=\"GRAIN_SIZE\" preserveAspectRatio=\"none\" />\n        </pattern>\n      </template>\n      <template v-if=\"halloween && textured\">\n        <filter :id=\"glowId\" x=\"-60%\" y=\"-60%\" width=\"220%\" height=\"220%\">\n          <feGaussianBlur :stdDeviation=\"7 * EYE_GLOW\" result=\"blur\" />\n          <feMerge>\n            <feMergeNode in=\"blur\" />\n            <feMergeNode in=\"SourceGraphic\" />\n          </feMerge>\n        </filter>\n        <radialGradient :id=\"candleId\" cx=\"50%\" cy=\"42%\" r=\"58%\">\n          <stop class=\"pv-ask-tq-buddy__candle-stop\" stop-opacity=\".5\" />\n          <stop class=\"pv-ask-tq-buddy__candle-stop\" offset=\"1\" stop-opacity=\"0\" />\n        </radialGradient>\n      </template>\n      <!-- Solid variants cut the eyes out by reusing the live eye shapes as a mask. -->\n      <mask v-if=\"silhouette\" :id=\"maskId\" maskUnits=\"userSpaceOnUse\" v-bind=\"MASK_BOUNDS\">\n        <rect v-bind=\"MASK_BOUNDS\" fill=\"#fff\" />\n        <use :href=\"`#${eyesId}`\" class=\"pv-ask-tq-buddy__eye-cutout\" />\n      </mask>\n    </defs>\n\n    <path\n      v-if=\"textured\"\n      ref=\"ringRef\"\n      class=\"pv-ask-tq-buddy__ring\"\n      fill=\"none\"\n      :stroke-width=\"RING_STROKE\"\n      opacity=\"0\"\n    />\n    <path ref=\"bodyRef\" class=\"pv-ask-tq-buddy__body\" :mask=\"silhouette ? `url(#${maskId})` : undefined\" />\n    <g v-if=\"textured\" :clip-path=\"`url(#${clipId})`\">\n      <rect v-if=\"halloween\" ref=\"candleRef\" width=\"191\" height=\"191\" :fill=\"`url(#${candleId})`\" />\n      <rect ref=\"sheenRef\" x=\"0\" y=\"-60\" height=\"311\" :fill=\"`url(#${sheenId})`\" opacity=\"0\" />\n    </g>\n    <!-- Inline styles, not classes, so the mask's <use> copy can recolor the eyes through inherited properties. -->\n    <g :id=\"eyesId\" style=\"opacity: var(--pv-ask-tq-buddy-eye-visibility)\">\n      <g\n        v-if=\"halloween\"\n        ref=\"litRef\"\n        :filter=\"textured ? `url(#${glowId})` : undefined\"\n        stroke-linejoin=\"round\"\n        :stroke-width=\"triangleStroke\"\n      >\n        <path ref=\"leftEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill); stroke: var(--pv-ask-tq-buddy-eye-fill)\" />\n        <path\n          ref=\"rightEyeRef\"\n          style=\"fill: var(--pv-ask-tq-buddy-eye-fill); stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        />\n      </g>\n      <template v-else>\n        <rect ref=\"leftEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill)\" />\n        <rect ref=\"rightEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill)\" />\n      </template>\n      <path\n        ref=\"leftHappyRef\"\n        fill=\"none\"\n        style=\"stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        :stroke-width=\"happyStroke\"\n        stroke-linecap=\"round\"\n        stroke-linejoin=\"round\"\n        opacity=\"0\"\n      />\n      <path\n        ref=\"rightHappyRef\"\n        fill=\"none\"\n        style=\"stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        :stroke-width=\"happyStroke\"\n        stroke-linecap=\"round\"\n        stroke-linejoin=\"round\"\n        opacity=\"0\"\n      />\n    </g>\n    <g v-if=\"textured\" :clip-path=\"`url(#${clipId})`\">\n      <rect\n        ref=\"grainRef\"\n        x=\"-191\"\n        y=\"-191\"\n        width=\"573\"\n        height=\"573\"\n        :fill=\"`url(#${noiseId})`\"\n        :opacity=\"grainOpacity\"\n      />\n    </g>\n  </svg>\n</template>\n\n<style scoped>\n.pv-ask-tq-buddy {\n  --pv-ask-tq-buddy-gradient-end: #fff;\n  --pv-ask-tq-buddy-gradient-start: #36c5ba;\n  --pv-ask-tq-buddy-solid: #36c5ba;\n  --pv-ask-tq-buddy-eye: #fff;\n  --pv-ask-tq-buddy-eye-fill: var(--pv-ask-tq-buddy-eye);\n  --pv-ask-tq-buddy-eye-visibility: 1;\n\n  display: block;\n  width: 3rem;\n  height: auto;\n  overflow: visible;\n}\n\n.pv-ask-tq-buddy[data-theme=\"halloween\"] {\n  --pv-ask-tq-buddy-gradient-end: #8f2a04;\n  --pv-ask-tq-buddy-gradient-start: #ff9b2f;\n  --pv-ask-tq-buddy-eye: #ffd36b;\n}\n\n.pv-ask-tq-buddy:is([data-variant=\"mono\"], [data-variant=\"solid\"]) {\n  --pv-ask-tq-buddy-eye-visibility: 0;\n}\n\n.pv-ask-tq-buddy[data-variant=\"outline\"] {\n  --pv-ask-tq-buddy-eye-fill: currentColor;\n}\n\n.pv-ask-tq-buddy[data-size=\"xs\"] {\n  width: 1.25rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"sm\"] {\n  width: 2rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"md\"] {\n  width: 3rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"lg\"] {\n  width: 4rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"xl\"] {\n  width: 6rem;\n}\n\n.pv-ask-tq-buddy__gradient-start {\n  stop-color: var(--pv-ask-tq-buddy-gradient-start);\n}\n\n.pv-ask-tq-buddy__gradient-end {\n  stop-color: var(--pv-ask-tq-buddy-gradient-end);\n}\n\n.pv-ask-tq-buddy__sheen-stop {\n  stop-color: var(--sheen-color, #fff);\n}\n\n.pv-ask-tq-buddy__sheen-peak {\n  stop-opacity: var(--sheen-opacity, 0.8);\n}\n\n.pv-ask-tq-buddy__candle-stop {\n  stop-color: var(--pv-ask-tq-buddy-eye);\n}\n\n.pv-ask-tq-buddy__body {\n  fill: v-bind(\"`url(#${gradientId})`\");\n}\n\n.pv-ask-tq-buddy[data-variant=\"mono\"] .pv-ask-tq-buddy__body {\n  fill: currentColor;\n}\n\n.pv-ask-tq-buddy[data-variant=\"solid\"] .pv-ask-tq-buddy__body {\n  fill: var(--pv-ask-tq-buddy-solid);\n}\n\n.pv-ask-tq-buddy[data-variant=\"outline\"] .pv-ask-tq-buddy__body {\n  fill: none;\n  stroke: currentColor;\n}\n\n.pv-ask-tq-buddy__eye-cutout {\n  --pv-ask-tq-buddy-eye-fill: #000;\n  --pv-ask-tq-buddy-eye-visibility: 1;\n}\n\n.pv-ask-tq-buddy__ring {\n  stroke: var(--pv-ask-tq-buddy-gradient-start);\n}\n</style>\n","<script lang=\"ts\">\nconst GRAIN_FRAMES = 8;\nconst GRAIN_TILE = 256;\n\nconst noiseFrames: string[] = [];\nlet noiseGenerationScheduled = false;\nlet noiseUnavailable = false;\n\nfunction createNoiseFrame() {\n  const browserDocument = globalThis.document;\n  if (!browserDocument) return;\n  const canvas = browserDocument.createElement(\"canvas\");\n  canvas.width = canvas.height = GRAIN_TILE;\n  const context = canvas.getContext(\"2d\");\n  if (!context) return;\n  const image = context.createImageData(GRAIN_TILE, GRAIN_TILE);\n  for (let index = 0; index < image.data.length; index += 4) {\n    // Roughly gaussian deviation from mid-grey becomes a light or dark speck with matching alpha.\n    const deviation = (Math.random() + Math.random() + Math.random()) / 1.5 - 1;\n    const value = deviation > 0 ? 255 : 0;\n    image.data[index] = image.data[index + 1] = image.data[index + 2] = value;\n    // Light specks are a touch stronger than dark ones so the grain reads as texture, not dirt.\n    image.data[index + 3] = Math.abs(deviation) * (deviation > 0 ? 75 : 45);\n  }\n  context.putImageData(image, 0, 0);\n  return canvas.toDataURL();\n}\n\nfunction getFirstNoiseFrame() {\n  if (noiseFrames.length === 0 && !noiseUnavailable) {\n    const frame = createNoiseFrame();\n    if (frame) noiseFrames.push(frame);\n    else noiseUnavailable = true;\n  }\n  return noiseFrames[0];\n}\n\n/** Generates animated film frames one at a time without blocking mount or animation startup. */\nfunction prepareNoiseFrames() {\n  if (noiseGenerationScheduled || noiseUnavailable || noiseFrames.length >= GRAIN_FRAMES) return;\n  noiseGenerationScheduled = true;\n  const generate = () => {\n    noiseGenerationScheduled = false;\n    const frame = createNoiseFrame();\n    if (!frame) {\n      noiseUnavailable = true;\n      return;\n    }\n    noiseFrames.push(frame);\n    prepareNoiseFrames();\n  };\n  const browserWindow = globalThis.window;\n  if (!browserWindow) {\n    noiseGenerationScheduled = false;\n    return;\n  }\n  if (typeof browserWindow.requestIdleCallback === \"function\")\n    browserWindow.requestIdleCallback(generate, { timeout: 500 });\n  else browserWindow.setTimeout(generate, 0);\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useId, watch } from \"vue\";\nimport type { AskTqBuddyEmote, AskTqBuddyProps } from \"./types\";\nimport { useBuddyBrowserRuntime } from \"./useBuddyBrowserRuntime\";\n\ninterface Pose {\n  bodyY: number;\n  glow: number;\n  gradientSpeed: number;\n  gx: number;\n  gy: number;\n  happy: number;\n  leftHeight: number;\n  leftWidth: number;\n  rightHeight: number;\n  rightWidth: number;\n  rotation: number;\n  scaleX: number;\n  scaleY: number;\n  sheen: number;\n  spread: number;\n}\n\ninterface FrameOffsets {\n  bodyY: number;\n  leftY: number;\n  rightY: number;\n  rotation: number;\n  scale: number;\n  scaleX: number;\n  scaleY: number;\n}\n\ninterface Blink {\n  duration: number;\n  side: \"both\" | \"left\" | \"right\";\n  start: number;\n}\n\n/** Body and eye geometry in mascot units, where the body is a 191-unit square. */\ninterface Shape {\n  bodyRadius: number;\n  eyeHeight: number;\n  eyeRadius: number;\n  eyeWidth: number;\n  homeX: number;\n  homeY: number;\n  spread: number;\n}\n\n/** SVG affine matrix `[a, b, c, d, e, f]`. */\ntype Matrix = readonly [number, number, number, number, number, number];\n\ninterface Box {\n  height: number;\n  width: number;\n  x: number;\n  y: number;\n}\n\nconst props = withDefaults(defineProps<AskTqBuddyProps>(), {\n  animated: false,\n  calm: false,\n  emote: \"idle\",\n  size: \"md\",\n  theme: \"default\",\n  variant: \"default\",\n});\n\nconst BODY_SIZE = 191;\nconst BODY_CENTER = BODY_SIZE / 2;\n// Every size is a multiple of 16px, so a 1/14 body-width gutter puts the body at exactly 7/8 of the\n// rendered width and lands its resting edges on whole device pixels instead of blurring across two.\nconst VIEWBOX_PADDING = BODY_SIZE / 14;\nconst VIEWBOX_SIZE = BODY_SIZE + VIEWBOX_PADDING * 2;\nconst VIEWBOX = `${-VIEWBOX_PADDING} ${-VIEWBOX_PADDING} ${VIEWBOX_SIZE} ${VIEWBOX_SIZE}`;\nconst MASK_BOUNDS = { height: 391, width: 391, x: -100, y: -100 };\n// Emote motion is authored against the default eye: 19x43, 73 apart, resting 16.5 right of center and 29 up.\nconst BASE_EYE_WIDTH = 19;\nconst BASE_EYE_HEIGHT = 43;\nconst BASE_SPREAD = 73;\nconst BASE_HOME_X = 16.5;\nconst BASE_HOME_Y = -29;\n// Solid and mono share the hand-drawn icon geometry (about 3x7px eyes on a 20px body).\nconst SOLID_SHAPE = { bodyRadius: 38, eyeHeight: 66, eyeRadius: 7, eyeWidth: 28, homeX: 14.5, homeY: -24, spread: 57 };\nconst SHAPES = {\n  default: { bodyRadius: 12, eyeHeight: 43, eyeRadius: 2.4, eyeWidth: 19, homeX: 16.5, homeY: -29, spread: 73 },\n  halloween: { bodyRadius: 48, eyeHeight: 30, eyeRadius: 2, eyeWidth: 34, homeX: 12, homeY: -26, spread: 74 },\n  mono: SOLID_SHAPE,\n  outline: { bodyRadius: 38, eyeHeight: 57, eyeRadius: 5, eyeWidth: 19, homeX: 9.5, homeY: -19.5, spread: 38 },\n  solid: SOLID_SHAPE,\n} satisfies Record<string, Shape>;\nconst OUTLINE_STROKE = 19;\nconst RING_STROKE = 3.5;\nconst RING_INSET = -8;\nconst RING_RADIUS_OFFSET = 7;\nconst SHEEN_STRENGTH = 0.6;\n// Fallbacks for the shared `--sheen-*` tokens (see `.pv-sheen`) when Pit Viper CSS isn't loaded.\n// Angle is in degrees, duration in seconds, width as a fraction of the body.\nconst SHEEN_DEFAULTS = { angle: 108, duration: 1.9, width: 0.33 };\nconst CANDLE_FLICKER = 0.6;\nconst EYE_GLOW = 0.6;\nconst GRAIN_SIZE = 64;\nconst GRAIN_FPS = 14;\n// Skip every other callback on displays above ~100Hz (120Hz renders at 60fps, 144Hz at 72fps); 60-90Hz renders every frame.\nconst MIN_FRAME_INTERVAL = 10;\nconst SPRING_POSITION_EPSILON = 0.0001;\nconst SPRING_VELOCITY_EPSILON = 0.001;\n// Control-point distance that makes a cubic Bezier approximate a quarter circle.\nconst KAPPA = 0.5522847498;\nconst REST: Pose = {\n  bodyY: 0,\n  glow: 0,\n  gradientSpeed: 0,\n  gx: BASE_HOME_X,\n  gy: BASE_HOME_Y,\n  happy: 0,\n  leftHeight: BASE_EYE_HEIGHT,\n  leftWidth: BASE_EYE_WIDTH,\n  rightHeight: BASE_EYE_HEIGHT,\n  rightWidth: BASE_EYE_WIDTH,\n  rotation: 0,\n  scaleX: 1,\n  scaleY: 1,\n  sheen: 0,\n  spread: BASE_SPREAD,\n};\nconst POSE_KEYS = Object.keys(REST) as (keyof Pose)[];\nconst DEFAULT_SPRING = [170, 0.58] as const;\nconst SPRINGS: Partial<Record<keyof Pose, readonly [number, number]>> = {\n  glow: [20, 1],\n  gradientSpeed: [5, 1],\n  gx: [340, 0.78],\n  gy: [340, 0.78],\n  happy: [220, 0.75],\n  sheen: [14, 1],\n};\n// Calm mode: seconds between beats (a blink or a glance), how long a glance holds, and motion speed factors.\nconst CALM_BEAT_SECONDS = [12, 18] as const;\nconst CALM_FIRST_BEAT_SECONDS = [6, 12] as const;\nconst CALM_GLANCE_HOLD_SECONDS = [2, 3.5] as const;\nconst CALM_IDLE_SPEED = 0.5;\nconst CALM_CURIOUS_SPEED = 0.75;\nconst BLINK_SECONDS = 0.17;\nconst STATIC_POSES: Record<AskTqBuddyEmote, Partial<Pose>> = {\n  boo: { gx: 0, gy: -26, leftHeight: 62, leftWidth: 30, rightHeight: 62, rightWidth: 30 },\n  confused: { gx: -4, gy: -27, leftHeight: 29, rightHeight: 48, rotation: -7 },\n  curious: { gy: -20, leftHeight: 50, leftWidth: 21, rightHeight: 50, rightWidth: 21 },\n  greeting: { gx: 0, gy: -20, happy: 1 },\n  happy: { gx: 0, gy: -20, happy: 1 },\n  idle: {},\n  listening: { glow: 1, gx: 0, gy: -14, leftHeight: 49, leftWidth: 20, rightHeight: 49, rightWidth: 20 },\n  sleeping: { gx: 2, gy: -6, leftHeight: 5, leftWidth: 22, rightHeight: 5, rightWidth: 22, scaleY: 0.985 },\n  talking: { gx: 6, gy: -24 },\n  thinking: { gx: -8, gy: -40, leftHeight: 33, rightHeight: 40, rotation: -3, sheen: 1 },\n  working: { gx: 0, gy: -16, leftHeight: 34, rightHeight: 34, sheen: 1 },\n};\n\nconst halloween = computed(() => props.theme === \"halloween\");\nconst silhouette = computed(() => props.variant === \"mono\" || props.variant === \"solid\");\nconst textured = computed(() => props.variant === \"default\");\nconst shape = computed<Shape>(() => (halloween.value ? SHAPES.halloween : SHAPES[props.variant]));\nconst grainOpacity = computed(() => (halloween.value ? 0.8 : 0.7));\nconst triangleStroke = computed(() => Math.max(0.01, shape.value.eyeRadius * 2));\nconst happyStroke = computed(() => (10 * shape.value.eyeWidth) / BASE_EYE_WIDTH);\n\nlet activeAnimated = props.animated;\nlet activeCalm = props.calm;\nlet activeEmote = props.emote;\nlet activeHalloween = props.theme === \"halloween\";\nlet activeTextured = props.variant === \"default\";\nlet activeVariant = props.variant;\nlet activeShape = activeHalloween ? SHAPES.halloween : SHAPES[activeVariant];\nlet activeRingStrength = activeHalloween ? 0.8 : 1;\n\nfunction syncRenderOptions() {\n  activeAnimated = props.animated;\n  activeCalm = props.calm;\n  activeEmote = props.emote;\n  activeHalloween = props.theme === \"halloween\";\n  activeTextured = props.variant === \"default\";\n  activeVariant = props.variant;\n  activeShape = activeHalloween ? SHAPES.halloween : SHAPES[activeVariant];\n  activeRingStrength = activeHalloween ? 0.8 : 1;\n}\n\nconst svgRef = ref<SVGSVGElement>();\nconst bodyRef = ref<SVGPathElement>();\nconst clipRef = ref<SVGPathElement>();\nconst gradientRef = ref<SVGLinearGradientElement>();\nconst leftEyeRef = ref<SVGRectElement | SVGPathElement>();\nconst rightEyeRef = ref<SVGRectElement | SVGPathElement>();\nconst leftHappyRef = ref<SVGPathElement>();\nconst rightHappyRef = ref<SVGPathElement>();\nconst ringRef = ref<SVGPathElement>();\nconst sheenRef = ref<SVGRectElement>();\nconst candleRef = ref<SVGRectElement>();\nconst litRef = ref<SVGGElement>();\nconst grainRef = ref<SVGRectElement>();\nconst noiseRef = ref<SVGImageElement>();\n\nconst browser = useBuddyBrowserRuntime(svgRef, {\n  onBoundsChange: (resized) => {\n    if (resized && isStatic()) renderStaticPose();\n  },\n  shouldTrackPointer: ({ finePointer, reducedMotion }) =>\n    props.animated && props.emote === \"curious\" && finePointer && !reducedMotion,\n});\nconst { bounds, pointer } = browser;\n\nconst attributeCache = new WeakMap<Element, Record<string, string | null>>();\n\nfunction attributesFor(element: Element) {\n  let attributes = attributeCache.get(element);\n  if (!attributes) {\n    attributes = Object.create(null) as Record<string, string | null>;\n    attributeCache.set(element, attributes);\n  }\n  return attributes;\n}\n\nfunction setAttribute(element: Element, name: string, value: string) {\n  const attributes = attributesFor(element);\n  if (attributes[name] === value) return;\n  element.setAttribute(name, value);\n  attributes[name] = value;\n}\n\nfunction removeAttribute(element: Element, name: string) {\n  const attributes = attributesFor(element);\n  if (attributes[name] === null) return;\n  if (element.hasAttribute(name)) element.removeAttribute(name);\n  attributes[name] = null;\n}\n\nfunction setOpacity(element: SVGElement, value: string) {\n  const attributes = attributesFor(element);\n  if (attributes[\"style.opacity\"] === value) return;\n  element.style.opacity = value;\n  attributes[\"style.opacity\"] = value;\n}\n\nfunction removeOpacity(element: SVGElement) {\n  const attributes = attributesFor(element);\n  if (attributes[\"style.opacity\"] === null) return;\n  element.style.removeProperty(\"opacity\");\n  attributes[\"style.opacity\"] = null;\n}\n\nconst id = `pv-ask-tq-buddy-${useId().replaceAll(\":\", \"\")}`;\nconst gradientId = `${id}-gradient`;\nconst sheenId = `${id}-sheen`;\nconst clipId = `${id}-clip`;\nconst noiseId = `${id}-noise`;\nconst glowId = `${id}-glow`;\nconst candleId = `${id}-candle`;\nconst maskId = `${id}-mask`;\nconst eyesId = `${id}-eyes`;\n\nconst current: Pose = { ...REST };\nconst velocity = Object.fromEntries(Object.keys(REST).map((key) => [key, 0])) as Record<keyof Pose, number>;\nconst glancing = { next: 0.8, x: 0, y: 0 };\nlet blinks: Blink[] = [];\nlet elapsed = 0;\nlet gradientPhase = 0;\nlet sheenTime = 0;\nlet sheen = { ...SHEEN_DEFAULTS };\nlet nextGrain = 0;\nlet grainImage: SVGImageElement | undefined;\nlet lastFrame = 0;\nlet lastRender = -Infinity;\nlet nextBlink = firstBlinkDelay();\n// Springs run at this fraction of their normal speed this frame; calm mode lowers it.\nlet motionSpeed = 1;\nlet happyEyesVisible = false;\nlet ringVisible = false;\nlet sheenVisible = false;\n\nfunction randomBetween(min: number, max: number) {\n  return min + Math.random() * (max - min);\n}\n\nfunction firstBlinkDelay() {\n  return props.calm ? randomBetween(...CALM_FIRST_BEAT_SECONDS) : randomBetween(0.8, 3);\n}\n\nfunction clamp(value: number, min: number, max: number) {\n  return Math.max(min, Math.min(max, value));\n}\n\nfunction easeOutBack(progress: number) {\n  const overshoot = 1.9;\n  return 1 + (overshoot + 1) * Math.pow(progress - 1, 3) + overshoot * Math.pow(progress - 1, 2);\n}\n\n/** Viewbox units covered by one device pixel, or 0 before layout is known. */\nfunction unitsPerDevicePixel() {\n  return bounds.width > 0 ? VIEWBOX_SIZE / (bounds.width * bounds.devicePixelRatio) : 0;\n}\n\n/**\n * Browsers paint an SVG from its top-left corner rounded to a whole device pixel, at its exact scale, so the\n * device pixel grid starts at the viewbox origin wherever the buddy lands in the page layout.\n */\nfunction snapToDevicePixel(value: number, unit: number) {\n  return Math.round((value + VIEWBOX_PADDING) / unit) * unit - VIEWBOX_PADDING;\n}\n\n/** Snaps a span's edges to the device pixel grid so a resting pose renders crisp instead of half-covered. */\nfunction snapSpan(start: number, length: number, unit: number) {\n  const snappedStart = snapToDevicePixel(start, unit);\n  const snappedLength = Math.max(unit, Math.round(length / unit) * unit);\n  return { length: snappedLength, start: snappedStart };\n}\n\n/** Snaps a box to the device pixel grid of `unit` viewbox units per pixel, or leaves it as is when 0. */\nfunction snapBox(box: Box, unit: number): Box {\n  if (unit <= 0) return box;\n  const horizontal = snapSpan(box.x, box.width, unit);\n  const vertical = snapSpan(box.y, box.height, unit);\n  return { height: vertical.length, width: horizontal.length, x: horizontal.start, y: vertical.start };\n}\n\nfunction insetBox({ height, width, x, y }: Box, inset: number): Box {\n  return { height: height - inset * 2, width: width - inset * 2, x: x + inset, y: y + inset };\n}\n\n/** Tilt about the body center, then squash and stretch from the bottom edge, then hop. */\nfunction bodyMatrix(rotation: number, scaleX: number, scaleY: number, bodyY: number): Matrix {\n  const radians = (rotation * Math.PI) / 180;\n  const cos = Math.cos(radians);\n  const sin = Math.sin(radians);\n  const rotate: Matrix = [\n    cos,\n    sin,\n    -sin,\n    cos,\n    BODY_CENTER - cos * BODY_CENTER + sin * BODY_CENTER,\n    BODY_CENTER - sin * BODY_CENTER - cos * BODY_CENTER,\n  ];\n  const scale: Matrix = [scaleX, 0, 0, scaleY, BODY_CENTER * (1 - scaleX), BODY_SIZE * (1 - scaleY)];\n  const [a, b, c, d, e, f] = multiply(rotate, scale);\n  return [a, b, c, d, e, f + bodyY];\n}\n\nfunction multiply([a, b, c, d, e, f]: Matrix, [g, h, i, j, k, l]: Matrix): Matrix {\n  return [a * g + c * h, b * g + d * h, a * i + c * j, b * i + d * j, a * k + c * l + e, b * k + d * l + f];\n}\n\nfunction point([a, b, c, d, e, f]: Matrix, x: number, y: number) {\n  return `${(a * x + c * y + e).toFixed(3)} ${(b * x + d * y + f).toFixed(3)}`;\n}\n\nfunction matrixAttribute([a, b, c, d, e, f]: Matrix) {\n  return `matrix(${a.toFixed(5)} ${b.toFixed(5)} ${c.toFixed(5)} ${d.toFixed(5)} ${e.toFixed(3)} ${f.toFixed(3)})`;\n}\n\n/** A rounded rectangle mapped through `matrix`. Beziers are affine invariant, so the result is exact. */\nfunction roundedRectPath(matrix: Matrix, { height, width, x: left, y: top }: Box, radius: number) {\n  const right = left + width;\n  const bottom = top + height;\n  const r = clamp(radius, 0, Math.min(width, height) / 2);\n  const k = r * (1 - KAPPA);\n  const p = (x: number, y: number) => point(matrix, x, y);\n  return [\n    `M${p(left + r, top)}`,\n    `L${p(right - r, top)}`,\n    `C${p(right - k, top)} ${p(right, top + k)} ${p(right, top + r)}`,\n    `L${p(right, bottom - r)}`,\n    `C${p(right, bottom - k)} ${p(right - k, bottom)} ${p(right - r, bottom)}`,\n    `L${p(left + r, bottom)}`,\n    `C${p(left + k, bottom)} ${p(left, bottom - k)} ${p(left, bottom - r)}`,\n    `L${p(left, top + r)}`,\n    `C${p(left, top + k)} ${p(left + k, top)} ${p(left + r, top)}Z`,\n  ].join(\" \");\n}\n\nfunction createOffsets(): FrameOffsets {\n  return {\n    bodyY: 0,\n    leftY: 0,\n    rightY: 0,\n    rotation: 0,\n    scale: 1,\n    scaleX: 0,\n    scaleY: 0,\n  };\n}\n\nconst frameTarget: Pose = { ...REST };\nconst frameOffsets = createOffsets();\n\nfunction resetOffsets() {\n  frameOffsets.bodyY = 0;\n  frameOffsets.leftY = 0;\n  frameOffsets.rightY = 0;\n  frameOffsets.rotation = 0;\n  frameOffsets.scale = 1;\n  frameOffsets.scaleX = 0;\n  frameOffsets.scaleY = 0;\n}\n\nfunction blink(side: Blink[\"side\"] = \"both\", duration = BLINK_SECONDS, delay = 0) {\n  blinks.push({ duration, side, start: elapsed + delay });\n}\n\nfunction autoBlink(min: number, max: number) {\n  if (elapsed <= nextBlink) return;\n  if (activeCalm) {\n    blink(\"both\", BLINK_SECONDS / motionSpeed);\n    nextBlink = elapsed + randomBetween(...CALM_BEAT_SECONDS);\n    return;\n  }\n  blink();\n  if (Math.random() < 0.22) blink(\"both\", BLINK_SECONDS, 0.28);\n  nextBlink = elapsed + randomBetween(min, max);\n}\n\n/** Kicks the springs so the buddy perks up, as if reacting to a keystroke. */\nfunction poke(amount: number) {\n  velocity.scaleY += 0.9 * amount;\n  velocity.leftHeight += 150 * amount;\n  velocity.rightHeight += 150 * amount;\n}\n\n/** One slow beat every 12-18 seconds: either a blink, or a small glance that drifts back home. */\nfunction applyCalmIdle(target: Pose) {\n  motionSpeed = CALM_IDLE_SPEED;\n  if (elapsed > glancing.next) {\n    glancing.x = 0;\n    glancing.y = 0;\n    glancing.next = Infinity;\n  }\n  if (elapsed > nextBlink) {\n    if (Math.random() < 0.5) {\n      blink(\"both\", BLINK_SECONDS / motionSpeed);\n    } else {\n      glancing.x = randomBetween(-10, 10);\n      glancing.y = randomBetween(-6, 5);\n      glancing.next = elapsed + randomBetween(...CALM_GLANCE_HOLD_SECONDS);\n    }\n    nextBlink = elapsed + randomBetween(...CALM_BEAT_SECONDS);\n  }\n  target.gx += glancing.x;\n  target.gy += glancing.y;\n}\n\nfunction applyIdle(target: Pose, offsets: FrameOffsets) {\n  if (activeCalm) {\n    applyCalmIdle(target);\n    return;\n  }\n  offsets.scaleY += 0.012 * Math.sin(elapsed * 2.1);\n  if (elapsed > glancing.next) {\n    const returnHome = Math.random() < 0.35;\n    glancing.x = returnHome ? 0 : randomBetween(-14, 14);\n    glancing.y = returnHome ? 0 : randomBetween(-9, 7);\n    glancing.next = elapsed + randomBetween(1.6, 3.8);\n  }\n  target.gx += glancing.x;\n  target.gy += glancing.y;\n  autoBlink(2.5, 5);\n}\n\nfunction applyCurious(target: Pose, offsets: FrameOffsets, now: number) {\n  if (!browser.finePointer.value || now - pointer.lastMoved > 2.5) {\n    applyIdle(target, offsets);\n    return;\n  }\n\n  const width = Math.max(bounds.width, 80);\n  const dx = (pointer.x - (bounds.left + bounds.width / 2)) / width;\n  const dy = (pointer.y - (bounds.top + bounds.height / 2)) / width;\n  target.gx = 36 * Math.tanh(dx * 1.3);\n  target.gy = 46 * Math.tanh(dy * 1.3);\n  target.rotation = 5 * Math.tanh(dx * 0.8);\n  if (Math.abs(dx) < 0.3 && Math.abs(dy) < 0.3) {\n    target.leftHeight = target.rightHeight = 50;\n    target.leftWidth = target.rightWidth = 21;\n  }\n  if (activeCalm) motionSpeed = CALM_CURIOUS_SPEED;\n  else offsets.scaleY += 0.01 * Math.sin(elapsed * 2.1);\n  autoBlink(2.5, 5);\n}\n\nfunction applyEmote(emote: AskTqBuddyEmote, target: Pose, offsets: FrameOffsets, dt: number, now: number) {\n  switch (emote) {\n    case \"curious\":\n      applyCurious(target, offsets, now);\n      break;\n    case \"greeting\": {\n      const period = 4.4;\n      const cycle = elapsed % period;\n      if (cycle < 0.75) offsets.scale = Math.max(0, easeOutBack(cycle / 0.75));\n      if (cycle > period - 0.35) offsets.scale = 1 - Math.pow((cycle - (period - 0.35)) / 0.35, 2);\n      if (cycle < 0.9) {\n        target.gx = 0;\n        target.gy = -20;\n      } else if (cycle < 1.45) {\n        target.gx = -30;\n        target.gy = -26;\n      } else if (cycle < 2) {\n        target.gx = 32;\n        target.gy = -26;\n      } else {\n        target.gx = 4;\n        target.gy = -20;\n      }\n      if (cycle > 2.15 && cycle - dt <= 2.15) blink(\"right\", 0.38);\n      if (cycle > 2.6 && cycle < 3.5) {\n        target.happy = 1;\n        offsets.rotation += 4 * Math.sin((cycle - 2.6) * 14) * (1 - (cycle - 2.6) / 0.9);\n      }\n      break;\n    }\n    case \"listening\":\n      Object.assign(target, STATIC_POSES.listening, {\n        rotation: 3 * Math.sin(elapsed * 0.8),\n        scaleX: 1.02,\n        scaleY: 1.02,\n      });\n      offsets.bodyY -= 2 * Math.sin(elapsed * 2.4);\n      if (Math.random() < dt * 5) poke(0.6);\n      autoBlink(2.5, 4.5);\n      break;\n    case \"thinking\":\n      Object.assign(target, STATIC_POSES.thinking, {\n        gradientSpeed: 80,\n        gx: -16 + 16 * Math.sin(elapsed * 1.3),\n        gy: -42 + 3 * Math.sin(elapsed * 2.1),\n      });\n      offsets.scaleY += 0.008 * Math.sin(elapsed * 2.6);\n      autoBlink(3, 6);\n      break;\n    case \"working\": {\n      Object.assign(target, STATIC_POSES.working, { gradientSpeed: 200 });\n      const wave = elapsed * 6.8;\n      const left = Math.max(0, Math.sin(wave));\n      const right = Math.max(0, Math.sin(wave - Math.PI));\n      offsets.leftY -= 13 * left;\n      offsets.rightY -= 13 * right;\n      target.leftHeight += 6 * left - 4 * (1 - left);\n      target.rightHeight += 6 * right - 4 * (1 - right);\n      break;\n    }\n    case \"talking\": {\n      Object.assign(target, STATIC_POSES.talking);\n      const envelope = clamp(Math.sin(elapsed * 1.15) + 0.6, 0, 1);\n      const syllable = Math.abs(Math.sin(elapsed * 9.5)) * (0.65 + 0.35 * Math.sin(elapsed * 3.3));\n      const speech = syllable * envelope;\n      offsets.leftY -= 5 * speech;\n      offsets.rightY -= 5 * speech;\n      target.leftHeight += 7 * speech;\n      target.rightHeight += 7 * speech;\n      offsets.scaleY += 0.022 * speech;\n      offsets.scaleX -= 0.012 * speech;\n      autoBlink(2, 4);\n      break;\n    }\n    case \"happy\": {\n      Object.assign(target, STATIC_POSES.happy);\n      const cycle = elapsed % 1.9;\n      if (cycle < 0.9) {\n        const progress = (cycle % 0.45) / 0.45;\n        const height = Math.sin(Math.PI * progress);\n        const landing = Math.max(0, 1 - Math.min(progress, 1 - progress) / 0.12);\n        offsets.bodyY -= 22 * height;\n        offsets.scaleY += 0.05 * height - 0.07 * landing;\n        offsets.scaleX += -0.03 * height + 0.06 * landing;\n        offsets.rotation += 5 * Math.sin(cycle * 7);\n      }\n      break;\n    }\n    case \"confused\": {\n      Object.assign(target, STATIC_POSES.confused, {\n        gx: -4 + 13 * Math.sign(Math.sin(elapsed * 0.9 + 0.4)),\n      });\n      const cycle = elapsed % 3.4;\n      offsets.rotation += 6 * Math.sin(cycle * 28) * Math.exp(-cycle * 5);\n      offsets.bodyY -= 3 * Math.exp(-cycle * 6);\n      autoBlink(2.5, 4);\n      break;\n    }\n    case \"sleeping\":\n      Object.assign(target, STATIC_POSES.sleeping);\n      offsets.scaleY += 0.028 * Math.sin(elapsed * 1.4);\n      break;\n    case \"boo\": {\n      // Hides and peeks around, then jumps out.\n      const cycle = elapsed % 3.2;\n      if (cycle < 1.1) {\n        Object.assign(target, {\n          gx: 18 * Math.sin(cycle * 5),\n          gy: -10,\n          leftHeight: 22,\n          rightHeight: 22,\n          scaleX: 1.05,\n          scaleY: 0.86,\n        });\n      } else {\n        const progress = cycle - 1.1;\n        Object.assign(target, STATIC_POSES.boo);\n        offsets.scale = 1 + 0.22 * Math.exp(-progress * 5) * Math.cos(progress * 18);\n        offsets.rotation += 7 * Math.sin(progress * 34) * Math.exp(-progress * 4);\n        offsets.bodyY -= 14 * Math.exp(-progress * 6);\n      }\n      break;\n    }\n    case \"idle\":\n    default:\n      applyIdle(target, offsets);\n  }\n}\n\nfunction render(pose: Pose, offsets: FrameOffsets = createOffsets(), pixelSnap = false) {\n  if (\n    !bodyRef.value ||\n    !clipRef.value ||\n    !gradientRef.value ||\n    !leftEyeRef.value ||\n    !rightEyeRef.value ||\n    !leftHappyRef.value ||\n    !rightHappyRef.value\n  ) {\n    return;\n  }\n\n  const scale = offsets.scale;\n  const scaleX = (pose.scaleX + offsets.scaleX) * scale;\n  const scaleY = (pose.scaleY + offsets.scaleY) * scale;\n  const bodyY = pose.bodyY + offsets.bodyY;\n  const rotation = pose.rotation + offsets.rotation;\n  const unit = unitsPerDevicePixel();\n  // Moving frames keep sub-pixel precision so motion stays smooth; only an untransformed resting body is snapped.\n  const snapUnit = pixelSnap && rotation === 0 && scaleX === 1 && scaleY === 1 && bodyY === 0 ? unit : 0;\n\n  // Firefox rasterizes an element whose transform changes every frame as a texture and rotates it without\n  // edge anti-aliasing, which stair-steps the body outline. Baking the motion into path geometry (and into\n  // per-element matrices for the eyes, sheen, grain, and gradient) keeps every edge vector-rendered and smooth.\n  const matrix = bodyMatrix(rotation, scaleX, scaleY, bodyY);\n  const transform = matrixAttribute(matrix);\n  const { bodyRadius, eyeHeight, eyeRadius, eyeWidth, homeX, homeY, spread: shapeSpread } = activeShape;\n  const body = snapBox({ height: BODY_SIZE, width: BODY_SIZE, x: 0, y: 0 }, snapUnit);\n  const bodyPath = roundedRectPath(matrix, body, bodyRadius);\n  if (activeTextured) setAttribute(clipRef.value, \"d\", bodyPath);\n  if (activeVariant === \"outline\") {\n    // The outline is stroked inside the body bounds; at rest it is a whole number of device pixels thick.\n    const stroke = snapUnit > 0 ? Math.max(unit, Math.round(OUTLINE_STROKE / unit) * unit) : OUTLINE_STROKE;\n    setAttribute(\n      bodyRef.value,\n      \"d\",\n      roundedRectPath(matrix, insetBox(body, stroke / 2), Math.max(0, bodyRadius - stroke / 2)),\n    );\n    setAttribute(bodyRef.value, \"stroke-width\", stroke.toFixed(3));\n  } else {\n    setAttribute(bodyRef.value, \"d\", bodyPath);\n  }\n\n  let leftBlink = 1;\n  let rightBlink = 1;\n  let activeBlinks = 0;\n  for (const entry of blinks) {\n    const progress = (elapsed - entry.start) / entry.duration;\n    if (progress >= 0 && progress <= 1) {\n      const amount = 1 - 0.94 * Math.sin(Math.PI * progress);\n      if (entry.side !== \"right\") leftBlink = Math.min(leftBlink, amount);\n      if (entry.side !== \"left\") rightBlink = Math.min(rightBlink, amount);\n    }\n    if (progress <= 1) blinks[activeBlinks++] = entry;\n  }\n  blinks.length = activeBlinks;\n\n  const happy = clamp(pose.happy, 0, 1);\n  const widthScale = eyeWidth / BASE_EYE_WIDTH;\n  const heightScale = eyeHeight / BASE_EYE_HEIGHT;\n  const spread = (shapeSpread * pose.spread) / BASE_SPREAD;\n  const gx = pose.gx + homeX - BASE_HOME_X;\n  const gy = pose.gy + homeY - BASE_HOME_Y;\n  const leftX = BODY_CENTER + gx - spread / 2;\n  const rightX = BODY_CENTER + gx + spread / 2;\n  const leftY = BODY_CENTER + gy + offsets.leftY;\n  const rightY = BODY_CENTER + gy + offsets.rightY;\n  const leftWidth = pose.leftWidth * widthScale * (1 + (1 - leftBlink) * 0.25);\n  const rightWidth = pose.rightWidth * widthScale * (1 + (1 - rightBlink) * 0.25);\n  const leftHeight = pose.leftHeight * heightScale * leftBlink * (1 - happy * 0.92);\n  const rightHeight = pose.rightHeight * heightScale * rightBlink * (1 - happy * 0.92);\n\n  if (activeHalloween) {\n    renderTriangleEye(leftEyeRef.value, matrix, leftX, leftY, leftWidth, leftHeight);\n    renderTriangleEye(rightEyeRef.value, matrix, rightX, rightY, rightWidth, rightHeight);\n    // Layered sines read as an organic candle flame.\n    const flame =\n      0.5 +\n      0.5 *\n        (0.5 * Math.sin(elapsed * 11.3) + 0.3 * Math.sin(elapsed * 17.9 + 1.3) + 0.2 * Math.sin(elapsed * 29.1 + 2.1));\n    // Flat icons keep solid eyes; a flickering opacity would leave mono's cutout half see-through.\n    if (activeTextured && litRef.value) setOpacity(litRef.value, (1 - CANDLE_FLICKER * 0.35 * flame).toFixed(3));\n    else if (litRef.value) removeOpacity(litRef.value);\n    if (candleRef.value) {\n      setOpacity(candleRef.value, (0.85 - CANDLE_FLICKER * 0.55 * flame).toFixed(3));\n      setAttribute(candleRef.value, \"transform\", transform);\n    }\n  } else {\n    renderEye(leftEyeRef.value, transform, leftX, leftY, leftWidth, leftHeight, eyeRadius, snapUnit);\n    renderEye(rightEyeRef.value, transform, rightX, rightY, rightWidth, rightHeight, eyeRadius, snapUnit);\n  }\n\n  const happyOpacity = happy.toFixed(3);\n  if (happyOpacity !== \"0.000\" || happyEyesVisible) {\n    renderHappyEye(leftHappyRef.value, matrix, leftX, leftY, widthScale, happyOpacity, happy);\n    renderHappyEye(rightHappyRef.value, matrix, rightX, rightY, widthScale, happyOpacity, happy);\n    happyEyesVisible = happyOpacity !== \"0.000\";\n  }\n\n  if (activeTextured) {\n    setAttribute(\n      gradientRef.value,\n      \"gradientTransform\",\n      `${transform} rotate(${gradientPhase.toFixed(2)} ${BODY_CENTER} ${BODY_CENTER})`,\n    );\n  }\n\n  if (sheenRef.value) {\n    const sheenOpacity = (clamp(pose.sheen, 0, 1) * SHEEN_STRENGTH).toFixed(3);\n    if (sheenOpacity !== \"0.000\" || sheenVisible) {\n      setAttribute(sheenRef.value, \"opacity\", sheenOpacity);\n      sheenVisible = sheenOpacity !== \"0.000\";\n      if (sheenVisible) {\n        const width = sheen.width * BODY_SIZE;\n        const start = -46 - width;\n        const progress = (sheenTime % sheen.duration) / sheen.duration;\n        setAttribute(sheenRef.value, \"width\", width.toFixed(1));\n        setAttribute(\n          sheenRef.value,\n          \"transform\",\n          `${transform} translate(${(start + progress * (310 - start)).toFixed(1)} 0) skewX(${90 - sheen.angle})`,\n        );\n      }\n    }\n  }\n\n  if (ringRef.value && (pose.glow > 0 || ringVisible)) {\n    const glowOpacity =\n      pose.glow > 0\n        ? (clamp(pose.glow, 0, 1) * activeRingStrength * (0.4 + 0.3 * Math.sin(elapsed * 3.2))).toFixed(3)\n        : \"0.000\";\n    setAttribute(ringRef.value, \"opacity\", glowOpacity);\n    ringVisible = glowOpacity !== \"0.000\";\n    if (ringVisible) {\n      setAttribute(\n        ringRef.value,\n        \"d\",\n        roundedRectPath(matrix, insetBox(body, RING_INSET), bodyRadius + RING_RADIUS_OFFSET),\n      );\n      // At small sizes the ring would thin below one device pixel and shimmer as it pulses, so keep a pixel floor.\n      setAttribute(ringRef.value, \"stroke-width\", Math.max(RING_STROKE, unit).toFixed(3));\n    }\n  }\n\n  if (activeTextured) renderGrain(transform, !isStatic());\n}\n\nfunction renderEye(\n  element: SVGRectElement | SVGPathElement,\n  transform: string,\n  centerX: number,\n  centerY: number,\n  width: number,\n  height: number,\n  radius: number,\n  snapUnit: number,\n) {\n  const minWidth = Math.max(0.5, width);\n  const minHeight = Math.max(0.5, height);\n  const box = snapBox(\n    { height: minHeight, width: minWidth, x: centerX - minWidth / 2, y: centerY - minHeight / 2 },\n    snapUnit,\n  );\n  setAttribute(element, \"x\", box.x.toFixed(3));\n  setAttribute(element, \"y\", box.y.toFixed(3));\n  setAttribute(element, \"width\", box.width.toFixed(3));\n  setAttribute(element, \"height\", box.height.toFixed(3));\n  setAttribute(element, \"rx\", Math.min(radius, box.width / 2, box.height / 2).toFixed(3));\n  setAttribute(element, \"transform\", transform);\n}\n\n/** A jack-o'-lantern eye: an upward triangle that blinking squashes flat. Its stroke rounds the corners. */\nfunction renderTriangleEye(\n  element: SVGRectElement | SVGPathElement,\n  matrix: Matrix,\n  centerX: number,\n  centerY: number,\n  width: number,\n  height: number,\n) {\n  const halfWidth = Math.max(0.5, width) / 2;\n  const halfHeight = Math.max(0.5, height) / 2;\n  setAttribute(\n    element,\n    \"d\",\n    `M${point(matrix, centerX - halfWidth, centerY + halfHeight)} L${point(matrix, centerX + halfWidth, centerY + halfHeight)} L${point(matrix, centerX, centerY - halfHeight)}Z`,\n  );\n}\n\nfunction renderHappyEye(\n  element: SVGPathElement,\n  matrix: Matrix,\n  centerX: number,\n  centerY: number,\n  widthScale: number,\n  opacity: string,\n  happy: number,\n) {\n  setAttribute(element, \"opacity\", opacity);\n  if (opacity === \"0.000\") return;\n  // The arc rises into place as it fades in.\n  const drop = 6 * (1 - happy);\n  const halfWidth = 14 * widthScale;\n  setAttribute(\n    element,\n    \"d\",\n    `M${point(matrix, centerX - halfWidth, centerY + 7 + drop)} Q${point(matrix, centerX, centerY - 13 + drop)} ${point(matrix, centerX + halfWidth, centerY + 7 + drop)}`,\n  );\n}\n\nfunction renderGrain(transform: string, animating: boolean) {\n  if (!grainRef.value || !noiseRef.value) return;\n  const firstFrame = getFirstNoiseFrame();\n  if (!firstFrame) {\n    setAttribute(grainRef.value, \"display\", \"none\");\n    return;\n  }\n  removeAttribute(grainRef.value, \"display\");\n  const imageChanged = grainImage !== noiseRef.value;\n  if (imageChanged) grainImage = noiseRef.value;\n  if (imageChanged || (animating && elapsed >= nextGrain)) {\n    nextGrain = elapsed + 1 / GRAIN_FPS;\n    const index = animating ? Math.floor(Math.random() * noiseFrames.length) : 0;\n    setAttribute(noiseRef.value, \"href\", noiseFrames[index] ?? firstFrame);\n    grainRef.value.dataset.offsetX = animating ? randomBetween(0, GRAIN_SIZE).toFixed(1) : \"0\";\n    grainRef.value.dataset.offsetY = animating ? randomBetween(0, GRAIN_SIZE).toFixed(1) : \"0\";\n  }\n  setAttribute(\n    grainRef.value,\n    \"transform\",\n    `${transform} translate(${grainRef.value.dataset.offsetX} ${grainRef.value.dataset.offsetY})`,\n  );\n}\n\n// WebKit ignores CSS masks on SVG children, so `.pv-sheen` can't be applied directly.\n// The sweep runs in JS instead, timed and shaped by the same tokens.\nfunction readSheenTokens() {\n  if (!svgRef.value) return;\n  const style = svgRef.value.ownerDocument.defaultView?.getComputedStyle(svgRef.value);\n  if (!style) return;\n  const durationValue = style.getPropertyValue(\"--sheen-duration\").trim();\n  const duration = Number.parseFloat(durationValue) / (durationValue.endsWith(\"ms\") ? 1000 : 1);\n  const angle = Number.parseFloat(style.getPropertyValue(\"--sheen-angle\"));\n  const width = Number.parseFloat(style.getPropertyValue(\"--sheen-width\"));\n  sheen = {\n    angle: Number.isFinite(angle) ? angle : SHEEN_DEFAULTS.angle,\n    duration: duration > 0 ? duration : SHEEN_DEFAULTS.duration,\n    width: width > 0 ? width / 100 : SHEEN_DEFAULTS.width,\n  };\n}\n\nfunction renderStaticPose() {\n  Object.assign(current, REST, STATIC_POSES[props.emote]);\n  gradientPhase = 0;\n  sheenTime = 0;\n  render(current, createOffsets(), true);\n}\n\nfunction isStatic() {\n  return !activeAnimated || browser.reducedMotion.value || !browser.animationAvailable.value;\n}\n\nfunction frame(nowMilliseconds: number) {\n  if (!activeAnimated || !browser.visible.value || browser.reducedMotion.value || !browser.intersecting.value) return;\n  if (nowMilliseconds - lastRender < MIN_FRAME_INTERVAL) {\n    scheduleFrame();\n    return;\n  }\n  lastRender = nowMilliseconds;\n\n  const now = nowMilliseconds / 1000;\n  const dt = lastFrame ? Math.min(0.05, now - lastFrame) : 0;\n  lastFrame = now;\n  elapsed += dt;\n\n  Object.assign(frameTarget, REST);\n  resetOffsets();\n  motionSpeed = 1;\n  applyEmote(activeEmote, frameTarget, frameOffsets, dt, now);\n\n  for (const key of POSE_KEYS) {\n    const delta = frameTarget[key] - current[key];\n    if (Math.abs(delta) < SPRING_POSITION_EPSILON && Math.abs(velocity[key]) < SPRING_VELOCITY_EPSILON) {\n      current[key] = frameTarget[key];\n      velocity[key] = 0;\n      continue;\n    }\n    const [baseStiffness, dampingRatio] = SPRINGS[key] ?? DEFAULT_SPRING;\n    // A spring's frequency goes with the square root of its stiffness, so scale stiffness by speed squared.\n    const stiffness = baseStiffness * motionSpeed * motionSpeed;\n    const damping = 2 * Math.sqrt(stiffness) * dampingRatio;\n    velocity[key] += (stiffness * delta - damping * velocity[key]) * dt;\n    current[key] += velocity[key] * dt;\n  }\n\n  gradientPhase = (gradientPhase + current.gradientSpeed * dt) % 360;\n  if (current.sheen > 0.01) sheenTime += dt;\n  render(current, frameOffsets);\n  scheduleFrame();\n}\n\nfunction scheduleFrame() {\n  if (\n    !activeAnimated ||\n    browser.reducedMotion.value ||\n    !browser.visible.value ||\n    !browser.intersecting.value ||\n    !browser.animationAvailable.value\n  ) {\n    return;\n  }\n  if (activeTextured) prepareNoiseFrames();\n  browser.requestFrame(frame);\n}\n\nfunction resetFrameClock() {\n  lastFrame = 0;\n  lastRender = -Infinity;\n}\n\nwatch(\n  () => [props.animated, props.calm, props.emote, props.theme, props.variant],\n  () => {\n    syncRenderOptions();\n    elapsed = 0;\n    glancing.next = 0.8;\n    blinks = [];\n    nextBlink = firstBlinkDelay();\n    nextGrain = 0;\n    if (isStatic()) {\n      browser.cancelFrame();\n      renderStaticPose();\n    } else {\n      resetFrameClock();\n      scheduleFrame();\n    }\n  },\n  // Theme and variant swap which shapes exist, so render after the DOM has been patched.\n  { flush: \"post\" },\n);\n\nwatch(\n  browser.visible,\n  (visible) => {\n    if (!visible) {\n      browser.cancelFrame();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nwatch(\n  browser.intersecting,\n  (intersecting) => {\n    if (!intersecting) {\n      browser.cancelFrame();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nwatch(\n  browser.reducedMotion,\n  (reducedMotion) => {\n    if (reducedMotion || !activeAnimated) {\n      browser.cancelFrame();\n      renderStaticPose();\n      return;\n    }\n    resetFrameClock();\n    scheduleFrame();\n  },\n  { flush: \"sync\" },\n);\n\nonMounted(() => {\n  browser.updateBounds();\n  readSheenTokens();\n  if (isStatic()) renderStaticPose();\n  else scheduleFrame();\n});\n</script>\n\n<template>\n  <svg\n    ref=\"svgRef\"\n    class=\"pv-ask-tq-buddy\"\n    :data-calm=\"calm || undefined\"\n    :data-emote=\"emote\"\n    :data-size=\"size\"\n    :data-theme=\"theme\"\n    :data-variant=\"variant\"\n    data-testid=\"pv-ask-tq-buddy\"\n    :aria-label=\"`asktq-${emote}`\"\n    role=\"img\"\n    :viewBox=\"VIEWBOX\"\n    shape-rendering=\"geometricPrecision\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n  >\n    <defs>\n      <linearGradient\n        :id=\"gradientId\"\n        ref=\"gradientRef\"\n        gradientUnits=\"userSpaceOnUse\"\n        x1=\"29\"\n        y1=\"36.5\"\n        x2=\"279\"\n        y2=\"292\"\n      >\n        <stop class=\"pv-ask-tq-buddy__gradient-start\" />\n        <stop class=\"pv-ask-tq-buddy__gradient-end\" offset=\"1\" />\n      </linearGradient>\n      <clipPath :id=\"clipId\">\n        <path ref=\"clipRef\" />\n      </clipPath>\n      <template v-if=\"textured\">\n        <linearGradient :id=\"sheenId\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\">\n          <stop class=\"pv-ask-tq-buddy__sheen-stop\" stop-opacity=\"0\" />\n          <stop class=\"pv-ask-tq-buddy__sheen-stop pv-ask-tq-buddy__sheen-peak\" offset=\".5\" />\n          <stop class=\"pv-ask-tq-buddy__sheen-stop\" offset=\"1\" stop-opacity=\"0\" />\n        </linearGradient>\n        <pattern :id=\"noiseId\" patternUnits=\"userSpaceOnUse\" :width=\"GRAIN_SIZE\" :height=\"GRAIN_SIZE\">\n          <image ref=\"noiseRef\" :width=\"GRAIN_SIZE\" :height=\"GRAIN_SIZE\" preserveAspectRatio=\"none\" />\n        </pattern>\n      </template>\n      <template v-if=\"halloween && textured\">\n        <filter :id=\"glowId\" x=\"-60%\" y=\"-60%\" width=\"220%\" height=\"220%\">\n          <feGaussianBlur :stdDeviation=\"7 * EYE_GLOW\" result=\"blur\" />\n          <feMerge>\n            <feMergeNode in=\"blur\" />\n            <feMergeNode in=\"SourceGraphic\" />\n          </feMerge>\n        </filter>\n        <radialGradient :id=\"candleId\" cx=\"50%\" cy=\"42%\" r=\"58%\">\n          <stop class=\"pv-ask-tq-buddy__candle-stop\" stop-opacity=\".5\" />\n          <stop class=\"pv-ask-tq-buddy__candle-stop\" offset=\"1\" stop-opacity=\"0\" />\n        </radialGradient>\n      </template>\n      <!-- Solid variants cut the eyes out by reusing the live eye shapes as a mask. -->\n      <mask v-if=\"silhouette\" :id=\"maskId\" maskUnits=\"userSpaceOnUse\" v-bind=\"MASK_BOUNDS\">\n        <rect v-bind=\"MASK_BOUNDS\" fill=\"#fff\" />\n        <use :href=\"`#${eyesId}`\" class=\"pv-ask-tq-buddy__eye-cutout\" />\n      </mask>\n    </defs>\n\n    <path\n      v-if=\"textured\"\n      ref=\"ringRef\"\n      class=\"pv-ask-tq-buddy__ring\"\n      fill=\"none\"\n      :stroke-width=\"RING_STROKE\"\n      opacity=\"0\"\n    />\n    <path ref=\"bodyRef\" class=\"pv-ask-tq-buddy__body\" :mask=\"silhouette ? `url(#${maskId})` : undefined\" />\n    <g v-if=\"textured\" :clip-path=\"`url(#${clipId})`\">\n      <rect v-if=\"halloween\" ref=\"candleRef\" width=\"191\" height=\"191\" :fill=\"`url(#${candleId})`\" />\n      <rect ref=\"sheenRef\" x=\"0\" y=\"-60\" height=\"311\" :fill=\"`url(#${sheenId})`\" opacity=\"0\" />\n    </g>\n    <!-- Inline styles, not classes, so the mask's <use> copy can recolor the eyes through inherited properties. -->\n    <g :id=\"eyesId\" style=\"opacity: var(--pv-ask-tq-buddy-eye-visibility)\">\n      <g\n        v-if=\"halloween\"\n        ref=\"litRef\"\n        :filter=\"textured ? `url(#${glowId})` : undefined\"\n        stroke-linejoin=\"round\"\n        :stroke-width=\"triangleStroke\"\n      >\n        <path ref=\"leftEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill); stroke: var(--pv-ask-tq-buddy-eye-fill)\" />\n        <path\n          ref=\"rightEyeRef\"\n          style=\"fill: var(--pv-ask-tq-buddy-eye-fill); stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        />\n      </g>\n      <template v-else>\n        <rect ref=\"leftEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill)\" />\n        <rect ref=\"rightEyeRef\" style=\"fill: var(--pv-ask-tq-buddy-eye-fill)\" />\n      </template>\n      <path\n        ref=\"leftHappyRef\"\n        fill=\"none\"\n        style=\"stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        :stroke-width=\"happyStroke\"\n        stroke-linecap=\"round\"\n        stroke-linejoin=\"round\"\n        opacity=\"0\"\n      />\n      <path\n        ref=\"rightHappyRef\"\n        fill=\"none\"\n        style=\"stroke: var(--pv-ask-tq-buddy-eye-fill)\"\n        :stroke-width=\"happyStroke\"\n        stroke-linecap=\"round\"\n        stroke-linejoin=\"round\"\n        opacity=\"0\"\n      />\n    </g>\n    <g v-if=\"textured\" :clip-path=\"`url(#${clipId})`\">\n      <rect\n        ref=\"grainRef\"\n        x=\"-191\"\n        y=\"-191\"\n        width=\"573\"\n        height=\"573\"\n        :fill=\"`url(#${noiseId})`\"\n        :opacity=\"grainOpacity\"\n      />\n    </g>\n  </svg>\n</template>\n\n<style scoped>\n.pv-ask-tq-buddy {\n  --pv-ask-tq-buddy-gradient-end: #fff;\n  --pv-ask-tq-buddy-gradient-start: #36c5ba;\n  --pv-ask-tq-buddy-solid: #36c5ba;\n  --pv-ask-tq-buddy-eye: #fff;\n  --pv-ask-tq-buddy-eye-fill: var(--pv-ask-tq-buddy-eye);\n  --pv-ask-tq-buddy-eye-visibility: 1;\n\n  display: block;\n  width: 3rem;\n  height: auto;\n  overflow: visible;\n}\n\n.pv-ask-tq-buddy[data-theme=\"halloween\"] {\n  --pv-ask-tq-buddy-gradient-end: #8f2a04;\n  --pv-ask-tq-buddy-gradient-start: #ff9b2f;\n  --pv-ask-tq-buddy-eye: #ffd36b;\n}\n\n.pv-ask-tq-buddy:is([data-variant=\"mono\"], [data-variant=\"solid\"]) {\n  --pv-ask-tq-buddy-eye-visibility: 0;\n}\n\n.pv-ask-tq-buddy[data-variant=\"outline\"] {\n  --pv-ask-tq-buddy-eye-fill: currentColor;\n}\n\n.pv-ask-tq-buddy[data-size=\"xs\"] {\n  width: 1.25rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"sm\"] {\n  width: 2rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"md\"] {\n  width: 3rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"lg\"] {\n  width: 4rem;\n}\n\n.pv-ask-tq-buddy[data-size=\"xl\"] {\n  width: 6rem;\n}\n\n.pv-ask-tq-buddy__gradient-start {\n  stop-color: var(--pv-ask-tq-buddy-gradient-start);\n}\n\n.pv-ask-tq-buddy__gradient-end {\n  stop-color: var(--pv-ask-tq-buddy-gradient-end);\n}\n\n.pv-ask-tq-buddy__sheen-stop {\n  stop-color: var(--sheen-color, #fff);\n}\n\n.pv-ask-tq-buddy__sheen-peak {\n  stop-opacity: var(--sheen-opacity, 0.8);\n}\n\n.pv-ask-tq-buddy__candle-stop {\n  stop-color: var(--pv-ask-tq-buddy-eye);\n}\n\n.pv-ask-tq-buddy__body {\n  fill: v-bind(\"`url(#${gradientId})`\");\n}\n\n.pv-ask-tq-buddy[data-variant=\"mono\"] .pv-ask-tq-buddy__body {\n  fill: currentColor;\n}\n\n.pv-ask-tq-buddy[data-variant=\"solid\"] .pv-ask-tq-buddy__body {\n  fill: var(--pv-ask-tq-buddy-solid);\n}\n\n.pv-ask-tq-buddy[data-variant=\"outline\"] .pv-ask-tq-buddy__body {\n  fill: none;\n  stroke: currentColor;\n}\n\n.pv-ask-tq-buddy__eye-cutout {\n  --pv-ask-tq-buddy-eye-fill: #000;\n  --pv-ask-tq-buddy-eye-visibility: 1;\n}\n\n.pv-ask-tq-buddy__ring {\n  stroke: var(--pv-ask-tq-buddy-gradient-start);\n}\n</style>\n","<script setup lang=\"ts\">\nimport AskTqBuddy from \"../AskTqBuddy/AskTqBuddy.vue\";\nimport type { AskTqBuddyEmote, AskTqBuddyTheme, AskTqBuddyVariant } from \"../AskTqBuddy/types\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport { PvButtonSize } from \"@/components/base/PvButton/types.ts\";\nimport { pvButtonSizeToClass } from \"@/components/base/PvButton/helpers.ts\";\nimport { computed } from \"vue\";\n\ninterface PvAiButtonProps {\n  /** Size of the AI button */\n  size?: PvButtonSize;\n  /** Text label displayed next to the AI icon. Omit for icon-only. */\n  label?: string;\n  /** Show a loading spinner in place of the icon and label */\n  loading?: boolean;\n  /** Prevent the button from being clicked */\n  disabled?: boolean;\n  /** Hide AiFilled Icon */\n  hideIcon?: boolean;\n  /** Show the AskTqBuddy mascot in place of the AiFilled icon */\n  buddy?: boolean;\n  /** Expression shown by the buddy when `buddy` is set */\n  buddyEmote?: AskTqBuddyEmote;\n  /** Rendering style of the buddy when `buddy` is set */\n  buddyVariant?: AskTqBuddyVariant;\n  /** Seasonal theme of the buddy when `buddy` is set */\n  buddyTheme?: AskTqBuddyTheme;\n  /** Animate the buddy's emote when `buddy` is set */\n  buddyAnimated?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvAiButtonProps>(), {\n  size: \"md\",\n  label: \"AskTQ\",\n  hideIcon: false,\n  buddy: false,\n  buddyEmote: \"idle\",\n  buddyVariant: \"default\",\n  buddyTheme: \"default\",\n  buddyAnimated: false,\n});\n\nconst classes = computed(() => {\n  const output = [\"pv-button-ai\"];\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n\n// The xs buddy overhangs the 1rem icon box evenly.\nconst buddyStyle = {\n  flexShrink: 0,\n  margin: \"-0.125rem\",\n};\n\n// Set aria-label when there is no visible text: icon-only mode or loading state (spinner replaces label).\nconst computedAriaLabel = computed(() => (!props.label || props.loading ? props.label || undefined : undefined));\n</script>\n\n<template>\n  <button :disabled=\"disabled\" :class=\"classes\" :aria-label=\"computedAriaLabel\">\n    <PvSpinner v-if=\"loading\" :size=\"size\" />\n    <template v-else>\n      <template v-if=\"!hideIcon\">\n        <AskTqBuddy\n          v-if=\"buddy\"\n          aria-hidden=\"true\"\n          class=\"pv-text-brand\"\n          :style=\"buddyStyle\"\n          :animated=\"buddyAnimated\"\n          calm\n          :emote=\"buddyEmote\"\n          size=\"xs\"\n          :theme=\"buddyTheme\"\n          :variant=\"buddyVariant\"\n        />\n        <PvIcon v-else class=\"pv-text-brand\" name=\"ai-filled\" />\n      </template>\n      <span v-if=\"label\">{{ label }}</span>\n    </template>\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport AskTqBuddy from \"../AskTqBuddy/AskTqBuddy.vue\";\nimport type { AskTqBuddyEmote, AskTqBuddyTheme, AskTqBuddyVariant } from \"../AskTqBuddy/types\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport { PvButtonSize } from \"@/components/base/PvButton/types.ts\";\nimport { pvButtonSizeToClass } from \"@/components/base/PvButton/helpers.ts\";\nimport { computed } from \"vue\";\n\ninterface PvAiButtonProps {\n  /** Size of the AI button */\n  size?: PvButtonSize;\n  /** Text label displayed next to the AI icon. Omit for icon-only. */\n  label?: string;\n  /** Show a loading spinner in place of the icon and label */\n  loading?: boolean;\n  /** Prevent the button from being clicked */\n  disabled?: boolean;\n  /** Hide AiFilled Icon */\n  hideIcon?: boolean;\n  /** Show the AskTqBuddy mascot in place of the AiFilled icon */\n  buddy?: boolean;\n  /** Expression shown by the buddy when `buddy` is set */\n  buddyEmote?: AskTqBuddyEmote;\n  /** Rendering style of the buddy when `buddy` is set */\n  buddyVariant?: AskTqBuddyVariant;\n  /** Seasonal theme of the buddy when `buddy` is set */\n  buddyTheme?: AskTqBuddyTheme;\n  /** Animate the buddy's emote when `buddy` is set */\n  buddyAnimated?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvAiButtonProps>(), {\n  size: \"md\",\n  label: \"AskTQ\",\n  hideIcon: false,\n  buddy: false,\n  buddyEmote: \"idle\",\n  buddyVariant: \"default\",\n  buddyTheme: \"default\",\n  buddyAnimated: false,\n});\n\nconst classes = computed(() => {\n  const output = [\"pv-button-ai\"];\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n\n// The xs buddy overhangs the 1rem icon box evenly.\nconst buddyStyle = {\n  flexShrink: 0,\n  margin: \"-0.125rem\",\n};\n\n// Set aria-label when there is no visible text: icon-only mode or loading state (spinner replaces label).\nconst computedAriaLabel = computed(() => (!props.label || props.loading ? props.label || undefined : undefined));\n</script>\n\n<template>\n  <button :disabled=\"disabled\" :class=\"classes\" :aria-label=\"computedAriaLabel\">\n    <PvSpinner v-if=\"loading\" :size=\"size\" />\n    <template v-else>\n      <template v-if=\"!hideIcon\">\n        <AskTqBuddy\n          v-if=\"buddy\"\n          aria-hidden=\"true\"\n          class=\"pv-text-brand\"\n          :style=\"buddyStyle\"\n          :animated=\"buddyAnimated\"\n          calm\n          :emote=\"buddyEmote\"\n          size=\"xs\"\n          :theme=\"buddyTheme\"\n          :variant=\"buddyVariant\"\n        />\n        <PvIcon v-else class=\"pv-text-brand\" name=\"ai-filled\" />\n      </template>\n      <span v-if=\"label\">{{ label }}</span>\n    </template>\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useTemplateRef } from \"vue\";\nimport { PvTooltipPositions, PvTooltipVariants, PvTooltipSize } from \"./types\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\n\ninterface PvTooltipProps {\n  /** Color theme variant */\n  variant?: PvTooltipVariants;\n  /** Position of the tooltip relative to the trigger element */\n  tooltipPosition?: PvTooltipPositions;\n  /** Accessibility label reference ID linking trigger to tooltip content */\n  ariaLabelledBy?: string;\n  /** Size of the tooltip content area */\n  size?: PvTooltipSize;\n  /** When true, tooltip hides immediately when cursor leaves the trigger */\n  disableInteractive?: boolean;\n  /** Delay in milliseconds before showing the tooltip on hover. Keyboard focus is never delayed. */\n  delay?: number;\n}\n\nconst props = withDefaults(defineProps<PvTooltipProps>(), {\n  variant: \"white\",\n  ariaLabelledBy: \"ariaLabelledById\",\n  tooltipPosition: \"top-right\",\n  size: \"md\",\n  disableInteractive: false,\n  delay: 0,\n});\n\nconst rootRef = useTemplateRef<HTMLElement | null>(\"rootRef\");\n// `useSlotPresence` needs the host to see light DOM children as a web component.\nconst slotHost = computed(() => {\n  const rootNode = rootRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\n\nconst { present: hasTooltip } = useSlotPresence(\"tooltip-content\", { host: slotHost });\n\n// Visibility stays in CSS (`.pv-tooltip:hover > [role=\"tooltip\"]`). A pending\n// delay only suppresses it with an inline `display: none`, which outranks the\n// stylesheet; dropping that style hands control back to the `:hover` rule.\nconst isDelayed = computed(() => props.delay > 0);\n\n// Keyboard focus is deliberately not delayed: the delay exists to stop tooltips\n// flashing open as a pointer transits, and a tabbed-to element is already committed.\nconst focused = ref(false);\nconst openDelayElapsed = ref(false);\n\nlet openDelayTimeout: ReturnType<typeof setTimeout> | undefined;\n\nconst clearOpenDelayTimeout = () => {\n  if (openDelayTimeout) clearTimeout(openDelayTimeout);\n  openDelayTimeout = undefined;\n};\n\nconst tooltipVisible = computed(() => !isDelayed.value || focused.value || openDelayElapsed.value);\n\nconst handleMouseEnter = () => {\n  if (!isDelayed.value) return;\n  clearOpenDelayTimeout();\n  openDelayTimeout = setTimeout(() => {\n    openDelayTimeout = undefined;\n    openDelayElapsed.value = true;\n  }, props.delay);\n};\n\nconst handleMouseLeave = () => {\n  if (!isDelayed.value) return;\n  clearOpenDelayTimeout();\n  openDelayElapsed.value = false;\n};\n\nconst handleFocusIn = () => {\n  if (isDelayed.value) focused.value = true;\n};\n\nconst handleFocusOut = () => {\n  if (isDelayed.value) focused.value = false;\n};\n\nonBeforeUnmount(clearOpenDelayTimeout);\n</script>\n\n<template>\n  <div\n    ref=\"rootRef\"\n    data-testid=\"pv-tooltip\"\n    :class=\"[\n      {\n        'pv-tooltip': hasTooltip,\n        'pv-tooltip-small': hasTooltip && size === 'sm',\n      },\n    ]\"\n    :data-position=\"tooltipPosition\"\n    :data-style=\"variant === 'white' ? 'white' : 'dark'\"\n    :data-static=\"disableInteractive ? true : undefined\"\n    :aria-labelledby=\"hasTooltip ? ariaLabelledBy : undefined\"\n    @mouseenter=\"handleMouseEnter\"\n    @mouseleave=\"handleMouseLeave\"\n    @focusin=\"handleFocusIn\"\n    @focusout=\"handleFocusOut\"\n  >\n    <slot name=\"label\" />\n    <div v-if=\"hasTooltip\" v-show=\"tooltipVisible\" role=\"tooltip\" :id=\"ariaLabelledBy\" data-testid=\"pv-tooltip-content\">\n      <slot name=\"tooltip-content\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useTemplateRef } from \"vue\";\nimport { PvTooltipPositions, PvTooltipVariants, PvTooltipSize } from \"./types\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\n\ninterface PvTooltipProps {\n  /** Color theme variant */\n  variant?: PvTooltipVariants;\n  /** Position of the tooltip relative to the trigger element */\n  tooltipPosition?: PvTooltipPositions;\n  /** Accessibility label reference ID linking trigger to tooltip content */\n  ariaLabelledBy?: string;\n  /** Size of the tooltip content area */\n  size?: PvTooltipSize;\n  /** When true, tooltip hides immediately when cursor leaves the trigger */\n  disableInteractive?: boolean;\n  /** Delay in milliseconds before showing the tooltip on hover. Keyboard focus is never delayed. */\n  delay?: number;\n}\n\nconst props = withDefaults(defineProps<PvTooltipProps>(), {\n  variant: \"white\",\n  ariaLabelledBy: \"ariaLabelledById\",\n  tooltipPosition: \"top-right\",\n  size: \"md\",\n  disableInteractive: false,\n  delay: 0,\n});\n\nconst rootRef = useTemplateRef<HTMLElement | null>(\"rootRef\");\n// `useSlotPresence` needs the host to see light DOM children as a web component.\nconst slotHost = computed(() => {\n  const rootNode = rootRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\n\nconst { present: hasTooltip } = useSlotPresence(\"tooltip-content\", { host: slotHost });\n\n// Visibility stays in CSS (`.pv-tooltip:hover > [role=\"tooltip\"]`). A pending\n// delay only suppresses it with an inline `display: none`, which outranks the\n// stylesheet; dropping that style hands control back to the `:hover` rule.\nconst isDelayed = computed(() => props.delay > 0);\n\n// Keyboard focus is deliberately not delayed: the delay exists to stop tooltips\n// flashing open as a pointer transits, and a tabbed-to element is already committed.\nconst focused = ref(false);\nconst openDelayElapsed = ref(false);\n\nlet openDelayTimeout: ReturnType<typeof setTimeout> | undefined;\n\nconst clearOpenDelayTimeout = () => {\n  if (openDelayTimeout) clearTimeout(openDelayTimeout);\n  openDelayTimeout = undefined;\n};\n\nconst tooltipVisible = computed(() => !isDelayed.value || focused.value || openDelayElapsed.value);\n\nconst handleMouseEnter = () => {\n  if (!isDelayed.value) return;\n  clearOpenDelayTimeout();\n  openDelayTimeout = setTimeout(() => {\n    openDelayTimeout = undefined;\n    openDelayElapsed.value = true;\n  }, props.delay);\n};\n\nconst handleMouseLeave = () => {\n  if (!isDelayed.value) return;\n  clearOpenDelayTimeout();\n  openDelayElapsed.value = false;\n};\n\nconst handleFocusIn = () => {\n  if (isDelayed.value) focused.value = true;\n};\n\nconst handleFocusOut = () => {\n  if (isDelayed.value) focused.value = false;\n};\n\nonBeforeUnmount(clearOpenDelayTimeout);\n</script>\n\n<template>\n  <div\n    ref=\"rootRef\"\n    data-testid=\"pv-tooltip\"\n    :class=\"[\n      {\n        'pv-tooltip': hasTooltip,\n        'pv-tooltip-small': hasTooltip && size === 'sm',\n      },\n    ]\"\n    :data-position=\"tooltipPosition\"\n    :data-style=\"variant === 'white' ? 'white' : 'dark'\"\n    :data-static=\"disableInteractive ? true : undefined\"\n    :aria-labelledby=\"hasTooltip ? ariaLabelledBy : undefined\"\n    @mouseenter=\"handleMouseEnter\"\n    @mouseleave=\"handleMouseLeave\"\n    @focusin=\"handleFocusIn\"\n    @focusout=\"handleFocusOut\"\n  >\n    <slot name=\"label\" />\n    <div v-if=\"hasTooltip\" v-show=\"tooltipVisible\" role=\"tooltip\" :id=\"ariaLabelledBy\" data-testid=\"pv-tooltip-content\">\n      <slot name=\"tooltip-content\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvButtonProps, PvButtonWithTooltipProps } from \"./types\";\nimport PvButton from \"./PvButton.vue\";\nimport PvTooltip from \"../PvTooltip/PvTooltip.vue\";\nimport { computed } from \"vue\";\n\nconst props = withDefaults(defineProps<PvButtonWithTooltipProps>(), {\n  tooltipVariant: \"dark\",\n  delay: 500,\n});\n\nconst pvToolTipSize = computed(() => {\n  // for md buttons, use sm, else use md\n  return props.size === \"md\" ? \"sm\" : \"md\";\n});\n\n// Only forward PvButton props to the inner button. Spreading every prop (e.g.\n// via v-bind=\"$props\") would leak tooltip-only props onto the <button> element\n// as invalid fallthrough attributes (tooltipText, delay, etc.).\nconst buttonProps = computed<PvButtonProps>(() => ({\n  variant: props.variant,\n  disabled: props.disabled,\n  size: props.size,\n  loading: props.loading,\n  label: props.label,\n  leftIcon: props.leftIcon,\n  rightIcon: props.rightIcon,\n  inverse: props.inverse,\n  leftCounterBadge: props.leftCounterBadge,\n  rightCounterBadge: props.rightCounterBadge,\n  ariaLabel: props.ariaLabel,\n}));\n</script>\n\n<template>\n  <PvTooltip :variant=\"tooltipVariant\" :tooltip-position=\"tooltipPosition\" :delay=\"delay\" :size=\"pvToolTipSize\">\n    <template #tooltip-content>\n      <p class=\"pv-text-body-sm\">{{ tooltipText }}</p>\n    </template>\n    <template #label>\n      <PvButton v-bind=\"buttonProps\" />\n    </template>\n  </PvTooltip>\n</template>\n","<script setup lang=\"ts\">\nimport { PvButtonProps, PvButtonWithTooltipProps } from \"./types\";\nimport PvButton from \"./PvButton.vue\";\nimport PvTooltip from \"../PvTooltip/PvTooltip.vue\";\nimport { computed } from \"vue\";\n\nconst props = withDefaults(defineProps<PvButtonWithTooltipProps>(), {\n  tooltipVariant: \"dark\",\n  delay: 500,\n});\n\nconst pvToolTipSize = computed(() => {\n  // for md buttons, use sm, else use md\n  return props.size === \"md\" ? \"sm\" : \"md\";\n});\n\n// Only forward PvButton props to the inner button. Spreading every prop (e.g.\n// via v-bind=\"$props\") would leak tooltip-only props onto the <button> element\n// as invalid fallthrough attributes (tooltipText, delay, etc.).\nconst buttonProps = computed<PvButtonProps>(() => ({\n  variant: props.variant,\n  disabled: props.disabled,\n  size: props.size,\n  loading: props.loading,\n  label: props.label,\n  leftIcon: props.leftIcon,\n  rightIcon: props.rightIcon,\n  inverse: props.inverse,\n  leftCounterBadge: props.leftCounterBadge,\n  rightCounterBadge: props.rightCounterBadge,\n  ariaLabel: props.ariaLabel,\n}));\n</script>\n\n<template>\n  <PvTooltip :variant=\"tooltipVariant\" :tooltip-position=\"tooltipPosition\" :delay=\"delay\" :size=\"pvToolTipSize\">\n    <template #tooltip-content>\n      <p class=\"pv-text-body-sm\">{{ tooltipText }}</p>\n    </template>\n    <template #label>\n      <PvButton v-bind=\"buttonProps\" />\n    </template>\n  </PvTooltip>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport type { PvSplitButtonProps } from \"./types\";\n\nwithDefaults(defineProps<PvSplitButtonProps>(), {\n  position: \"bottom-right\",\n  offset: 0,\n});\n\ndefineEmits<{\n  (e: \"click\"): void;\n}>();\n\nconst open = ref(false);\n</script>\n\n<template>\n  <div class=\"pv-split-button pv-flex\" style=\"--flex-gap: 0\">\n    <PvButton\n      class=\"pv-split-button-action\"\n      :label=\"label\"\n      :variant=\"variant\"\n      :leftIcon=\"leftIcon\"\n      :rightIcon=\"rightIcon\"\n      :size=\"size\"\n      :disabled=\"disabled\"\n      :loading=\"loading\"\n      :inverse=\"inverse\"\n      :leftCounterBadge=\"leftCounterBadge\"\n      :rightCounterBadge=\"rightCounterBadge\"\n      @click=\"$emit('click')\"\n    />\n    <PvPopoverV2 v-model=\"open\" :position=\"position\" :offset=\"offset\">\n      <template #trigger>\n        <PvButton\n          class=\"pv-split-button-menu-trigger\"\n          :size=\"size\"\n          :variant=\"variant\"\n          :disabled=\"disabled\"\n          :inverse=\"inverse\"\n          :leftIcon=\"open ? 'chevron-up' : 'chevron-down'\"\n        />\n      </template>\n      <template #content>\n        <div\n          class=\"pv-split-button-menu-content pv-surface pv-bordered pv-radius pv-inset-square-8 pv-flex-vertical\"\n          style=\"--flex-gap: 4px; --flex-align: flex-start; width: 100%\"\n        >\n          <slot name=\"menu-content\" />\n        </div>\n      </template>\n    </PvPopoverV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport type { PvSplitButtonProps } from \"./types\";\n\nwithDefaults(defineProps<PvSplitButtonProps>(), {\n  position: \"bottom-right\",\n  offset: 0,\n});\n\ndefineEmits<{\n  (e: \"click\"): void;\n}>();\n\nconst open = ref(false);\n</script>\n\n<template>\n  <div class=\"pv-split-button pv-flex\" style=\"--flex-gap: 0\">\n    <PvButton\n      class=\"pv-split-button-action\"\n      :label=\"label\"\n      :variant=\"variant\"\n      :leftIcon=\"leftIcon\"\n      :rightIcon=\"rightIcon\"\n      :size=\"size\"\n      :disabled=\"disabled\"\n      :loading=\"loading\"\n      :inverse=\"inverse\"\n      :leftCounterBadge=\"leftCounterBadge\"\n      :rightCounterBadge=\"rightCounterBadge\"\n      @click=\"$emit('click')\"\n    />\n    <PvPopoverV2 v-model=\"open\" :position=\"position\" :offset=\"offset\">\n      <template #trigger>\n        <PvButton\n          class=\"pv-split-button-menu-trigger\"\n          :size=\"size\"\n          :variant=\"variant\"\n          :disabled=\"disabled\"\n          :inverse=\"inverse\"\n          :leftIcon=\"open ? 'chevron-up' : 'chevron-down'\"\n        />\n      </template>\n      <template #content>\n        <div\n          class=\"pv-split-button-menu-content pv-surface pv-bordered pv-radius pv-inset-square-8 pv-flex-vertical\"\n          style=\"--flex-gap: 4px; --flex-align: flex-start; width: 100%\"\n        >\n          <slot name=\"menu-content\" />\n        </div>\n      </template>\n    </PvPopoverV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvReleaseBadgeVariant } from \"./types\";\n\nexport interface PvReleaseBadgeProps {\n  /** Release stage variant that determines the badge label and color */\n  variant: PvReleaseBadgeVariant;\n  /** Apply inverse styling (neutral background) */\n  inverse?: boolean;\n}\nconst props = defineProps<PvReleaseBadgeProps>();\n\nconst displayLabel = computed(() => {\n  if (props.variant == \"release-alpha\") {\n    return \"ALPHA\";\n  } else if (props.variant == \"release-beta\") {\n    return \"BETA\";\n  } else {\n    return \"\";\n  }\n});\n\nconst classes = computed(() => {\n  if (props.inverse) {\n    return \"pv-tag-inverse\";\n  }\n  return {\n    \"pv-tag-yellow\": props.variant == \"release-alpha\",\n    \"pv-tag-purple\": props.variant == \"release-beta\",\n  };\n});\n</script>\n\n<template>\n  <div :class=\"classes\">\n    {{ displayLabel }}\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvReleaseBadgeVariant } from \"./types\";\n\nexport interface PvReleaseBadgeProps {\n  /** Release stage variant that determines the badge label and color */\n  variant: PvReleaseBadgeVariant;\n  /** Apply inverse styling (neutral background) */\n  inverse?: boolean;\n}\nconst props = defineProps<PvReleaseBadgeProps>();\n\nconst displayLabel = computed(() => {\n  if (props.variant == \"release-alpha\") {\n    return \"ALPHA\";\n  } else if (props.variant == \"release-beta\") {\n    return \"BETA\";\n  } else {\n    return \"\";\n  }\n});\n\nconst classes = computed(() => {\n  if (props.inverse) {\n    return \"pv-tag-inverse\";\n  }\n  return {\n    \"pv-tag-yellow\": props.variant == \"release-alpha\",\n    \"pv-tag-purple\": props.variant == \"release-beta\",\n  };\n});\n</script>\n\n<template>\n  <div :class=\"classes\">\n    {{ displayLabel }}\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { TagSize, TagVariant } from \"./types\";\n\nexport interface PvTagProps {\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Tag visual variant\n   */\n  variant?: TagVariant;\n  /**\n   * Tag Icon\n   */\n  icon?: string;\n  /**\n   * Icon class\n   */\n  iconClasses?: string[];\n  /**\n   * Tag Label\n   */\n  label: string;\n  /**\n   * Show left clear icon\n   */\n  showClear?: boolean;\n  /**\n   * Show rounded state\n   */\n  rounded?: boolean;\n  /**\n   * Spine - dotted state\n   */\n  spine?: boolean;\n  /**\n   * Optional `data-dd-action-name` attached to the close (×) icon so Datadog\n   * RUM resolves the click to a named action instead of the tag label.\n   * Leave unset to fall back to Datadog's default text resolution.\n   */\n  rumRemoveActionName?: string;\n}\n\nconst props = withDefaults(defineProps<PvTagProps>(), {\n  size: \"md\",\n  variant: \"tertiary\",\n});\n\ndefineEmits<{\n  (e: \"handle-close\", payload: string): void;\n  (e: \"handle-click\", payload: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"xl\": {\n      return \"pv-tag-xl\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\n// XL pairs its 12px label with 16px icons; smaller sizes keep 12px icons.\nconst iconSize = computed(() => (props.size === \"xl\" ? 16 : 12));\n\nconst tagVariantClass = computed(() => {\n  switch (props.variant) {\n    case \"primary\": {\n      return \"pv-tag-primary\";\n    }\n    case \"secondary\": {\n      return \"pv-tag-secondary\";\n    }\n    case \"tertiary\": {\n      return \"pv-tag-tertiary\";\n    }\n    case \"transparent\": {\n      return \"pv-tag-tertiary\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\nconst pvTagStyles = computed(() => {\n  const baseStyles: CSSProperties = {\n    \"max-width\": \"100%\",\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.variant === \"transparent\") {\n    baseStyles[\"--tag-background-color\"] = \"transparent\";\n  }\n\n  return baseStyles;\n});\n</script>\n\n<template>\n  <button\n    :class=\"[tagVariantClass, tagSizeClass, 'pv-flex']\"\n    @click=\"$emit('handle-click', label)\"\n    :style=\"pvTagStyles\"\n    data-testid=\"pv-tag\"\n    :data-style=\"rounded ? 'rounded' : undefined\"\n  >\n    <PvIcon data-testid=\"pv-tag-icon\" v-if=\"icon\" :class=\"iconClasses\" :name=\"icon\" :size=\"iconSize\" />\n    <span\n      :class=\"[\n        'pv-truncate',\n        {\n          'pv-underline-dotted': spine,\n        },\n      ]\"\n    >\n      {{ label }}\n    </span>\n    <PvIcon\n      data-testid=\"pv-tag-close-icon\"\n      :size=\"iconSize\"\n      name=\"close\"\n      v-if=\"showClear\"\n      :data-dd-action-name=\"rumRemoveActionName\"\n      @click.stop=\"$emit('handle-close', label)\"\n    />\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { TagSize, TagVariant } from \"./types\";\n\nexport interface PvTagProps {\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Tag visual variant\n   */\n  variant?: TagVariant;\n  /**\n   * Tag Icon\n   */\n  icon?: string;\n  /**\n   * Icon class\n   */\n  iconClasses?: string[];\n  /**\n   * Tag Label\n   */\n  label: string;\n  /**\n   * Show left clear icon\n   */\n  showClear?: boolean;\n  /**\n   * Show rounded state\n   */\n  rounded?: boolean;\n  /**\n   * Spine - dotted state\n   */\n  spine?: boolean;\n  /**\n   * Optional `data-dd-action-name` attached to the close (×) icon so Datadog\n   * RUM resolves the click to a named action instead of the tag label.\n   * Leave unset to fall back to Datadog's default text resolution.\n   */\n  rumRemoveActionName?: string;\n}\n\nconst props = withDefaults(defineProps<PvTagProps>(), {\n  size: \"md\",\n  variant: \"tertiary\",\n});\n\ndefineEmits<{\n  (e: \"handle-close\", payload: string): void;\n  (e: \"handle-click\", payload: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"xl\": {\n      return \"pv-tag-xl\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\n// XL pairs its 12px label with 16px icons; smaller sizes keep 12px icons.\nconst iconSize = computed(() => (props.size === \"xl\" ? 16 : 12));\n\nconst tagVariantClass = computed(() => {\n  switch (props.variant) {\n    case \"primary\": {\n      return \"pv-tag-primary\";\n    }\n    case \"secondary\": {\n      return \"pv-tag-secondary\";\n    }\n    case \"tertiary\": {\n      return \"pv-tag-tertiary\";\n    }\n    case \"transparent\": {\n      return \"pv-tag-tertiary\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\nconst pvTagStyles = computed(() => {\n  const baseStyles: CSSProperties = {\n    \"max-width\": \"100%\",\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.variant === \"transparent\") {\n    baseStyles[\"--tag-background-color\"] = \"transparent\";\n  }\n\n  return baseStyles;\n});\n</script>\n\n<template>\n  <button\n    :class=\"[tagVariantClass, tagSizeClass, 'pv-flex']\"\n    @click=\"$emit('handle-click', label)\"\n    :style=\"pvTagStyles\"\n    data-testid=\"pv-tag\"\n    :data-style=\"rounded ? 'rounded' : undefined\"\n  >\n    <PvIcon data-testid=\"pv-tag-icon\" v-if=\"icon\" :class=\"iconClasses\" :name=\"icon\" :size=\"iconSize\" />\n    <span\n      :class=\"[\n        'pv-truncate',\n        {\n          'pv-underline-dotted': spine,\n        },\n      ]\"\n    >\n      {{ label }}\n    </span>\n    <PvIcon\n      data-testid=\"pv-tag-close-icon\"\n      :size=\"iconSize\"\n      name=\"close\"\n      v-if=\"showClear\"\n      :data-dd-action-name=\"rumRemoveActionName\"\n      @click.stop=\"$emit('handle-close', label)\"\n    />\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { PillSize, PillVariant, PillDotVariant } from \"./types\";\n\nexport interface PvPillProps {\n  /**\n   * Pill size\n   */\n  size?: PillSize;\n  /**\n   * Pill color variant\n   */\n  variant?: PillVariant;\n  /**\n   * Icon name displayed before the label\n   */\n  icon?: string;\n  /**\n   * Colored dot indicator displayed before the label. When set, forces neutral (tertiary) styling regardless of the variant prop.\n   */\n  dotVariant?: PillDotVariant;\n  /**\n   * Pill label text\n   */\n  label: string;\n  /**\n   * Transparent background in the default state. Hover/focus/active states\n   * keep their normal background so the pill remains interactive.\n   */\n  transparent?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvPillProps>(), {\n  size: \"md\",\n  variant: \"default\",\n});\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"xl\": {\n      return \"pv-tag-xl\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\n// XL pairs its 12px label with 16px icons; smaller sizes keep 12px icons.\nconst iconSize = computed(() => (props.size === \"xl\" ? 16 : 12));\n\nconst tagVariantClass = computed(() => {\n  if (props.dotVariant) {\n    return \"pv-tag-tertiary\";\n  }\n  switch (props.variant) {\n    case \"default\": {\n      return \"pv-tag-tertiary\";\n    }\n    case \"success\": {\n      return \"pv-tag-green\";\n    }\n    case \"warning\": {\n      return \"pv-tag-orange\";\n    }\n    case \"critical\": {\n      return \"pv-tag-red\";\n    }\n    case \"highlight\": {\n      return \"pv-tag-turquoise\";\n    }\n    case \"purple\": {\n      return \"pv-tag-purple\";\n    }\n    case \"blue\": {\n      return \"pv-tag-blue\";\n    }\n    default: {\n      return \"pv-tag-tertiary\";\n    }\n  }\n});\n\nconst pvPillStyles = computed(() => {\n  const baseStyles: CSSProperties = {\n    width: \"fit-content\",\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.transparent) {\n    baseStyles[\"--tag-background-color\"] = \"transparent\";\n  }\n\n  return baseStyles;\n});\n</script>\n\n<template>\n  <div\n    :class=\"[tagVariantClass, tagSizeClass, 'pv-flex']\"\n    @click=\"$emit('handle-click', label)\"\n    data-style=\"rounded\"\n    :style=\"pvPillStyles\"\n  >\n    <span v-if=\"dotVariant\" style=\"margin-inline-end: 0px\" :class=\"`pv-status-${dotVariant}`\"></span>\n    <PvIcon v-if=\"icon\" :name=\"icon\" :size=\"iconSize\" />\n    <span>\n      {{ label }}\n    </span>\n  </div>\n</template>\n\n<style scoped>\n[class*=\"pv-status\"] {\n  &::before,\n  &::after {\n    margin-inline-end: 0px;\n  }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { PillSize, PillVariant, PillDotVariant } from \"./types\";\n\nexport interface PvPillProps {\n  /**\n   * Pill size\n   */\n  size?: PillSize;\n  /**\n   * Pill color variant\n   */\n  variant?: PillVariant;\n  /**\n   * Icon name displayed before the label\n   */\n  icon?: string;\n  /**\n   * Colored dot indicator displayed before the label. When set, forces neutral (tertiary) styling regardless of the variant prop.\n   */\n  dotVariant?: PillDotVariant;\n  /**\n   * Pill label text\n   */\n  label: string;\n  /**\n   * Transparent background in the default state. Hover/focus/active states\n   * keep their normal background so the pill remains interactive.\n   */\n  transparent?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvPillProps>(), {\n  size: \"md\",\n  variant: \"default\",\n});\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"xl\": {\n      return \"pv-tag-xl\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n\n// XL pairs its 12px label with 16px icons; smaller sizes keep 12px icons.\nconst iconSize = computed(() => (props.size === \"xl\" ? 16 : 12));\n\nconst tagVariantClass = computed(() => {\n  if (props.dotVariant) {\n    return \"pv-tag-tertiary\";\n  }\n  switch (props.variant) {\n    case \"default\": {\n      return \"pv-tag-tertiary\";\n    }\n    case \"success\": {\n      return \"pv-tag-green\";\n    }\n    case \"warning\": {\n      return \"pv-tag-orange\";\n    }\n    case \"critical\": {\n      return \"pv-tag-red\";\n    }\n    case \"highlight\": {\n      return \"pv-tag-turquoise\";\n    }\n    case \"purple\": {\n      return \"pv-tag-purple\";\n    }\n    case \"blue\": {\n      return \"pv-tag-blue\";\n    }\n    default: {\n      return \"pv-tag-tertiary\";\n    }\n  }\n});\n\nconst pvPillStyles = computed(() => {\n  const baseStyles: CSSProperties = {\n    width: \"fit-content\",\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.transparent) {\n    baseStyles[\"--tag-background-color\"] = \"transparent\";\n  }\n\n  return baseStyles;\n});\n</script>\n\n<template>\n  <div\n    :class=\"[tagVariantClass, tagSizeClass, 'pv-flex']\"\n    @click=\"$emit('handle-click', label)\"\n    data-style=\"rounded\"\n    :style=\"pvPillStyles\"\n  >\n    <span v-if=\"dotVariant\" style=\"margin-inline-end: 0px\" :class=\"`pv-status-${dotVariant}`\"></span>\n    <PvIcon v-if=\"icon\" :name=\"icon\" :size=\"iconSize\" />\n    <span>\n      {{ label }}\n    </span>\n  </div>\n</template>\n\n<style scoped>\n[class*=\"pv-status\"] {\n  &::before,\n  &::after {\n    margin-inline-end: 0px;\n  }\n}\n</style>\n","<script lang=\"ts\">\nimport { CSSProperties } from \"vue\";\n\nexport interface PvPopoverProps {\n  /** Alignment of the popover relative to its trigger. */\n  alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n  /** Custom CSS properties applied to the inner list element (when isList is true). */\n  cssCustomListProperties?: CSSProperties;\n  /** Custom CSS properties applied to the popover root element. */\n  cssCustomProperties?: CSSProperties;\n  /** When true, renders the content inside a `<ul>` list element. */\n  isList?: boolean;\n  /** When true and isList is true, enables drag-and-drop reordering of list items. */\n  isSortable?: boolean;\n  /** Classes applied to the inner list element (when isList is true). */\n  listClass?: string;\n  /** id applied to the inner list element, so a trigger can reference it via aria-controls. */\n  listId?: string;\n  /** ARIA role for the inner list element. Defaults to `list`. */\n  listRole?: string;\n}\n</script>\n<script setup lang=\"ts\">\nimport { useSortable } from \"@vueuse/integrations/useSortable.mjs\";\nimport { computed, useSlots, useTemplateRef, ref } from \"vue\";\n\nconst popoverRoot = ref<HTMLElement | null>(null);\nconst el = useTemplateRef<HTMLElement>(\"popoverList\");\n\nconst props = withDefaults(defineProps<PvPopoverProps>(), {\n  alignment: undefined,\n  cssCustomProperties: () => ({}),\n  isList: false,\n  isSortable: false,\n  listClass: undefined,\n  listId: undefined,\n  listRole: \"list\",\n});\n\nconst emit = defineEmits<{\n  (e: \"list-order-updated\", value: string[]): void;\n}>();\n\nif (props.isSortable && props.isList) {\n  useSortable(el, [], {\n    animation: 150,\n    onUpdate: () => {\n      const newIds = Array.from(el.value?.children || []).map((child) => (child as HTMLElement).id);\n      emit(\"list-order-updated\", newIds);\n    },\n  });\n}\n\nconst slots = useSlots();\n// Header/footer stay pinned while the list scrolls, so the root becomes the flex\n// container and the list takes over the scrolling. Only applied when a section is\n// actually provided, leaving the default popover layout untouched.\nconst hasPinnedSections = computed(() => Boolean(slots.header || slots.footer));\n\ndefineExpose({ popoverRoot });\n</script>\n<template>\n  <div\n    ref=\"popoverRoot\"\n    class=\"pv-popover\"\n    :class=\"{ 'pv-popover-pinned-sections': isList && hasPinnedSections }\"\n    data-testid=\"pv-popover\"\n    :data-align=\"alignment\"\n    :style=\"cssCustomProperties\"\n  >\n    <template v-if=\"isList\">\n      <slot name=\"header\"></slot>\n      <ul\n        :id=\"listId\"\n        ref=\"popoverList\"\n        :role=\"listRole\"\n        class=\"pv-popover-list\"\n        :class=\"listClass\"\n        :style=\"cssCustomListProperties\"\n      >\n        <slot></slot>\n      </ul>\n      <slot name=\"footer\"></slot>\n    </template>\n    <slot v-else></slot>\n  </div>\n</template>\n\n<style scoped>\n.pv-popover-list {\n  font-size: 14px;\n}\n\n.pv-popover-pinned-sections {\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.pv-popover-pinned-sections .pv-popover-list {\n  overflow-y: auto;\n}\n</style>\n","<script lang=\"ts\">\nimport { CSSProperties } from \"vue\";\n\nexport interface PvPopoverProps {\n  /** Alignment of the popover relative to its trigger. */\n  alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n  /** Custom CSS properties applied to the inner list element (when isList is true). */\n  cssCustomListProperties?: CSSProperties;\n  /** Custom CSS properties applied to the popover root element. */\n  cssCustomProperties?: CSSProperties;\n  /** When true, renders the content inside a `<ul>` list element. */\n  isList?: boolean;\n  /** When true and isList is true, enables drag-and-drop reordering of list items. */\n  isSortable?: boolean;\n  /** Classes applied to the inner list element (when isList is true). */\n  listClass?: string;\n  /** id applied to the inner list element, so a trigger can reference it via aria-controls. */\n  listId?: string;\n  /** ARIA role for the inner list element. Defaults to `list`. */\n  listRole?: string;\n}\n</script>\n<script setup lang=\"ts\">\nimport { useSortable } from \"@vueuse/integrations/useSortable.mjs\";\nimport { computed, useSlots, useTemplateRef, ref } from \"vue\";\n\nconst popoverRoot = ref<HTMLElement | null>(null);\nconst el = useTemplateRef<HTMLElement>(\"popoverList\");\n\nconst props = withDefaults(defineProps<PvPopoverProps>(), {\n  alignment: undefined,\n  cssCustomProperties: () => ({}),\n  isList: false,\n  isSortable: false,\n  listClass: undefined,\n  listId: undefined,\n  listRole: \"list\",\n});\n\nconst emit = defineEmits<{\n  (e: \"list-order-updated\", value: string[]): void;\n}>();\n\nif (props.isSortable && props.isList) {\n  useSortable(el, [], {\n    animation: 150,\n    onUpdate: () => {\n      const newIds = Array.from(el.value?.children || []).map((child) => (child as HTMLElement).id);\n      emit(\"list-order-updated\", newIds);\n    },\n  });\n}\n\nconst slots = useSlots();\n// Header/footer stay pinned while the list scrolls, so the root becomes the flex\n// container and the list takes over the scrolling. Only applied when a section is\n// actually provided, leaving the default popover layout untouched.\nconst hasPinnedSections = computed(() => Boolean(slots.header || slots.footer));\n\ndefineExpose({ popoverRoot });\n</script>\n<template>\n  <div\n    ref=\"popoverRoot\"\n    class=\"pv-popover\"\n    :class=\"{ 'pv-popover-pinned-sections': isList && hasPinnedSections }\"\n    data-testid=\"pv-popover\"\n    :data-align=\"alignment\"\n    :style=\"cssCustomProperties\"\n  >\n    <template v-if=\"isList\">\n      <slot name=\"header\"></slot>\n      <ul\n        :id=\"listId\"\n        ref=\"popoverList\"\n        :role=\"listRole\"\n        class=\"pv-popover-list\"\n        :class=\"listClass\"\n        :style=\"cssCustomListProperties\"\n      >\n        <slot></slot>\n      </ul>\n      <slot name=\"footer\"></slot>\n    </template>\n    <slot v-else></slot>\n  </div>\n</template>\n\n<style scoped>\n.pv-popover-list {\n  font-size: 14px;\n}\n\n.pv-popover-pinned-sections {\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.pv-popover-pinned-sections .pv-popover-list {\n  overflow-y: auto;\n}\n</style>\n","<script lang=\"ts\">\nimport type { CSSProperties } from \"vue\";\n\nexport interface PvDropdownProps {\n  /**\n   * Accessible name for the trigger button, exposed as `aria-label`. Required\n   * for icon-only triggers (e.g. a report-actions menu) so the button is named\n   * in the accessibility tree; optional when the trigger slot already has text.\n   */\n  ariaLabel?: string;\n  defaultOpen?: boolean;\n  popoverCssProperties?: CSSProperties;\n  alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n  isList?: boolean;\n  isSortable?: boolean;\n  icon?: boolean;\n  disabled?: boolean;\n  isLoading?: boolean;\n  useTeleport?: boolean;\n  teleportLocation?: string;\n  /** Custom CSS styles applied to the trigger button, e.g. { width: \"100%\" } to stretch it to its container. */\n  triggerCssProperties?: CSSProperties;\n}\n</script>\n<script setup lang=\"ts\">\nimport { computed, ref, watch, nextTick, useId } from \"vue\";\nimport PvPopover from \"../PvPopover/PvPopover.vue\";\nimport { vOnClickOutside } from \"@vueuse/components\";\nconst props = withDefaults(defineProps<PvDropdownProps>(), {\n  alignment: undefined,\n  isList: false,\n  defaultOpen: false,\n  disabled: false,\n  isLoading: false,\n  useTeleport: false,\n  teleportLocation: \"body\",\n});\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n  (e: \"list-order-updated\", value: string[]): void;\n}>();\nconst open = ref<boolean>(props.defaultOpen);\n\n// Stable id linking the trigger to its popover via aria-controls.\nconst popoverId = useId();\n\nconst triggerRef = ref<HTMLElement | null>(null);\nconst popoverRef = ref<{ popoverRoot: HTMLElement | null } | null>(null);\nconst triggerRect = ref<DOMRect | null>(null);\nconst popoverRect = ref<DOMRect | null>(null);\n\nconst updateRects = () => {\n  if (triggerRef.value) {\n    triggerRect.value = triggerRef.value.getBoundingClientRect();\n  }\n  if (popoverRef.value?.popoverRoot) {\n    popoverRect.value = popoverRef.value.popoverRoot.getBoundingClientRect();\n  }\n};\n\nconst popoverClasses = computed(() => {\n  const classes = {\n    \"pv-hide\": !open.value,\n  };\n  return classes;\n});\nconst handleClickTrigger = () => {\n  open.value = !open.value;\n};\n\nconst closeDropdown = () => {\n  open.value = false;\n};\n\n// Escape dismisses the open menu and returns focus to the trigger, per the\n// WAI-ARIA menu button pattern. Handled where the keydown bubbles up from the\n// focused trigger; stop propagation only when we consume it so a parent (e.g. a\n// modal) does not also close on the same Escape.\nconst handleEscape = (event: KeyboardEvent) => {\n  if (!open.value) return;\n  event.stopPropagation();\n  open.value = false;\n  triggerRef.value?.focus();\n};\n\ndefineExpose({\n  closeDropdown,\n});\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    nextTick(() => {\n      updateRects();\n      emits(\"dropdown-open\");\n    });\n  } else {\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst leftOffset = computed(() => {\n  if (!triggerRect.value || !popoverRect.value) return 0;\n\n  if (props.alignment === \"right\" || props.alignment === \"top right\") {\n    return triggerRect.value.left + triggerRect.value.width - popoverRect.value.width;\n  }\n  return triggerRect.value.left;\n});\n\nconst topOffset = computed(() => {\n  if (!triggerRect.value || !popoverRect.value) return 0;\n\n  if (props.alignment === \"top\" || props.alignment === \"top right\") {\n    return triggerRect.value.top - popoverRect.value.height;\n  }\n\n  return triggerRect.value.top + window.scrollY + triggerRect.value.height;\n});\n\nconst popoverPositionStyle = computed(() => {\n  if (!props.useTeleport) {\n    return props.popoverCssProperties;\n  }\n  const teleportStyles = {\n    position: \"absolute\",\n    left: `${leftOffset.value}px`,\n    top: `${topOffset.value}px`,\n    zIndex: 10,\n  } as CSSProperties;\n  return {\n    ...teleportStyles,\n    ...props.popoverCssProperties,\n  };\n});\n</script>\n<template>\n  <div\n    class=\"pv-dropdown-component pv-relative\"\n    v-on-click-outside=\"closeDropdown\"\n    style=\"width: fit-content\"\n    @keydown.esc=\"handleEscape\"\n  >\n    <button\n      ref=\"triggerRef\"\n      type=\"button\"\n      :class=\"{ 'pv-select': !icon, 'pv-button-icon': icon }\"\n      :style=\"{ width: 'auto', ...triggerCssProperties }\"\n      :aria-label=\"ariaLabel\"\n      :aria-haspopup=\"true\"\n      :aria-expanded=\"open\"\n      :aria-controls=\"popoverId\"\n      @click=\"handleClickTrigger\"\n      :disabled=\"disabled\"\n    >\n      <slot name=\"trigger\">Open</slot>\n    </button>\n    <Teleport :to=\"teleportLocation\" :disabled=\"!useTeleport\">\n      <PvPopover\n        ref=\"popoverRef\"\n        :id=\"popoverId\"\n        :class=\"popoverClasses\"\n        :css-custom-properties=\"popoverPositionStyle\"\n        :alignment=\"alignment\"\n        :isList=\"isList\"\n        :isSortable=\"isSortable\"\n        @list-order-updated=\"$emit('list-order-updated', $event)\"\n        ><slot><span v-if=\"isLoading\" class=\"pv-shimmer\">Loading...</span></slot></PvPopover\n      >\n    </Teleport>\n  </div>\n</template>\n\n<style scoped>\n.pv-select {\n  padding-top: 4px;\n  padding-bottom: 4px;\n}\n</style>\n","<script lang=\"ts\">\nimport type { CSSProperties } from \"vue\";\n\nexport interface PvDropdownProps {\n  /**\n   * Accessible name for the trigger button, exposed as `aria-label`. Required\n   * for icon-only triggers (e.g. a report-actions menu) so the button is named\n   * in the accessibility tree; optional when the trigger slot already has text.\n   */\n  ariaLabel?: string;\n  defaultOpen?: boolean;\n  popoverCssProperties?: CSSProperties;\n  alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n  isList?: boolean;\n  isSortable?: boolean;\n  icon?: boolean;\n  disabled?: boolean;\n  isLoading?: boolean;\n  useTeleport?: boolean;\n  teleportLocation?: string;\n  /** Custom CSS styles applied to the trigger button, e.g. { width: \"100%\" } to stretch it to its container. */\n  triggerCssProperties?: CSSProperties;\n}\n</script>\n<script setup lang=\"ts\">\nimport { computed, ref, watch, nextTick, useId } from \"vue\";\nimport PvPopover from \"../PvPopover/PvPopover.vue\";\nimport { vOnClickOutside } from \"@vueuse/components\";\nconst props = withDefaults(defineProps<PvDropdownProps>(), {\n  alignment: undefined,\n  isList: false,\n  defaultOpen: false,\n  disabled: false,\n  isLoading: false,\n  useTeleport: false,\n  teleportLocation: \"body\",\n});\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n  (e: \"list-order-updated\", value: string[]): void;\n}>();\nconst open = ref<boolean>(props.defaultOpen);\n\n// Stable id linking the trigger to its popover via aria-controls.\nconst popoverId = useId();\n\nconst triggerRef = ref<HTMLElement | null>(null);\nconst popoverRef = ref<{ popoverRoot: HTMLElement | null } | null>(null);\nconst triggerRect = ref<DOMRect | null>(null);\nconst popoverRect = ref<DOMRect | null>(null);\n\nconst updateRects = () => {\n  if (triggerRef.value) {\n    triggerRect.value = triggerRef.value.getBoundingClientRect();\n  }\n  if (popoverRef.value?.popoverRoot) {\n    popoverRect.value = popoverRef.value.popoverRoot.getBoundingClientRect();\n  }\n};\n\nconst popoverClasses = computed(() => {\n  const classes = {\n    \"pv-hide\": !open.value,\n  };\n  return classes;\n});\nconst handleClickTrigger = () => {\n  open.value = !open.value;\n};\n\nconst closeDropdown = () => {\n  open.value = false;\n};\n\n// Escape dismisses the open menu and returns focus to the trigger, per the\n// WAI-ARIA menu button pattern. Handled where the keydown bubbles up from the\n// focused trigger; stop propagation only when we consume it so a parent (e.g. a\n// modal) does not also close on the same Escape.\nconst handleEscape = (event: KeyboardEvent) => {\n  if (!open.value) return;\n  event.stopPropagation();\n  open.value = false;\n  triggerRef.value?.focus();\n};\n\ndefineExpose({\n  closeDropdown,\n});\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    nextTick(() => {\n      updateRects();\n      emits(\"dropdown-open\");\n    });\n  } else {\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst leftOffset = computed(() => {\n  if (!triggerRect.value || !popoverRect.value) return 0;\n\n  if (props.alignment === \"right\" || props.alignment === \"top right\") {\n    return triggerRect.value.left + triggerRect.value.width - popoverRect.value.width;\n  }\n  return triggerRect.value.left;\n});\n\nconst topOffset = computed(() => {\n  if (!triggerRect.value || !popoverRect.value) return 0;\n\n  if (props.alignment === \"top\" || props.alignment === \"top right\") {\n    return triggerRect.value.top - popoverRect.value.height;\n  }\n\n  return triggerRect.value.top + window.scrollY + triggerRect.value.height;\n});\n\nconst popoverPositionStyle = computed(() => {\n  if (!props.useTeleport) {\n    return props.popoverCssProperties;\n  }\n  const teleportStyles = {\n    position: \"absolute\",\n    left: `${leftOffset.value}px`,\n    top: `${topOffset.value}px`,\n    zIndex: 10,\n  } as CSSProperties;\n  return {\n    ...teleportStyles,\n    ...props.popoverCssProperties,\n  };\n});\n</script>\n<template>\n  <div\n    class=\"pv-dropdown-component pv-relative\"\n    v-on-click-outside=\"closeDropdown\"\n    style=\"width: fit-content\"\n    @keydown.esc=\"handleEscape\"\n  >\n    <button\n      ref=\"triggerRef\"\n      type=\"button\"\n      :class=\"{ 'pv-select': !icon, 'pv-button-icon': icon }\"\n      :style=\"{ width: 'auto', ...triggerCssProperties }\"\n      :aria-label=\"ariaLabel\"\n      :aria-haspopup=\"true\"\n      :aria-expanded=\"open\"\n      :aria-controls=\"popoverId\"\n      @click=\"handleClickTrigger\"\n      :disabled=\"disabled\"\n    >\n      <slot name=\"trigger\">Open</slot>\n    </button>\n    <Teleport :to=\"teleportLocation\" :disabled=\"!useTeleport\">\n      <PvPopover\n        ref=\"popoverRef\"\n        :id=\"popoverId\"\n        :class=\"popoverClasses\"\n        :css-custom-properties=\"popoverPositionStyle\"\n        :alignment=\"alignment\"\n        :isList=\"isList\"\n        :isSortable=\"isSortable\"\n        @list-order-updated=\"$emit('list-order-updated', $event)\"\n        ><slot><span v-if=\"isLoading\" class=\"pv-shimmer\">Loading...</span></slot></PvPopover\n      >\n    </Teleport>\n  </div>\n</template>\n\n<style scoped>\n.pv-select {\n  padding-top: 4px;\n  padding-bottom: 4px;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport type { PvAnimatedIconProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvAnimatedIconProps>(), {\n  animationVariant: \"loading\",\n});\n\nconst iconProps = computed(() => ({ name: props.name, size: props.size }));\nconst isLoading = computed(() => props.animationVariant === \"loading\");\n</script>\n\n<template>\n  <span\n    :class=\"['pv-animated-icon', { 'pv-animated-icon-loading': isLoading }]\"\n    :style=\"props.size ? { '--size': `${props.size}px` } : undefined\"\n    aria-hidden=\"true\"\n  >\n    <PvIcon v-bind=\"iconProps\" />\n    <!-- Reuse the same strokes for the moving highlight. -->\n    <PvIcon v-if=\"isLoading\" class=\"pv-animated-icon-sheen pv-sheen\" v-bind=\"iconProps\" />\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport type { PvAnimatedIconProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvAnimatedIconProps>(), {\n  animationVariant: \"loading\",\n});\n\nconst iconProps = computed(() => ({ name: props.name, size: props.size }));\nconst isLoading = computed(() => props.animationVariant === \"loading\");\n</script>\n\n<template>\n  <span\n    :class=\"['pv-animated-icon', { 'pv-animated-icon-loading': isLoading }]\"\n    :style=\"props.size ? { '--size': `${props.size}px` } : undefined\"\n    aria-hidden=\"true\"\n  >\n    <PvIcon v-bind=\"iconProps\" />\n    <!-- Reuse the same strokes for the moving highlight. -->\n    <PvIcon v-if=\"isLoading\" class=\"pv-animated-icon-sheen pv-sheen\" v-bind=\"iconProps\" />\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport PvPopover from \"../PvPopover/PvPopover.vue\";\nimport { CSSProperties } from \"vue\";\n\nwithDefaults(\n  defineProps<{\n    /** Alignment of the popover dropdown relative to its trigger. */\n    alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n    /** Custom CSS properties applied to the popover container. */\n    cssCustomProperties?: CSSProperties;\n  }>(),\n  {\n    alignment: undefined,\n    cssCustomProperties: () => ({}),\n  },\n);\n</script>\n\n<template>\n  <nav class=\"pv-popover-menu\">\n    <slot name=\"trigger\"></slot>\n    <PvPopover is-list :alignment=\"alignment\" :css-custom-properties=\"cssCustomProperties\">\n      <slot name=\"content\"></slot>\n    </PvPopover>\n  </nav>\n</template>\n","<script setup lang=\"ts\">\nimport PvPopover from \"../PvPopover/PvPopover.vue\";\nimport { CSSProperties } from \"vue\";\n\nwithDefaults(\n  defineProps<{\n    /** Alignment of the popover dropdown relative to its trigger. */\n    alignment?: \"top\" | \"right\" | \"top right\" | undefined;\n    /** Custom CSS properties applied to the popover container. */\n    cssCustomProperties?: CSSProperties;\n  }>(),\n  {\n    alignment: undefined,\n    cssCustomProperties: () => ({}),\n  },\n);\n</script>\n\n<template>\n  <nav class=\"pv-popover-menu\">\n    <slot name=\"trigger\"></slot>\n    <PvPopover is-list :alignment=\"alignment\" :css-custom-properties=\"cssCustomProperties\">\n      <slot name=\"content\"></slot>\n    </PvPopover>\n  </nav>\n</template>\n","<script setup lang=\"ts\">\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport { PvSegmentControlSize, PvSegmentedControlOption } from \"./types\";\n\ninterface PvSegmentControlProps {\n  /** The list of options rendered as segments. Each option can have a label, icon, or both. */\n  options: PvSegmentedControlOption[];\n  /**\n   * Controls the overall height of the segmented control.\n   */\n  size?: PvSegmentControlSize;\n}\n\nwithDefaults(defineProps<PvSegmentControlProps>(), {\n  size: \"lg\",\n  options: () => [],\n});\n\nconst modelValue = defineModel<string>({ required: true });\n\nconst selectOption = (option: PvSegmentedControlOption) => {\n  if (option.disabled) return;\n  modelValue.value = option.value;\n};\n</script>\n\n<template>\n  <div\n    :class=\"[\n      'pv-segmented-control',\n      {\n        'pv-segmented-control-large': size === 'xl',\n      },\n    ]\"\n  >\n    <PvTooltipV2\n      v-for=\"option in options\"\n      :key=\"option.value\"\n      variant=\"dark\"\n      position=\"bottom-right\"\n      style=\"width: 100%\"\n    >\n      <template #trigger>\n        <PvButton\n          class=\"pv-full-width\"\n          variant=\"ghost\"\n          :label=\"option.label\"\n          :ariaLabel=\"option.ariaLabel\"\n          :left-icon=\"option.iconPosition === 'left' ? option.icon : undefined\"\n          :right-icon=\"option.iconPosition === 'right' ? option.icon : undefined\"\n          :disabled=\"option.disabled\"\n          :class=\"{ 'pv-disabled': option.disabled }\"\n          :data-active=\"modelValue === option.value ? true : null\"\n          @click=\"selectOption(option)\"\n        />\n      </template>\n      <template v-if=\"option.disabledReason\" #content>\n        {{ option.disabledReason }}\n      </template>\n    </PvTooltipV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport { PvSegmentControlSize, PvSegmentedControlOption } from \"./types\";\n\ninterface PvSegmentControlProps {\n  /** The list of options rendered as segments. Each option can have a label, icon, or both. */\n  options: PvSegmentedControlOption[];\n  /**\n   * Controls the overall height of the segmented control.\n   */\n  size?: PvSegmentControlSize;\n}\n\nwithDefaults(defineProps<PvSegmentControlProps>(), {\n  size: \"lg\",\n  options: () => [],\n});\n\nconst modelValue = defineModel<string>({ required: true });\n\nconst selectOption = (option: PvSegmentedControlOption) => {\n  if (option.disabled) return;\n  modelValue.value = option.value;\n};\n</script>\n\n<template>\n  <div\n    :class=\"[\n      'pv-segmented-control',\n      {\n        'pv-segmented-control-large': size === 'xl',\n      },\n    ]\"\n  >\n    <PvTooltipV2\n      v-for=\"option in options\"\n      :key=\"option.value\"\n      variant=\"dark\"\n      position=\"bottom-right\"\n      style=\"width: 100%\"\n    >\n      <template #trigger>\n        <PvButton\n          class=\"pv-full-width\"\n          variant=\"ghost\"\n          :label=\"option.label\"\n          :ariaLabel=\"option.ariaLabel\"\n          :left-icon=\"option.iconPosition === 'left' ? option.icon : undefined\"\n          :right-icon=\"option.iconPosition === 'right' ? option.icon : undefined\"\n          :disabled=\"option.disabled\"\n          :class=\"{ 'pv-disabled': option.disabled }\"\n          :data-active=\"modelValue === option.value ? true : null\"\n          @click=\"selectOption(option)\"\n        />\n      </template>\n      <template v-if=\"option.disabledReason\" #content>\n        {{ option.disabledReason }}\n      </template>\n    </PvTooltipV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Option } from \"@/types\";\nexport interface PvTabListBaseProps {\n  modelValue: string;\n  options: Option[];\n}\n\ndefineProps<PvTabListBaseProps>();\n\nconst emit = defineEmits([\"update:modelValue\"]);\n\nconst selectOption = (value: string) => {\n  emit(\"update:modelValue\", value);\n};\n</script>\n\n<template>\n  <div>\n    <ul role=\"list\" class=\"pv-tab-list pv-tab-list-underline\">\n      <li\n        v-for=\"option in options\"\n        :key=\"option.value\"\n        style=\"cursor: pointer\"\n        @click=\"selectOption(option.value)\"\n        :data-active=\"modelValue === option.value ? true : null\"\n      >\n        <button class=\"pv-text-body-xs\" style=\"font-weight: 500\">\n          {{ option.label }}\n        </button>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Option } from \"@/types\";\nexport interface PvTabListBaseProps {\n  modelValue: string;\n  options: Option[];\n}\n\ndefineProps<PvTabListBaseProps>();\n\nconst emit = defineEmits([\"update:modelValue\"]);\n\nconst selectOption = (value: string) => {\n  emit(\"update:modelValue\", value);\n};\n</script>\n\n<template>\n  <div>\n    <ul role=\"list\" class=\"pv-tab-list pv-tab-list-underline\">\n      <li\n        v-for=\"option in options\"\n        :key=\"option.value\"\n        style=\"cursor: pointer\"\n        @click=\"selectOption(option.value)\"\n        :data-active=\"modelValue === option.value ? true : null\"\n      >\n        <button class=\"pv-text-body-xs\" style=\"font-weight: 500\">\n          {{ option.label }}\n        </button>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport { sizeMap } from \"@/components/base/baseProps\";\nimport { PvCompanyLogoSize } from \"./types\";\n\ntype PvCompanyLogoProps = {\n  /** Base URL path where company logo SVGs are hosted. */\n  basePath?: string;\n  /** Company name used to resolve the logo filename. */\n  name: string;\n  /** Display size of the logo. Maps to a fixed pixel width. */\n  size?: PvCompanyLogoSize;\n  /** When provided, overrides the computed image URL entirely (ignores `name` and `basePath`). */\n  srcPathOverride?: string;\n};\n\nconst props = withDefaults(defineProps<PvCompanyLogoProps>(), {\n  basePath: \"https://static-assets.turquoise.health/shared-logos/prd/payers\",\n  size: \"md\",\n});\n\nconst isValidSrc = ref(true);\n\nconst iconSize = computed(() => {\n  return sizeMap[props.size] || \"32px\"; // Default to md size if not found\n});\n\nconst styles = computed(() => ({\n  width: iconSize.value,\n}));\n\nconst modifiedName = computed((): string => {\n  const snakeCaseName = props.name\n    .toLowerCase()\n    .replace(/[^a-z\\s]/g, \"\")\n    .trim()\n    .replace(/\\s+/g, \"_\");\n  return `${snakeCaseName}.svg`;\n});\n\nconst imageSource = computed(() => {\n  if (props.srcPathOverride) {\n    return props.srcPathOverride;\n  }\n  return `${props.basePath}/${modifiedName.value}`;\n});\n\n// reset the isValidSrc when the name changes, and let @error handler set it to false if the image fails to load\nwatch(imageSource, () => {\n  isValidSrc.value = true;\n});\n</script>\n\n<template>\n  <div class=\"pv-flex\" data-testid=\"pv-company-logo\">\n    <div :class=\"`pv-company-${props.size}`\" :style=\"styles\">\n      <img v-if=\"isValidSrc\" :src=\"imageSource\" alt=\"\" @error=\"isValidSrc = false\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport { sizeMap } from \"@/components/base/baseProps\";\nimport { PvCompanyLogoSize } from \"./types\";\n\ntype PvCompanyLogoProps = {\n  /** Base URL path where company logo SVGs are hosted. */\n  basePath?: string;\n  /** Company name used to resolve the logo filename. */\n  name: string;\n  /** Display size of the logo. Maps to a fixed pixel width. */\n  size?: PvCompanyLogoSize;\n  /** When provided, overrides the computed image URL entirely (ignores `name` and `basePath`). */\n  srcPathOverride?: string;\n};\n\nconst props = withDefaults(defineProps<PvCompanyLogoProps>(), {\n  basePath: \"https://static-assets.turquoise.health/shared-logos/prd/payers\",\n  size: \"md\",\n});\n\nconst isValidSrc = ref(true);\n\nconst iconSize = computed(() => {\n  return sizeMap[props.size] || \"32px\"; // Default to md size if not found\n});\n\nconst styles = computed(() => ({\n  width: iconSize.value,\n}));\n\nconst modifiedName = computed((): string => {\n  const snakeCaseName = props.name\n    .toLowerCase()\n    .replace(/[^a-z\\s]/g, \"\")\n    .trim()\n    .replace(/\\s+/g, \"_\");\n  return `${snakeCaseName}.svg`;\n});\n\nconst imageSource = computed(() => {\n  if (props.srcPathOverride) {\n    return props.srcPathOverride;\n  }\n  return `${props.basePath}/${modifiedName.value}`;\n});\n\n// reset the isValidSrc when the name changes, and let @error handler set it to false if the image fails to load\nwatch(imageSource, () => {\n  isValidSrc.value = true;\n});\n</script>\n\n<template>\n  <div class=\"pv-flex\" data-testid=\"pv-company-logo\">\n    <div :class=\"`pv-company-${props.size}`\" :style=\"styles\">\n      <img v-if=\"isValidSrc\" :src=\"imageSource\" alt=\"\" @error=\"isValidSrc = false\" />\n    </div>\n  </div>\n</template>\n","<script lang=\"ts\">\nimport { computed, watch, useTemplateRef } from \"vue\";\n</script>\n\n<script setup lang=\"ts\">\nexport interface ModalProps {\n  header: string;\n  subheader?: string;\n  disableCloseOnClickOutside?: boolean;\n  hideFooter?: boolean;\n  hideHeader?: boolean;\n  /** Vertical placement in the viewport. \"center\" centers the modal, \"top\" anchors it near the top. */\n  position?: \"center\" | \"top\";\n}\n\nconst props = withDefaults(defineProps<ModalProps>(), {\n  disableCloseOnClickOutside: false,\n  hideFooter: false,\n  position: \"center\",\n});\n\n// \"top\" leans on the framework's default `--top` offset; centering needs the dialog\n// positioned against the viewport so auto block margins can split the leftover space.\nconst positionStyle = computed(() =>\n  props.position === \"center\" ? \"position: fixed; inset-block: 0; height: fit-content; margin-block: auto\" : undefined,\n);\n\nconst dialogRef = useTemplateRef<HTMLDialogElement | null>(\"dialog\");\nconst showModal = defineModel<boolean>({\n  required: true,\n});\n\nwatch(\n  () => showModal.value,\n  () => {\n    if (showModal.value) {\n      dialogRef.value?.showModal();\n    } else {\n      dialogRef.value?.close();\n    }\n  },\n);\n\nconst handleClose = () => {\n  showModal.value = false;\n};\n\nconst handleBackdropClick = (e: MouseEvent) => {\n  if (!props.disableCloseOnClickOutside && e.target === dialogRef.value) {\n    handleClose();\n  }\n};\n</script>\n\n<template>\n  <dialog\n    class=\"pv-modal-sm\"\n    ref=\"dialog\"\n    :style=\"positionStyle\"\n    v-on:close=\"handleClose\"\n    v-on:click=\"handleBackdropClick\"\n  >\n    <div class=\"pv-inset-squish-12\">\n      <div v-if=\"!hideHeader\" class=\"pv-flex pv-flex-vertical pv-stack-16\" style=\"--flex-align: flex-start\">\n        <span class=\"pv-heading-3\">{{ header }}</span>\n        <span v-if=\"subheader\" class=\"pv-text-body-md\">{{ subheader }}</span>\n      </div>\n      <slot name=\"body\" />\n    </div>\n    <div\n      v-if=\"!hideFooter\"\n      class=\"pv-inset-squish-12 pv-border-top\"\n      style=\"--color-border: var(--modal-footer-border-color, #d2d8dc)\"\n    >\n      <slot name=\"footer\" />\n    </div>\n  </dialog>\n</template>\n","<script lang=\"ts\">\nimport { computed, watch, useTemplateRef } from \"vue\";\n</script>\n\n<script setup lang=\"ts\">\nexport interface ModalProps {\n  header: string;\n  subheader?: string;\n  disableCloseOnClickOutside?: boolean;\n  hideFooter?: boolean;\n  hideHeader?: boolean;\n  /** Vertical placement in the viewport. \"center\" centers the modal, \"top\" anchors it near the top. */\n  position?: \"center\" | \"top\";\n}\n\nconst props = withDefaults(defineProps<ModalProps>(), {\n  disableCloseOnClickOutside: false,\n  hideFooter: false,\n  position: \"center\",\n});\n\n// \"top\" leans on the framework's default `--top` offset; centering needs the dialog\n// positioned against the viewport so auto block margins can split the leftover space.\nconst positionStyle = computed(() =>\n  props.position === \"center\" ? \"position: fixed; inset-block: 0; height: fit-content; margin-block: auto\" : undefined,\n);\n\nconst dialogRef = useTemplateRef<HTMLDialogElement | null>(\"dialog\");\nconst showModal = defineModel<boolean>({\n  required: true,\n});\n\nwatch(\n  () => showModal.value,\n  () => {\n    if (showModal.value) {\n      dialogRef.value?.showModal();\n    } else {\n      dialogRef.value?.close();\n    }\n  },\n);\n\nconst handleClose = () => {\n  showModal.value = false;\n};\n\nconst handleBackdropClick = (e: MouseEvent) => {\n  if (!props.disableCloseOnClickOutside && e.target === dialogRef.value) {\n    handleClose();\n  }\n};\n</script>\n\n<template>\n  <dialog\n    class=\"pv-modal-sm\"\n    ref=\"dialog\"\n    :style=\"positionStyle\"\n    v-on:close=\"handleClose\"\n    v-on:click=\"handleBackdropClick\"\n  >\n    <div class=\"pv-inset-squish-12\">\n      <div v-if=\"!hideHeader\" class=\"pv-flex pv-flex-vertical pv-stack-16\" style=\"--flex-align: flex-start\">\n        <span class=\"pv-heading-3\">{{ header }}</span>\n        <span v-if=\"subheader\" class=\"pv-text-body-md\">{{ subheader }}</span>\n      </div>\n      <slot name=\"body\" />\n    </div>\n    <div\n      v-if=\"!hideFooter\"\n      class=\"pv-inset-squish-12 pv-border-top\"\n      style=\"--color-border: var(--modal-footer-border-color, #d2d8dc)\"\n    >\n      <slot name=\"footer\" />\n    </div>\n  </dialog>\n</template>\n","export enum BannerOrientationsEnum {\n  Vertical = \"Vertical\",\n  Horizontal = \"Horizontal\",\n}\n\nexport enum BannerVariantsEnum {\n  Primary = \"Primary\",\n  Secondary = \"Secondary\",\n  Tertiary = \"Tertiary\",\n  Universal = \"Universal\",\n  AI = \"AI\",\n  Marketing = \"Marketing\",\n}\n\nexport enum BannerAccentColorsEnum {\n  Blue = \"Blue\",\n  Purple = \"Purple\",\n  Red = \"Red\",\n  Yellow = \"Yellow\",\n  Green = \"Green\",\n}\n\nexport type BannerOrientations = `${BannerOrientationsEnum}`;\nexport type BannerVariants = `${BannerVariantsEnum}`;\nexport type BannerAccentColors = `${BannerAccentColorsEnum}`;\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport {\n  BannerAccentColors,\n  BannerAccentColorsEnum,\n  BannerOrientations,\n  BannerVariants,\n  BannerVariantsEnum,\n  BannerOrientationsEnum,\n} from \"./types\";\n\nexport interface PvBannerProps {\n  /** Primary text displayed in the banner */\n  label?: string;\n  /** Secondary descriptive text displayed below the label */\n  description?: string;\n  /** Icon name to display alongside the banner content */\n  icon?: string;\n  /** Visual style variant of the banner */\n  variant?: BannerVariants;\n  /** Layout orientation of the banner */\n  orientation?: BannerOrientations;\n  /** Color of the left accent bar, only applies to the Universal variant */\n  accentColor?: BannerAccentColors;\n}\n\nwithDefaults(defineProps<PvBannerProps>(), {\n  orientation: BannerOrientationsEnum.Horizontal,\n  variant: BannerVariantsEnum.Primary,\n  accentColor: BannerAccentColorsEnum.Blue,\n});\n</script>\n\n<template>\n  <div\n    data-testid=\"pv-banner\"\n    :class=\"[\n      {\n        'pv-banner-primary': variant === BannerVariantsEnum.Primary,\n        'pv-banner-secondary': variant === BannerVariantsEnum.Secondary,\n        'pv-banner-tertiary': variant === BannerVariantsEnum.Tertiary,\n        'pv-banner-universal': variant === BannerVariantsEnum.Universal,\n        'pv-banner-ai': variant === BannerVariantsEnum.AI,\n        'pv-banner-marketing': variant === BannerVariantsEnum.Marketing,\n        'pv-flex pv-space-between': orientation === BannerOrientationsEnum.Horizontal,\n      },\n      variant === BannerVariantsEnum.Universal && `pv-banner-accent-${accentColor.toLowerCase()}`,\n    ]\"\n  >\n    <div\n      :class=\"[\n        'pv-flex',\n        {\n          'pv-stack-16': orientation === BannerOrientationsEnum.Vertical && $slots.action,\n        },\n      ]\"\n    >\n      <slot name=\"left\"></slot>\n      <PvIcon v-if=\"icon\" data-testid=\"pv-banner-icon\" class=\"pv-text-brand\" :name=\"icon\" />\n      <div\n        :class=\"[\n          {\n            'pv-flex': orientation === BannerOrientationsEnum.Horizontal,\n          },\n        ]\"\n      >\n        <p\n          v-if=\"label\"\n          :class=\"[\n            'pv-text-title-md pv-line-clamp',\n            {\n              'pv-stack-4': description && orientation === BannerOrientationsEnum.Vertical,\n            },\n          ]\"\n          style=\"--lines: 2; font-weight: 500\"\n          :title=\"label\"\n          v-html=\"label\"\n        ></p>\n        <p\n          v-if=\"description\"\n          class=\"pv-text-body-sm pv-line-clamp\"\n          style=\"--lines: 2\"\n          :title=\"description\"\n          v-html=\"description\"\n        ></p>\n      </div>\n    </div>\n    <div class=\"pv-flex\">\n      <slot name=\"action\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport {\n  BannerAccentColors,\n  BannerAccentColorsEnum,\n  BannerOrientations,\n  BannerVariants,\n  BannerVariantsEnum,\n  BannerOrientationsEnum,\n} from \"./types\";\n\nexport interface PvBannerProps {\n  /** Primary text displayed in the banner */\n  label?: string;\n  /** Secondary descriptive text displayed below the label */\n  description?: string;\n  /** Icon name to display alongside the banner content */\n  icon?: string;\n  /** Visual style variant of the banner */\n  variant?: BannerVariants;\n  /** Layout orientation of the banner */\n  orientation?: BannerOrientations;\n  /** Color of the left accent bar, only applies to the Universal variant */\n  accentColor?: BannerAccentColors;\n}\n\nwithDefaults(defineProps<PvBannerProps>(), {\n  orientation: BannerOrientationsEnum.Horizontal,\n  variant: BannerVariantsEnum.Primary,\n  accentColor: BannerAccentColorsEnum.Blue,\n});\n</script>\n\n<template>\n  <div\n    data-testid=\"pv-banner\"\n    :class=\"[\n      {\n        'pv-banner-primary': variant === BannerVariantsEnum.Primary,\n        'pv-banner-secondary': variant === BannerVariantsEnum.Secondary,\n        'pv-banner-tertiary': variant === BannerVariantsEnum.Tertiary,\n        'pv-banner-universal': variant === BannerVariantsEnum.Universal,\n        'pv-banner-ai': variant === BannerVariantsEnum.AI,\n        'pv-banner-marketing': variant === BannerVariantsEnum.Marketing,\n        'pv-flex pv-space-between': orientation === BannerOrientationsEnum.Horizontal,\n      },\n      variant === BannerVariantsEnum.Universal && `pv-banner-accent-${accentColor.toLowerCase()}`,\n    ]\"\n  >\n    <div\n      :class=\"[\n        'pv-flex',\n        {\n          'pv-stack-16': orientation === BannerOrientationsEnum.Vertical && $slots.action,\n        },\n      ]\"\n    >\n      <slot name=\"left\"></slot>\n      <PvIcon v-if=\"icon\" data-testid=\"pv-banner-icon\" class=\"pv-text-brand\" :name=\"icon\" />\n      <div\n        :class=\"[\n          {\n            'pv-flex': orientation === BannerOrientationsEnum.Horizontal,\n          },\n        ]\"\n      >\n        <p\n          v-if=\"label\"\n          :class=\"[\n            'pv-text-title-md pv-line-clamp',\n            {\n              'pv-stack-4': description && orientation === BannerOrientationsEnum.Vertical,\n            },\n          ]\"\n          style=\"--lines: 2; font-weight: 500\"\n          :title=\"label\"\n          v-html=\"label\"\n        ></p>\n        <p\n          v-if=\"description\"\n          class=\"pv-text-body-sm pv-line-clamp\"\n          style=\"--lines: 2\"\n          :title=\"description\"\n          v-html=\"description\"\n        ></p>\n      </div>\n    </div>\n    <div class=\"pv-flex\">\n      <slot name=\"action\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvEmptyErrorStateProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvEmptyErrorStateProps>(), {\n  orientation: \"vertical\",\n});\n\nconst isHorizontal = computed(() => props.orientation === \"horizontal\");\n\nconst wrapperStyles = computed(() =>\n  isHorizontal.value ? { \"--flex-align\": \"flex-start\", \"--flex-gap\": \"1rem\" } : { \"--flex-gap\": \"1rem\" },\n);\n\nconst wrapperText = computed(() =>\n  isHorizontal.value ? { \"--flex-gap\": 0, \"--flex-align\": \"flex-start\" } : { \"--flex-gap\": 0 },\n);\n</script>\n\n<template>\n  <div :class=\"isHorizontal ? 'pv-flex' : 'pv-flex-vertical'\" :style=\"wrapperStyles\">\n    <div\n      v-if=\"icon\"\n      class=\"pv-inset-square pv-radius\"\n      style=\"background-color: #e4f8f6; --radius: 6px; width: fit-content\"\n    >\n      <PvIcon :name=\"icon\" class=\"pv-text-brand\" />\n    </div>\n    <div class=\"pv-flex-vertical\" :style=\"wrapperText\">\n      <h3 v-if=\"header\" class=\"pv-heading-3 pv-stack-8\" style=\"font-weight: 600\">\n        {{ header }}\n      </h3>\n      <p v-if=\"description\" class=\"pv-text-body-md pv-stack\">{{ description }}</p>\n      <div :class=\"isHorizontal ? 'pv-flex' : 'pv-flex-vertical'\">\n        <slot name=\"actions\" />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvEmptyErrorStateProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvEmptyErrorStateProps>(), {\n  orientation: \"vertical\",\n});\n\nconst isHorizontal = computed(() => props.orientation === \"horizontal\");\n\nconst wrapperStyles = computed(() =>\n  isHorizontal.value ? { \"--flex-align\": \"flex-start\", \"--flex-gap\": \"1rem\" } : { \"--flex-gap\": \"1rem\" },\n);\n\nconst wrapperText = computed(() =>\n  isHorizontal.value ? { \"--flex-gap\": 0, \"--flex-align\": \"flex-start\" } : { \"--flex-gap\": 0 },\n);\n</script>\n\n<template>\n  <div :class=\"isHorizontal ? 'pv-flex' : 'pv-flex-vertical'\" :style=\"wrapperStyles\">\n    <div\n      v-if=\"icon\"\n      class=\"pv-inset-square pv-radius\"\n      style=\"background-color: #e4f8f6; --radius: 6px; width: fit-content\"\n    >\n      <PvIcon :name=\"icon\" class=\"pv-text-brand\" />\n    </div>\n    <div class=\"pv-flex-vertical\" :style=\"wrapperText\">\n      <h3 v-if=\"header\" class=\"pv-heading-3 pv-stack-8\" style=\"font-weight: 600\">\n        {{ header }}\n      </h3>\n      <p v-if=\"description\" class=\"pv-text-body-md pv-stack\">{{ description }}</p>\n      <div :class=\"isHorizontal ? 'pv-flex' : 'pv-flex-vertical'\">\n        <slot name=\"actions\" />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvCompanyLogo from \"../PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { TagSize } from \"@/components/base/PvTag/types\";\n\nexport interface PvCompanyTag {\n  /**\n   * Company name. Displayed on the left\n   */\n  companyName: string;\n  /**\n   * Show clear (close) icon on the right\n   */\n  showClear?: boolean;\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Spine - dotted underline state\n   */\n  spine?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCompanyTag>(), {\n  showClear: false,\n  size: \"md\",\n});\n\ndefineEmits<{\n  (e: \"handle-close\", companyName: string): void;\n  (e: \"handle-click\", companyName: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <button\n    :class=\"['pv-tag-tertiary', tagSizeClass]\"\n    @click=\"$emit('handle-click', companyName)\"\n    data-testid=\"pv-company-tag\"\n  >\n    <PvCompanyLogo\n      :class=\"size === 'lg' ? 'pv-company-sm' : 'pv-company-xs'\"\n      data-testid=\"pv-company-tag-icon\"\n      :size=\"size === 'lg' ? 'sm' : 'xs'\"\n      :name=\"companyName\"\n    />\n    <span :class=\"{ 'pv-underline-dotted': spine }\">\n      {{ companyName }}\n    </span>\n    <PvIcon\n      data-testid=\"pv-company-tag-close-icon\"\n      :size=\"12\"\n      name=\"close\"\n      v-if=\"showClear\"\n      @click.stop=\"$emit('handle-close', companyName)\"\n    />\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvCompanyLogo from \"../PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { TagSize } from \"@/components/base/PvTag/types\";\n\nexport interface PvCompanyTag {\n  /**\n   * Company name. Displayed on the left\n   */\n  companyName: string;\n  /**\n   * Show clear (close) icon on the right\n   */\n  showClear?: boolean;\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Spine - dotted underline state\n   */\n  spine?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCompanyTag>(), {\n  showClear: false,\n  size: \"md\",\n});\n\ndefineEmits<{\n  (e: \"handle-close\", companyName: string): void;\n  (e: \"handle-click\", companyName: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <button\n    :class=\"['pv-tag-tertiary', tagSizeClass]\"\n    @click=\"$emit('handle-click', companyName)\"\n    data-testid=\"pv-company-tag\"\n  >\n    <PvCompanyLogo\n      :class=\"size === 'lg' ? 'pv-company-sm' : 'pv-company-xs'\"\n      data-testid=\"pv-company-tag-icon\"\n      :size=\"size === 'lg' ? 'sm' : 'xs'\"\n      :name=\"companyName\"\n    />\n    <span :class=\"{ 'pv-underline-dotted': spine }\">\n      {{ companyName }}\n    </span>\n    <PvIcon\n      data-testid=\"pv-company-tag-close-icon\"\n      :size=\"12\"\n      name=\"close\"\n      v-if=\"showClear\"\n      @click.stop=\"$emit('handle-close', companyName)\"\n    />\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport { TagSize } from \"@/components/base/PvTag/types\";\n\nexport interface PvSuggestionTag {\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Tag Label\n   */\n  label: string;\n  /**\n   * Tag Icon\n   */\n  icon?: string;\n  /**\n   * Icon class\n   */\n  iconClasses?: string[];\n  /**\n   * Show rounded state\n   */\n  rounded?: boolean;\n  /**\n   * Disable the tag, preventing interaction\n   */\n  disabled?: boolean;\n  /**\n   * Wrap a long label onto several lines instead of truncating it to one\n   */\n  wrap?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvSuggestionTag>(), {\n  size: \"md\",\n  disabled: false,\n  wrap: false,\n});\n\ndefineEmits<{\n  (e: \"handle-click\", label: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <button\n    :class=\"['pv-suggestion-tag pv-border-dashed pv-tag-secondary', tagSizeClass]\"\n    @click=\"$emit('handle-click', label)\"\n    data-testid=\"pv-suggestion-tag\"\n    style=\"max-width: 100%\"\n    :data-style=\"rounded ? 'rounded' : undefined\"\n    :data-wrap=\"wrap ? 'true' : undefined\"\n    :disabled=\"disabled\"\n    :title=\"label\"\n  >\n    <PvIcon data-testid=\"pv-suggestion-tag-icon\" v-if=\"icon\" :name=\"icon\" :size=\"12\" :class=\"iconClasses\" />\n    <span :class=\"{ 'pv-truncate': !wrap }\">\n      {{ label }}\n    </span>\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport { TagSize } from \"@/components/base/PvTag/types\";\n\nexport interface PvSuggestionTag {\n  /**\n   * Tag size\n   */\n  size?: TagSize;\n  /**\n   * Tag Label\n   */\n  label: string;\n  /**\n   * Tag Icon\n   */\n  icon?: string;\n  /**\n   * Icon class\n   */\n  iconClasses?: string[];\n  /**\n   * Show rounded state\n   */\n  rounded?: boolean;\n  /**\n   * Disable the tag, preventing interaction\n   */\n  disabled?: boolean;\n  /**\n   * Wrap a long label onto several lines instead of truncating it to one\n   */\n  wrap?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvSuggestionTag>(), {\n  size: \"md\",\n  disabled: false,\n  wrap: false,\n});\n\ndefineEmits<{\n  (e: \"handle-click\", label: string): void;\n}>();\n\nconst tagSizeClass = computed(() => {\n  switch (props.size) {\n    case \"lg\": {\n      return \"pv-tag-lg\";\n    }\n    case \"sm\": {\n      return \"pv-tag-sm\";\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <button\n    :class=\"['pv-suggestion-tag pv-border-dashed pv-tag-secondary', tagSizeClass]\"\n    @click=\"$emit('handle-click', label)\"\n    data-testid=\"pv-suggestion-tag\"\n    style=\"max-width: 100%\"\n    :data-style=\"rounded ? 'rounded' : undefined\"\n    :data-wrap=\"wrap ? 'true' : undefined\"\n    :disabled=\"disabled\"\n    :title=\"label\"\n  >\n    <PvIcon data-testid=\"pv-suggestion-tag-icon\" v-if=\"icon\" :name=\"icon\" :size=\"12\" :class=\"iconClasses\" />\n    <span :class=\"{ 'pv-truncate': !wrap }\">\n      {{ label }}\n    </span>\n  </button>\n</template>\n","<script setup lang=\"ts\">\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { ChevronPosition } from \"./types\";\nimport { computed } from \"vue\";\nimport type { CSSProperties } from \"vue\";\n\ninterface PvAccordionProps {\n  /** Position of the chevron icon relative to the header text */\n  chevronPosition?: ChevronPosition;\n  /** Orientation of the chevron for the open/closed states (up-down vs right-down) */\n  chevronVariant?: \"vertical\" | \"horizontal\";\n  /** Whether the accordion is open by default on initial render */\n  defaultOpen?: boolean;\n  /** Optional counter badge value displayed next to the header text */\n  counter?: number;\n  /** Enables a custom trigger slot instead of the default header text */\n  enableTriggerSlot?: boolean;\n  /** Makes the trigger element expand to fill its container width */\n  enableTriggerFullWidth?: boolean;\n  /** Text displayed as the accordion header */\n  header?: string;\n  /** Custom CSS styles applied to the summary/trigger element */\n  summaryStyles?: CSSProperties;\n  /** CSS class bindings applied to the summary/trigger element */\n  summaryClasses?: Record<string, boolean>;\n  /** Custom CSS styles applied to the content container */\n  contentStyles?: CSSProperties;\n  /** Additional attrs for a summary element */\n  summaryAttrs?: Record<string, string | undefined>;\n  /**\n   * Only a click on the chevron opens/closes the accordion. Any other mouse click on the summary\n   * emits `summary-click` instead; keyboard toggling (Enter/Space on the summary) is unchanged.\n   */\n  toggleOnChevronOnly?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvAccordionProps>(), {\n  chevronVariant: \"vertical\",\n  chevronPosition: \"right\",\n  enableTriggerSlot: false,\n  enableTriggerFullWidth: false,\n  toggleOnChevronOnly: false,\n});\n\nconst accordionOpen = defineModel<boolean>();\n\nconst emit = defineEmits<{\n  (e: \"summary-mouseenter\"): void;\n  (e: \"summary-mouseleave\"): void;\n  (e: \"summary-click\", event: MouseEvent): void;\n}>();\n\nif (props.defaultOpen !== undefined) {\n  accordionOpen.value = props.defaultOpen;\n}\n\nconst toggleAccordionState = (event: Event) => {\n  const detailsElement = event.target as HTMLDetailsElement;\n  accordionOpen.value = detailsElement.open;\n};\n\nconst handleSummaryClick = (event: MouseEvent) => {\n  // `detail` is 0 for the click a keyboard Enter/Space synthesizes, which must keep toggling.\n  if (event.detail === 0) return;\n  if ((event.target as Element | null)?.closest(\"[data-pv-accordion-chevron]\")) return;\n  // Slot content that already handled the click (and prevented the toggle itself) owns it.\n  if (event.defaultPrevented) return;\n  event.preventDefault();\n  emit(\"summary-click\", event);\n};\n\n// Attached only when the prop is on: any Vue listener on the summary stamps the click it sees, and an\n// ancestor's Vue listener ignores a click stamped no later than its own attach time - which is every\n// click while `Date.now()` is frozen, e.g. under fake timers. Consumers listening on the accordion itself\n// (PvReasoning's `@click`) would otherwise stop hearing trigger clicks.\nconst summaryListeners = computed(() => (props.toggleOnChevronOnly ? { click: handleSummaryClick } : {}));\n\nconst triggerStyles = {\n  width: props.enableTriggerFullWidth ? \"100%\" : \"fit-content\",\n};\n\nconst chevronState = computed(() => {\n  if (props.chevronVariant === \"horizontal\") {\n    if (props.chevronPosition === \"left\") {\n      return accordionOpen.value ? \"chevron-down\" : \"chevron-right\";\n    } else {\n      return accordionOpen.value ? \"chevron-down\" : \"chevron-left\";\n    }\n  } else {\n    return accordionOpen.value ? \"chevron-up\" : \"chevron-down\";\n  }\n});\n</script>\n\n<template>\n  <details data-testid=\"pv-accordion\" class=\"pv-accordion\" :open=\"accordionOpen\" @toggle=\"toggleAccordionState\">\n    <summary\n      v-bind=\"summaryAttrs\"\n      :class=\"['pv-flex pv-space-between pv-relative', summaryClasses]\"\n      :style=\"{ ...triggerStyles, ...summaryStyles }\"\n      @mouseenter=\"$emit('summary-mouseenter')\"\n      @mouseleave=\"$emit('summary-mouseleave')\"\n      v-on=\"summaryListeners\"\n    >\n      <!-- Content placed before a left chevron, e.g. a tree connector that must sit in the indent column -->\n      <slot name=\"leading\" />\n      <PvIcon v-if=\"chevronPosition === 'left'\" :name=\"chevronState\" data-pv-accordion-chevron />\n      <template v-if=\"enableTriggerSlot\">\n        <slot name=\"trigger\" />\n      </template>\n      <template v-else>\n        <span>\n          {{ header }}\n        </span>\n        <PvCounterBadge v-if=\"counter\" :value=\"counter\" variant=\"secondary\" size=\"sm\" />\n      </template>\n      <PvIcon v-if=\"chevronPosition === 'right'\" :name=\"chevronState\" data-pv-accordion-chevron />\n    </summary>\n    <div :style=\"contentStyles\">\n      <slot />\n    </div>\n  </details>\n</template>\n\n<style scoped>\nsummary {\n  background-image: none;\n  padding-right: 2px;\n}\n</style>\n","<script setup lang=\"ts\">\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { ChevronPosition } from \"./types\";\nimport { computed } from \"vue\";\nimport type { CSSProperties } from \"vue\";\n\ninterface PvAccordionProps {\n  /** Position of the chevron icon relative to the header text */\n  chevronPosition?: ChevronPosition;\n  /** Orientation of the chevron for the open/closed states (up-down vs right-down) */\n  chevronVariant?: \"vertical\" | \"horizontal\";\n  /** Whether the accordion is open by default on initial render */\n  defaultOpen?: boolean;\n  /** Optional counter badge value displayed next to the header text */\n  counter?: number;\n  /** Enables a custom trigger slot instead of the default header text */\n  enableTriggerSlot?: boolean;\n  /** Makes the trigger element expand to fill its container width */\n  enableTriggerFullWidth?: boolean;\n  /** Text displayed as the accordion header */\n  header?: string;\n  /** Custom CSS styles applied to the summary/trigger element */\n  summaryStyles?: CSSProperties;\n  /** CSS class bindings applied to the summary/trigger element */\n  summaryClasses?: Record<string, boolean>;\n  /** Custom CSS styles applied to the content container */\n  contentStyles?: CSSProperties;\n  /** Additional attrs for a summary element */\n  summaryAttrs?: Record<string, string | undefined>;\n  /**\n   * Only a click on the chevron opens/closes the accordion. Any other mouse click on the summary\n   * emits `summary-click` instead; keyboard toggling (Enter/Space on the summary) is unchanged.\n   */\n  toggleOnChevronOnly?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvAccordionProps>(), {\n  chevronVariant: \"vertical\",\n  chevronPosition: \"right\",\n  enableTriggerSlot: false,\n  enableTriggerFullWidth: false,\n  toggleOnChevronOnly: false,\n});\n\nconst accordionOpen = defineModel<boolean>();\n\nconst emit = defineEmits<{\n  (e: \"summary-mouseenter\"): void;\n  (e: \"summary-mouseleave\"): void;\n  (e: \"summary-click\", event: MouseEvent): void;\n}>();\n\nif (props.defaultOpen !== undefined) {\n  accordionOpen.value = props.defaultOpen;\n}\n\nconst toggleAccordionState = (event: Event) => {\n  const detailsElement = event.target as HTMLDetailsElement;\n  accordionOpen.value = detailsElement.open;\n};\n\nconst handleSummaryClick = (event: MouseEvent) => {\n  // `detail` is 0 for the click a keyboard Enter/Space synthesizes, which must keep toggling.\n  if (event.detail === 0) return;\n  if ((event.target as Element | null)?.closest(\"[data-pv-accordion-chevron]\")) return;\n  // Slot content that already handled the click (and prevented the toggle itself) owns it.\n  if (event.defaultPrevented) return;\n  event.preventDefault();\n  emit(\"summary-click\", event);\n};\n\n// Attached only when the prop is on: any Vue listener on the summary stamps the click it sees, and an\n// ancestor's Vue listener ignores a click stamped no later than its own attach time - which is every\n// click while `Date.now()` is frozen, e.g. under fake timers. Consumers listening on the accordion itself\n// (PvReasoning's `@click`) would otherwise stop hearing trigger clicks.\nconst summaryListeners = computed(() => (props.toggleOnChevronOnly ? { click: handleSummaryClick } : {}));\n\nconst triggerStyles = {\n  width: props.enableTriggerFullWidth ? \"100%\" : \"fit-content\",\n};\n\nconst chevronState = computed(() => {\n  if (props.chevronVariant === \"horizontal\") {\n    if (props.chevronPosition === \"left\") {\n      return accordionOpen.value ? \"chevron-down\" : \"chevron-right\";\n    } else {\n      return accordionOpen.value ? \"chevron-down\" : \"chevron-left\";\n    }\n  } else {\n    return accordionOpen.value ? \"chevron-up\" : \"chevron-down\";\n  }\n});\n</script>\n\n<template>\n  <details data-testid=\"pv-accordion\" class=\"pv-accordion\" :open=\"accordionOpen\" @toggle=\"toggleAccordionState\">\n    <summary\n      v-bind=\"summaryAttrs\"\n      :class=\"['pv-flex pv-space-between pv-relative', summaryClasses]\"\n      :style=\"{ ...triggerStyles, ...summaryStyles }\"\n      @mouseenter=\"$emit('summary-mouseenter')\"\n      @mouseleave=\"$emit('summary-mouseleave')\"\n      v-on=\"summaryListeners\"\n    >\n      <!-- Content placed before a left chevron, e.g. a tree connector that must sit in the indent column -->\n      <slot name=\"leading\" />\n      <PvIcon v-if=\"chevronPosition === 'left'\" :name=\"chevronState\" data-pv-accordion-chevron />\n      <template v-if=\"enableTriggerSlot\">\n        <slot name=\"trigger\" />\n      </template>\n      <template v-else>\n        <span>\n          {{ header }}\n        </span>\n        <PvCounterBadge v-if=\"counter\" :value=\"counter\" variant=\"secondary\" size=\"sm\" />\n      </template>\n      <PvIcon v-if=\"chevronPosition === 'right'\" :name=\"chevronState\" data-pv-accordion-chevron />\n    </summary>\n    <div :style=\"contentStyles\">\n      <slot />\n    </div>\n  </details>\n</template>\n\n<style scoped>\nsummary {\n  background-image: none;\n  padding-right: 2px;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useTemplateRef, onMounted } from \"vue\";\nimport { onKeyStroke } from \"@vueuse/core\";\nimport type { PvSize } from \"@/components/base/baseProps\";\n\nexport interface PvSearchInputProps {\n  /**\n   * When true, the input is non-interactive and visually dimmed.\n   */\n  disabled?: boolean;\n  /** When true, displays a keyboard shortcut badge (\"/\" key) and registers the hotkey to focus the input. */\n  displayShortcut?: boolean;\n  /**\n   * Placeholder text shown when the input is empty.\n   */\n  placeholder?: string;\n  size?: Extract<PvSize, \"lg\" | \"xl\">;\n}\n\nexport interface PvSearchInputExposed {\n  input: HTMLInputElement | null;\n}\n\nconst props = withDefaults(defineProps<PvSearchInputProps>(), {\n  disabled: false,\n  placeholder: \"Search\",\n  size: \"xl\",\n});\n\nconst SHORTCUT = \"/\";\n\nconst input = useTemplateRef<HTMLInputElement | null>(\"search-input\");\nconst modelValue = defineModel<string>({ required: false, default: \"\" });\n\nconst pvSearchInputClasses = computed(() => {\n  return {\n    \"pv-input-search\": true,\n    \"pv-full-width\": true,\n    \"pv-input-padded-end\": true,\n    \"pv-input-small\": props.size === \"lg\",\n  };\n});\n\nonMounted(() => {\n  if (!props.displayShortcut) return;\n\n  onKeyStroke(SHORTCUT, (e) => {\n    const target = e.target as HTMLElement | null;\n\n    const isTyping =\n      target instanceof HTMLInputElement ||\n      target instanceof HTMLTextAreaElement ||\n      (target?.isContentEditable ?? false);\n\n    const isCurrentInputFocused = document.activeElement === input.value;\n\n    if (!isTyping || isCurrentInputFocused) {\n      if (!isCurrentInputFocused) {\n        e.preventDefault();\n        input.value?.focus();\n      }\n    }\n  });\n});\n\ndefineExpose({ input });\n</script>\n\n<template>\n  <div class=\"pv-relative\">\n    <input\n      ref=\"search-input\"\n      v-model=\"modelValue\"\n      data-testid=\"pv-search-input\"\n      type=\"text\"\n      :disabled=\"disabled\"\n      :class=\"pvSearchInputClasses\"\n      :placeholder=\"placeholder\"\n    />\n    <kbd v-if=\"displayShortcut\" data-testid=\"pv-search-input-shortcut\" class=\"pv-kbd\">\n      {{ SHORTCUT }}\n    </kbd>\n  </div>\n</template>\n\n<style scoped>\n.pv-input-search {\n  display: block;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useTemplateRef, onMounted } from \"vue\";\nimport { onKeyStroke } from \"@vueuse/core\";\nimport type { PvSize } from \"@/components/base/baseProps\";\n\nexport interface PvSearchInputProps {\n  /**\n   * When true, the input is non-interactive and visually dimmed.\n   */\n  disabled?: boolean;\n  /** When true, displays a keyboard shortcut badge (\"/\" key) and registers the hotkey to focus the input. */\n  displayShortcut?: boolean;\n  /**\n   * Placeholder text shown when the input is empty.\n   */\n  placeholder?: string;\n  size?: Extract<PvSize, \"lg\" | \"xl\">;\n}\n\nexport interface PvSearchInputExposed {\n  input: HTMLInputElement | null;\n}\n\nconst props = withDefaults(defineProps<PvSearchInputProps>(), {\n  disabled: false,\n  placeholder: \"Search\",\n  size: \"xl\",\n});\n\nconst SHORTCUT = \"/\";\n\nconst input = useTemplateRef<HTMLInputElement | null>(\"search-input\");\nconst modelValue = defineModel<string>({ required: false, default: \"\" });\n\nconst pvSearchInputClasses = computed(() => {\n  return {\n    \"pv-input-search\": true,\n    \"pv-full-width\": true,\n    \"pv-input-padded-end\": true,\n    \"pv-input-small\": props.size === \"lg\",\n  };\n});\n\nonMounted(() => {\n  if (!props.displayShortcut) return;\n\n  onKeyStroke(SHORTCUT, (e) => {\n    const target = e.target as HTMLElement | null;\n\n    const isTyping =\n      target instanceof HTMLInputElement ||\n      target instanceof HTMLTextAreaElement ||\n      (target?.isContentEditable ?? false);\n\n    const isCurrentInputFocused = document.activeElement === input.value;\n\n    if (!isTyping || isCurrentInputFocused) {\n      if (!isCurrentInputFocused) {\n        e.preventDefault();\n        input.value?.focus();\n      }\n    }\n  });\n});\n\ndefineExpose({ input });\n</script>\n\n<template>\n  <div class=\"pv-relative\">\n    <input\n      ref=\"search-input\"\n      v-model=\"modelValue\"\n      data-testid=\"pv-search-input\"\n      type=\"text\"\n      :disabled=\"disabled\"\n      :class=\"pvSearchInputClasses\"\n      :placeholder=\"placeholder\"\n    />\n    <kbd v-if=\"displayShortcut\" data-testid=\"pv-search-input-shortcut\" class=\"pv-kbd\">\n      {{ SHORTCUT }}\n    </kbd>\n  </div>\n</template>\n\n<style scoped>\n.pv-input-search {\n  display: block;\n}\n</style>\n","/**\n * Date coercion helpers shared by date-aware components and the web component wrapper.\n *\n * HTML attributes can only carry strings, so a web component consumer writing\n * `<pv-date-picker model-value=\"2025-06-12\">` has no way to hand over a real `Date`.\n * These helpers accept either form so both Vue and vanilla consumers behave the same.\n *\n * They are deliberately tolerant about the shape they receive. A value that reaches a\n * component through a custom element attribute may arrive as a `Date`, a date string, an\n * array, or a JSON string that has not been parsed yet, depending on whether the wrapper\n * or Vue's own attribute sync set it last. Coercing all of those to the same result keeps\n * that ordering from being load-bearing.\n */\n\n/** A date that may arrive as a real `Date` or as a string a consumer wrote in markup. */\nexport type DateLike = Date | string;\n\n/** Anything a consumer might supply for a single date value. */\nexport type DateInput = DateLike | null | undefined;\n\n/** Anything a consumer might supply for a list of date values. */\nexport type DateListInput = DateInput | readonly DateInput[];\n\n/** Matches a bare calendar date with no time or zone component. */\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Parse a date string into a `Date`.\n *\n * Bare `YYYY-MM-DD` strings are interpreted in the local timezone rather than UTC.\n * `new Date(\"2025-06-12\")` yields UTC midnight, which renders as June 11 for anyone west\n * of Greenwich - the wrong day in a calendar UI.\n */\nfunction parseDateString(value: string): Date {\n  if (DATE_ONLY_PATTERN.test(value)) {\n    const [year, month, day] = value.split(\"-\").map(Number);\n    const parsed = new Date(year, month - 1, day);\n\n    // The local-date constructor rolls a day that does not exist over into the next month,\n    // so \"2025-02-30\" would quietly become March 2. Reject anything that did not survive\n    // the round trip, which leaves a typo warning rather than shifting to a real date.\n    if (parsed.getFullYear() !== year || parsed.getMonth() !== month - 1 || parsed.getDate() !== day) {\n      return new Date(NaN);\n    }\n\n    return parsed;\n  }\n  return new Date(value);\n}\n\n/**\n * Parse a string that holds a JSON array, or return null if it is not one.\n * Used to recognise an unparsed `disabled-dates='[\"2025-06-18\"]'` style attribute.\n */\nfunction parseJsonArray(value: string): unknown[] | null {\n  if (!value.trimStart().startsWith(\"[\")) {\n    return null;\n  }\n  try {\n    const parsed = JSON.parse(value);\n    return Array.isArray(parsed) ? parsed : null;\n  } catch {\n    return null;\n  }\n}\n\n/**\n * Coerce a single date value into a `Date`, or `undefined` if it is absent or unparseable.\n *\n * @param value - The value to coerce\n * @param context - Label used in the warning for an unparseable value\n */\nexport function toDate(value: DateInput, context = \"date\"): Date | undefined {\n  if (value === null || value === undefined || value === \"\") {\n    return undefined;\n  }\n\n  const parsed = value instanceof Date ? value : parseDateString(String(value));\n  if (isNaN(parsed.getTime())) {\n    console.warn(\n      `Invalid date value for \"${context}\": ${JSON.stringify(value)}. Expected a Date or a parseable date string.`,\n    );\n    return undefined;\n  }\n\n  return parsed;\n}\n\n/**\n * Coerce a list of date values, preserving `null` holes.\n *\n * Range selection represents a partial range as `[start, null]`, so positions have to\n * survive coercion rather than being filtered out. A single value coerces to a one entry\n * list, and a JSON array string is parsed first.\n */\nexport function toDateList(value: DateListInput, context = \"date\"): (Date | null)[] {\n  if (value === null || value === undefined || value === \"\") {\n    return [];\n  }\n\n  const values = Array.isArray(value)\n    ? value\n    : ((typeof value === \"string\" ? parseJsonArray(value) : null) ?? [value as DateInput]);\n\n  return (values as DateInput[]).map((entry) => toDate(entry, context) ?? null);\n}\n\n/**\n * Coerce a value that may be a single date or a list of dates.\n *\n * Used for `modelValue`, which is a single `Date` in `single` selection mode and an array\n * in `multiple` and `range` modes.\n */\nexport function toDateOrDateList(value: DateListInput, context = \"date\"): Date | (Date | null)[] | undefined {\n  if (Array.isArray(value)) {\n    return toDateList(value, context);\n  }\n  if (typeof value === \"string\" && parseJsonArray(value)) {\n    return toDateList(value, context);\n  }\n  return toDate(value as DateInput, context);\n}\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport DatePicker from \"primevue/datepicker\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvButtonSize } from \"../PvButton/types\";\nimport { toDate, toDateList, toDateOrDateList } from \"@/functions/dates\";\n\n/**\n * Value of a date selection. A single `Date` in `single` selection mode, an array in\n * `multiple` and `range` modes, where `range` uses `null` for an incomplete endpoint.\n *\n * Dates may be supplied as strings so the component can be driven by HTML attributes as\n * `pv-date-picker`. The unions here are written out rather than aliased because Vue's\n * macro type resolution has to see `Date` to emit it as a runtime prop type.\n */\n/**\n * Uses the button's size scale so a date picker can sit next to a button of the same size:\n * `md` matches `pv-button-small` (20px), `lg` the default button (24px), `xl` `pv-button-large` (32px).\n */\nexport type PvDatePickerSize = PvButtonSize;\n\nexport type PvDatePickerModelValue = Date | string | (Date | string | null)[] | null | undefined;\n\nexport interface PvDatePickerProps {\n  /**\n   * Defines the quantity of the selection.\n   */\n  selectionMode?: \"single\" | \"multiple\" | \"range\" | undefined;\n  /**\n   * Format of the date. Defaults to PrimeVue Locale configuration.\n   */\n  dateFormat?: string | undefined;\n  /**\n   * When enabled, displays the datepicker as inline instead of an overlay.\n   */\n  inline?: boolean | undefined;\n  /**\n   * Whether days in other months shown before or after the current month are selectable. This only applies if the showOtherMonths option is set to true.\n   */\n  selectOtherMonths?: boolean | undefined;\n  /**\n   * Number of months to display.\n   */\n  numberOfMonths?: number | undefined;\n  /**\n   * Type of view to display.\n   */\n  view?: \"date\" | \"month\" | \"year\" | undefined;\n  /**\n   * The minimum selectable date. Accepts a `Date` or a parseable date string.\n   */\n  minDate?: Date | string | undefined;\n  /**\n   * The maximum selectable date. Accepts a `Date` or a parseable date string.\n   */\n  maxDate?: Date | string | undefined;\n  /**\n   * Dates to disable. Accepts an array of `Date` objects or parseable date strings, or a\n   * JSON array string such as `'[\"2025-06-18\"]'` so it can be set from an attribute.\n   */\n  disabledDates?: (Date | string)[] | string | undefined;\n  /**\n   * Array with disabled weekday numbers.\n   */\n  disabledDays?: number[] | undefined;\n  /**\n   * Maximum number of selectable dates in multiple mode.\n   */\n  maxDateCount?: number | undefined;\n  /**\n   * Whether to display today and clear buttons at the footer.\n   */\n  showButtonBar?: boolean | undefined;\n  /**\n   * When enabled, datepicker will show week numbers.\n   */\n  showWeek?: boolean | undefined;\n  /**\n   * Whether to allow entering the date manually via typing.\n   */\n  manualInput?: boolean | undefined;\n  /**\n   * When present, it specifies that the component should be disabled.\n   */\n  disabled?: boolean | undefined;\n  /**\n   * When present, it specifies that the component should have invalid state style.\n   */\n  invalid?: boolean | undefined;\n  /**\n   * When present, it specifies that an input field is read-only.\n   */\n  readonly?: boolean | undefined;\n  /**\n   * Placeholder text for the input.\n   */\n  placeholder?: string | undefined;\n  /**\n   * When enabled, displays a button with icon next to input.\n   */\n  showIcon?: boolean;\n  /**\n   * When input should take 100% width\n   */\n  fullWidth?: boolean;\n  /**\n   * A valid query selector or an HTMLElement to specify where the overlay gets attached.\n   */\n  appendTo?: \"body\" | \"self\" | undefined;\n  /**\n   * Style class of the datepicker panel.\n   */\n  panelClass?: string | undefined;\n  /**\n   * Height of the input, on the same scale as `PvButton`'s `size`. Defaults to `xl`, the\n   * height the date picker has always had.\n   */\n  size?: PvDatePickerSize;\n}\n\nconst date = defineModel<PvDatePickerModelValue>();\nconst props = withDefaults(defineProps<PvDatePickerProps>(), {\n  appendTo: \"body\",\n  size: \"xl\",\n});\n\n/**\n * The public API takes strings so markup can drive it, but PrimeVue itself only understands\n * `Date` objects, so coerce on the way in. Writes pass straight back through, so what gets\n * emitted is whatever PrimeVue produced: a `Date`, `null` once the selection is cleared, or\n * an array that holds `null` for a range endpoint that has not been picked yet.\n */\nconst selectedDate = computed({\n  get: () => toDateOrDateList(date.value, \"modelValue\"),\n  set: (value: PvDatePickerModelValue) => {\n    date.value = value;\n  },\n});\n\nconst minDate = computed(() => toDate(props.minDate, \"minDate\"));\nconst maxDate = computed(() => toDate(props.maxDate, \"maxDate\"));\n// Unlike a range model value, where a `null` endpoint is meaningful, a hole in this list\n// says nothing, so drop the entries that failed to parse and disable the rest.\nconst disabledDates = computed(() =>\n  props.disabledDates ? (toDateList(props.disabledDates, \"disabledDates\").filter(Boolean) as Date[]) : undefined,\n);\n</script>\n\n<template>\n  <!--\n    v-bind=\"props\" comes first on purpose. `props` is the whole props object, `modelValue`\n    and the raw date props included, so any binding that has to win over a consumer's\n    value must be declared after the spread.\n  -->\n  <DatePicker\n    v-bind=\"props\"\n    v-model=\"selectedDate\"\n    :showIcon=\"showIcon\"\n    :iconDisplay=\"showIcon ? 'input' : undefined\"\n    :fluid=\"fullWidth\"\n    :minDate=\"minDate\"\n    :maxDate=\"maxDate\"\n    :disabledDates=\"disabledDates\"\n    :size=\"undefined\"\n    :class=\"`pv-date-picker-${size}`\"\n  >\n    <template #inputicon=\"slotProps\">\n      <PvIcon name=\"calendar\" @click=\"slotProps.clickCallback\" />\n    </template>\n  </DatePicker>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport DatePicker from \"primevue/datepicker\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvButtonSize } from \"../PvButton/types\";\nimport { toDate, toDateList, toDateOrDateList } from \"@/functions/dates\";\n\n/**\n * Value of a date selection. A single `Date` in `single` selection mode, an array in\n * `multiple` and `range` modes, where `range` uses `null` for an incomplete endpoint.\n *\n * Dates may be supplied as strings so the component can be driven by HTML attributes as\n * `pv-date-picker`. The unions here are written out rather than aliased because Vue's\n * macro type resolution has to see `Date` to emit it as a runtime prop type.\n */\n/**\n * Uses the button's size scale so a date picker can sit next to a button of the same size:\n * `md` matches `pv-button-small` (20px), `lg` the default button (24px), `xl` `pv-button-large` (32px).\n */\nexport type PvDatePickerSize = PvButtonSize;\n\nexport type PvDatePickerModelValue = Date | string | (Date | string | null)[] | null | undefined;\n\nexport interface PvDatePickerProps {\n  /**\n   * Defines the quantity of the selection.\n   */\n  selectionMode?: \"single\" | \"multiple\" | \"range\" | undefined;\n  /**\n   * Format of the date. Defaults to PrimeVue Locale configuration.\n   */\n  dateFormat?: string | undefined;\n  /**\n   * When enabled, displays the datepicker as inline instead of an overlay.\n   */\n  inline?: boolean | undefined;\n  /**\n   * Whether days in other months shown before or after the current month are selectable. This only applies if the showOtherMonths option is set to true.\n   */\n  selectOtherMonths?: boolean | undefined;\n  /**\n   * Number of months to display.\n   */\n  numberOfMonths?: number | undefined;\n  /**\n   * Type of view to display.\n   */\n  view?: \"date\" | \"month\" | \"year\" | undefined;\n  /**\n   * The minimum selectable date. Accepts a `Date` or a parseable date string.\n   */\n  minDate?: Date | string | undefined;\n  /**\n   * The maximum selectable date. Accepts a `Date` or a parseable date string.\n   */\n  maxDate?: Date | string | undefined;\n  /**\n   * Dates to disable. Accepts an array of `Date` objects or parseable date strings, or a\n   * JSON array string such as `'[\"2025-06-18\"]'` so it can be set from an attribute.\n   */\n  disabledDates?: (Date | string)[] | string | undefined;\n  /**\n   * Array with disabled weekday numbers.\n   */\n  disabledDays?: number[] | undefined;\n  /**\n   * Maximum number of selectable dates in multiple mode.\n   */\n  maxDateCount?: number | undefined;\n  /**\n   * Whether to display today and clear buttons at the footer.\n   */\n  showButtonBar?: boolean | undefined;\n  /**\n   * When enabled, datepicker will show week numbers.\n   */\n  showWeek?: boolean | undefined;\n  /**\n   * Whether to allow entering the date manually via typing.\n   */\n  manualInput?: boolean | undefined;\n  /**\n   * When present, it specifies that the component should be disabled.\n   */\n  disabled?: boolean | undefined;\n  /**\n   * When present, it specifies that the component should have invalid state style.\n   */\n  invalid?: boolean | undefined;\n  /**\n   * When present, it specifies that an input field is read-only.\n   */\n  readonly?: boolean | undefined;\n  /**\n   * Placeholder text for the input.\n   */\n  placeholder?: string | undefined;\n  /**\n   * When enabled, displays a button with icon next to input.\n   */\n  showIcon?: boolean;\n  /**\n   * When input should take 100% width\n   */\n  fullWidth?: boolean;\n  /**\n   * A valid query selector or an HTMLElement to specify where the overlay gets attached.\n   */\n  appendTo?: \"body\" | \"self\" | undefined;\n  /**\n   * Style class of the datepicker panel.\n   */\n  panelClass?: string | undefined;\n  /**\n   * Height of the input, on the same scale as `PvButton`'s `size`. Defaults to `xl`, the\n   * height the date picker has always had.\n   */\n  size?: PvDatePickerSize;\n}\n\nconst date = defineModel<PvDatePickerModelValue>();\nconst props = withDefaults(defineProps<PvDatePickerProps>(), {\n  appendTo: \"body\",\n  size: \"xl\",\n});\n\n/**\n * The public API takes strings so markup can drive it, but PrimeVue itself only understands\n * `Date` objects, so coerce on the way in. Writes pass straight back through, so what gets\n * emitted is whatever PrimeVue produced: a `Date`, `null` once the selection is cleared, or\n * an array that holds `null` for a range endpoint that has not been picked yet.\n */\nconst selectedDate = computed({\n  get: () => toDateOrDateList(date.value, \"modelValue\"),\n  set: (value: PvDatePickerModelValue) => {\n    date.value = value;\n  },\n});\n\nconst minDate = computed(() => toDate(props.minDate, \"minDate\"));\nconst maxDate = computed(() => toDate(props.maxDate, \"maxDate\"));\n// Unlike a range model value, where a `null` endpoint is meaningful, a hole in this list\n// says nothing, so drop the entries that failed to parse and disable the rest.\nconst disabledDates = computed(() =>\n  props.disabledDates ? (toDateList(props.disabledDates, \"disabledDates\").filter(Boolean) as Date[]) : undefined,\n);\n</script>\n\n<template>\n  <!--\n    v-bind=\"props\" comes first on purpose. `props` is the whole props object, `modelValue`\n    and the raw date props included, so any binding that has to win over a consumer's\n    value must be declared after the spread.\n  -->\n  <DatePicker\n    v-bind=\"props\"\n    v-model=\"selectedDate\"\n    :showIcon=\"showIcon\"\n    :iconDisplay=\"showIcon ? 'input' : undefined\"\n    :fluid=\"fullWidth\"\n    :minDate=\"minDate\"\n    :maxDate=\"maxDate\"\n    :disabledDates=\"disabledDates\"\n    :size=\"undefined\"\n    :class=\"`pv-date-picker-${size}`\"\n  >\n    <template #inputicon=\"slotProps\">\n      <PvIcon name=\"calendar\" @click=\"slotProps.clickCallback\" />\n    </template>\n  </DatePicker>\n</template>\n","import dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport timezone from \"dayjs/plugin/timezone\";\n// advancedFormat adds the \"z\" token used to render the timezone abbreviation.\nimport advancedFormat from \"dayjs/plugin/advancedFormat\";\n\ndayjs.extend(advancedFormat);\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\nexport const useDateTime = () => {\n  const getCondensedDate = ({ date }: { date: Date }) => {\n    return dayjs(date).format(\"MM/DD/YYYY\");\n  };\n\n  const getTime = ({ date, timezone }: { date: Date; timezone?: string }) => {\n    if (timezone === undefined) {\n      return dayjs(date).format(\"h:mm A\");\n    } else {\n      return dayjs(date).tz(timezone).format(\"h:mm A z\");\n    }\n  };\n\n  return {\n    getCondensedDate,\n    getTime,\n  };\n};\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvSize } from \"../baseProps\";\nimport { useDateTime } from \"./useDateTime\";\n\ntype DateTimeSize = Extract<PvSize, \"xs\" | \"sm\">;\n\ninterface PvDateTimeProps {\n  /** Display format: \"condensed\" for MM/DD/YYYY, \"time\" for h:mm AM/PM */\n  variants?: \"condensed\" | \"time\";\n  /** IANA timezone identifier for time display (e.g. \"America/New_York\") */\n  timezone?: string;\n  /** Date object to format and display */\n  date: Date;\n  /** Text size of the displayed date/time */\n  size?: DateTimeSize;\n}\n\nconst props = withDefaults(defineProps<PvDateTimeProps>(), {\n  variants: \"condensed\",\n  size: \"sm\",\n});\n\nconst { getCondensedDate, getTime } = useDateTime();\n\nconst dataFormat = computed(() => {\n  switch (props.variants) {\n    case \"time\": {\n      return getTime({ date: props.date, timezone: props.timezone });\n    }\n    case \"condensed\": {\n      return getCondensedDate({ date: props.date });\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <span\n    data-testid=\"pv-date-time\"\n    :class=\"[\n      'pv-text-subdued',\n      {\n        'pv-text-body-xxs': size === 'xs',\n        'pv-text-body-md': size === 'sm',\n      },\n    ]\"\n  >\n    {{ dataFormat }}\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvSize } from \"../baseProps\";\nimport { useDateTime } from \"./useDateTime\";\n\ntype DateTimeSize = Extract<PvSize, \"xs\" | \"sm\">;\n\ninterface PvDateTimeProps {\n  /** Display format: \"condensed\" for MM/DD/YYYY, \"time\" for h:mm AM/PM */\n  variants?: \"condensed\" | \"time\";\n  /** IANA timezone identifier for time display (e.g. \"America/New_York\") */\n  timezone?: string;\n  /** Date object to format and display */\n  date: Date;\n  /** Text size of the displayed date/time */\n  size?: DateTimeSize;\n}\n\nconst props = withDefaults(defineProps<PvDateTimeProps>(), {\n  variants: \"condensed\",\n  size: \"sm\",\n});\n\nconst { getCondensedDate, getTime } = useDateTime();\n\nconst dataFormat = computed(() => {\n  switch (props.variants) {\n    case \"time\": {\n      return getTime({ date: props.date, timezone: props.timezone });\n    }\n    case \"condensed\": {\n      return getCondensedDate({ date: props.date });\n    }\n    default: {\n      return \"\";\n    }\n  }\n});\n</script>\n\n<template>\n  <span\n    data-testid=\"pv-date-time\"\n    :class=\"[\n      'pv-text-subdued',\n      {\n        'pv-text-body-xxs': size === 'xs',\n        'pv-text-body-md': size === 'sm',\n      },\n    ]\"\n  >\n    {{ dataFormat }}\n  </span>\n</template>\n","import { computed, ref, toValue, type ComputedRef, type MaybeRefOrGetter, type Ref } from \"vue\";\n\n/** Which edge of the resized element the handle sits on. */\nexport type PvResizeEdge = \"bottom\" | \"left\" | \"right\" | \"top\";\n\nexport type PvResizeAxis = \"horizontal\" | \"vertical\";\n\n/** A px number, a px string (\"320px\"), or a percentage of the containing block (\"30%\"). */\nexport type PvResizeSize = number | string;\n\n/** Handles on the left/right edges change width; handles on the top/bottom edges change height. */\nexport const pvResizeAxisFor = (edge: PvResizeEdge): PvResizeAxis =>\n  edge === \"left\" || edge === \"right\" ? \"horizontal\" : \"vertical\";\n\n/**\n * Resolve a `PvResizeSize` to pixels. Percentages resolve against `containerSize`,\n * which is the inner size of the resized element's containing block.\n *\n * Returns undefined for values that cannot be resolved, so callers can fall back\n * rather than silently treating a typo as 0.\n */\nexport const resolvePvResizeSize = (value: PvResizeSize | undefined, containerSize: number): number | undefined => {\n  if (value === undefined || value === null || value === \"\") return undefined;\n  if (typeof value === \"number\") return Number.isFinite(value) ? value : undefined;\n\n  const trimmed = value.trim();\n  if (trimmed.endsWith(\"%\")) {\n    const percent = Number.parseFloat(trimmed);\n    return Number.isFinite(percent) ? (percent / 100) * containerSize : undefined;\n  }\n\n  const parsed = Number.parseFloat(trimmed);\n  return Number.isFinite(parsed) ? parsed : undefined;\n};\n\nexport interface UseResizableOptions {\n  /** Size the element snaps to when collapsed. Only used when `collapsible` is true. */\n  collapsedSize?: MaybeRefOrGetter<number>;\n  /** Allow dragging past `min` to collapse, and toggling collapse from the keyboard. */\n  collapsible?: MaybeRefOrGetter<boolean>;\n  /** Expanded size to restore when no previous interaction has recorded one. */\n  defaultSize?: MaybeRefOrGetter<number>;\n  disabled?: MaybeRefOrGetter<boolean>;\n  edge?: MaybeRefOrGetter<PvResizeEdge>;\n  /** Pixels moved per arrow key press. Shift multiplies it. */\n  keyboardStep?: MaybeRefOrGetter<number>;\n  /** Accessible name for the separator. */\n  label?: MaybeRefOrGetter<string>;\n  max: MaybeRefOrGetter<number>;\n  min: MaybeRefOrGetter<number>;\n  /** Fired for every intermediate size during a drag. */\n  onResize?: (size: number) => void;\n  /** Fired once when an interaction settles. This is the hook to persist from. */\n  onResizeEnd?: (size: number) => void;\n  onResizeStart?: (size: number) => void;\n  /** Reads the element's current size in pixels at the moment an interaction starts. */\n  readSize: () => number;\n  /** How far past `min` a drag has to travel before it snaps to `collapsedSize`. */\n  snapThreshold?: MaybeRefOrGetter<number>;\n}\n\nexport interface UseResizableReturn {\n  handleProps: ComputedRef<Record<string, unknown>>;\n  isCollapsed: ComputedRef<boolean>;\n  isResizing: Readonly<Ref<boolean>>;\n  /** The size this composable last committed, in pixels. */\n  size: Readonly<Ref<number>>;\n  /**\n   * Point the composable at the element's current size, e.g. after the container\n   * resized underneath it. Pass the value when the caller already knows it: a\n   * `v-model` write only reads back on the next tick, so re-measuring here would\n   * pick up the size the element had before the write.\n   */\n  syncSize: (value?: number) => void;\n  toggleCollapsed: () => void;\n}\n\nconst SHIFT_STEP_MULTIPLIER = 4;\n\n/**\n * Drag, keyboard, and ARIA behavior for a single resize handle.\n *\n * The composable owns no DOM. It reads the current size through `readSize` and\n * reports new ones through the callbacks, so the same logic drives a controlled\n * `v-model:size` binding, a CSS custom property written straight onto an\n * element, or anything else a consumer wants to do with the number.\n *\n * Dragging uses Pointer Events with pointer capture rather than document-level\n * mouse listeners. That gives touch and pen support for free, keeps the drag\n * alive over iframes and cross-origin embeds, scopes the resize cursor to the\n * captured element instead of mutating document.body, and tears the listeners\n * down automatically when the pointer is lost.\n */\nexport const useResizable = (options: UseResizableOptions): UseResizableReturn => {\n  const isResizing = ref(false);\n  const size = ref(0);\n\n  let activePointerId: number | null = null;\n  let startCoordinate = 0;\n  let startSize = 0;\n  let lastExpandedSize: number | null = null;\n\n  const edge = computed<PvResizeEdge>(() => toValue(options.edge) ?? \"right\");\n  const axis = computed(() => pvResizeAxisFor(edge.value));\n  const isDisabled = computed(() => toValue(options.disabled) ?? false);\n  const isCollapsible = computed(() => toValue(options.collapsible) ?? false);\n  const collapsedSize = computed(() => toValue(options.collapsedSize) ?? 0);\n  const snapThreshold = computed(() => toValue(options.snapThreshold) ?? 0);\n  const keyboardStep = computed(() => toValue(options.keyboardStep) ?? 16);\n  const min = computed(() => toValue(options.min));\n  // A max below min would make the clamp order-dependent, so min always wins.\n  const max = computed(() => Math.max(min.value, toValue(options.max)));\n\n  // Dragging toward the bottom-right grows an element whose handle is on its\n  // right or bottom edge, and shrinks one whose handle is on the opposite side.\n  const directionSign = computed(() => (edge.value === \"right\" || edge.value === \"bottom\" ? 1 : -1));\n\n  const isCollapsed = computed(() => isCollapsible.value && size.value <= collapsedSize.value);\n\n  const constrain = (raw: number): number => {\n    if (isCollapsible.value && raw < min.value - snapThreshold.value) return collapsedSize.value;\n    return Math.min(max.value, Math.max(min.value, raw));\n  };\n\n  const commit = (next: number) => {\n    // Mid-drag sizes are pointer-sampling noise. Remembering one of them would\n    // make the size a collapsed element reopens to depend on where the pointer\n    // happened to be sampled on its way past `min`, so the drag path records its\n    // starting size on pointerdown instead.\n    if (!isResizing.value && next > collapsedSize.value) lastExpandedSize = next;\n    size.value = next;\n    options.onResize?.(next);\n  };\n\n  const syncSize = (value?: number) => {\n    size.value = value ?? options.readSize();\n  };\n\n  const toggleCollapsed = () => {\n    if (!isCollapsible.value) return;\n\n    // Read through rather than trusting the cached size: a toggle can be the\n    // very first interaction, before anything has been committed.\n    const current = options.readSize();\n    const collapsed = current <= collapsedSize.value;\n    if (!collapsed) lastExpandedSize = current;\n\n    const expanded = lastExpandedSize ?? toValue(options.defaultSize) ?? min.value;\n    const restored = expanded > collapsedSize.value ? expanded : collapsedSize.value + Math.max(1, keyboardStep.value);\n    const next = collapsed ? Math.min(max.value, Math.max(min.value, restored)) : collapsedSize.value;\n    commit(next);\n    options.onResizeEnd?.(next);\n  };\n\n  const onPointerdown = (event: PointerEvent) => {\n    // Secondary buttons open context menus; starting a drag from them strands\n    // the handle in a captured state the user never asked for.\n    if (isDisabled.value || event.button !== 0) return;\n\n    // Suppresses the text selection and native image drag that a mousedown\n    // would otherwise kick off underneath the handle.\n    event.preventDefault();\n\n    const target = event.currentTarget as HTMLElement;\n    activePointerId = event.pointerId;\n    target.setPointerCapture?.(event.pointerId);\n\n    startCoordinate = axis.value === \"horizontal\" ? event.clientX : event.clientY;\n    startSize = options.readSize();\n    size.value = startSize;\n    if (startSize > collapsedSize.value) lastExpandedSize = startSize;\n    isResizing.value = true;\n    options.onResizeStart?.(startSize);\n  };\n\n  const onPointermove = (event: PointerEvent) => {\n    if (!isResizing.value || event.pointerId !== activePointerId) return;\n    const coordinate = axis.value === \"horizontal\" ? event.clientX : event.clientY;\n    commit(constrain(startSize + (coordinate - startCoordinate) * directionSign.value));\n  };\n\n  const endDrag = (event: PointerEvent) => {\n    if (!isResizing.value || event.pointerId !== activePointerId) return;\n    const target = event.currentTarget as HTMLElement;\n    if (target.hasPointerCapture?.(event.pointerId)) target.releasePointerCapture(event.pointerId);\n    activePointerId = null;\n    isResizing.value = false;\n    options.onResizeEnd?.(size.value);\n  };\n\n  const onKeydown = (event: KeyboardEvent) => {\n    if (isDisabled.value) return;\n\n    if ((event.key === \"Enter\" || event.key === \" \") && isCollapsible.value) {\n      event.preventDefault();\n      toggleCollapsed();\n      return;\n    }\n\n    const horizontal = axis.value === \"horizontal\";\n    const step =\n      (event.shiftKey ? keyboardStep.value * SHIFT_STEP_MULTIPLIER : keyboardStep.value) * directionSign.value;\n    const current = options.readSize();\n    let next: number | undefined;\n\n    switch (event.key) {\n      case \"ArrowLeft\":\n        if (horizontal) next = current - step;\n        break;\n      case \"ArrowRight\":\n        if (horizontal) next = current + step;\n        break;\n      case \"ArrowUp\":\n        if (!horizontal) next = current - step;\n        break;\n      case \"ArrowDown\":\n        if (!horizontal) next = current + step;\n        break;\n      case \"Home\":\n        next = min.value;\n        break;\n      case \"End\":\n        next = max.value;\n        break;\n    }\n\n    if (next === undefined) return;\n\n    event.preventDefault();\n    // Home/End are absolute, so they must not be re-collapsed by the snap rule.\n    const resolved = event.key === \"Home\" || event.key === \"End\" ? next : constrain(next);\n    commit(resolved);\n    // Each keypress is a complete interaction, so consumers persisting on\n    // resize-end get one write per press rather than one per drag.\n    options.onResizeEnd?.(resolved);\n  };\n\n  const handleProps = computed<Record<string, unknown>>(() => ({\n    \"aria-disabled\": isDisabled.value || undefined,\n    \"aria-label\": toValue(options.label),\n    // A handle that moves along the horizontal axis draws a vertical separator.\n    \"aria-orientation\": axis.value === \"horizontal\" ? \"vertical\" : \"horizontal\",\n    \"aria-valuemax\": Math.round(max.value),\n    \"aria-valuemin\": Math.round(isCollapsible.value ? Math.min(min.value, collapsedSize.value) : min.value),\n    \"aria-valuenow\": Math.round(size.value),\n    \"aria-valuetext\": isCollapsed.value ? \"Collapsed\" : undefined,\n    \"data-pv-collapsed\": isCollapsed.value || undefined,\n    \"data-pv-resize-axis\": axis.value,\n    \"data-pv-resize-edge\": edge.value,\n    \"data-pv-resizing\": isResizing.value || undefined,\n    onKeydown,\n    onLostpointercapture: endDrag,\n    onPointercancel: endDrag,\n    onPointerdown,\n    onPointermove,\n    onPointerup: endDrag,\n    role: \"separator\",\n    tabindex: isDisabled.value ? -1 : 0,\n  }));\n\n  return {\n    handleProps,\n    isCollapsed,\n    isResizing,\n    size,\n    syncSize,\n    toggleCollapsed,\n  };\n};\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, ref, useTemplateRef, watch } from \"vue\";\nimport { useElementSize, useWindowSize } from \"@vueuse/core\";\n\nimport { pvResizeAxisFor, resolvePvResizeSize, useResizable } from \"@/composables/useResizable\";\nimport type { PvResizeEvent, PvResizeHandleProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvResizeHandleProps>(), {\n  ariaLabel: \"Resize\",\n  collapsedSize: 0,\n  collapsible: false,\n  controlled: false,\n  disabled: false,\n  edge: \"right\",\n  keyboardStep: 16,\n  minSize: 0,\n  snapThreshold: 0,\n});\n\n/** The resolved size in pixels. Optional: bind it only if you want to drive the size yourself. */\nconst size = defineModel<number>(\"size\");\n\nconst emit = defineEmits<{\n  (e: \"resize\", event: PvResizeEvent): void;\n  (e: \"resize-end\", event: PvResizeEvent): void;\n  (e: \"resize-start\", event: PvResizeEvent): void;\n}>();\n\nconst handle = useTemplateRef<HTMLElement>(\"handle\");\nconst target = ref<HTMLElement | null>(null);\n// Initial bounds must not turn the natural content width into a model value\n// before the explicit, persisted, or default size has been resolved.\nlet initialized = false;\n\nconst axis = computed(() => pvResizeAxisFor(props.edge));\n\n/**\n * The element the handle resizes is simply its parent. In the web component\n * build the handle renders inside a shadow root, so the walk has to hop from\n * the root to its host before it lands back in the light DOM.\n */\nconst findTarget = (element: HTMLElement | null): HTMLElement | null => {\n  let node = (element?.parentNode ?? null) as (Node & { host?: Element }) | null;\n  while (node) {\n    if (node.nodeType === 1) return node as HTMLElement;\n    node = (node.host ? node.host.parentNode : node.parentNode) as (Node & { host?: Element }) | null;\n  }\n  return null;\n};\n\nconst container = computed(() => target.value?.parentElement ?? null);\nconst { height: containerHeight, width: containerWidth } = useElementSize(container);\nconst { height: viewportHeight, width: viewportWidth } = useWindowSize({ initialWidth: 0, initialHeight: 0 });\n\nconst measureContainer = () => {\n  const element = container.value;\n  if (!element) return 0;\n  const rect = element.getBoundingClientRect();\n  return axis.value === \"horizontal\" ? rect.width : rect.height;\n};\n\n/**\n * ResizeObserver reports asynchronously, so on the first frame the observed\n * size is still zero. A percentage default resolved against zero would pin the\n * element to its minimum before the user ever saw the intended layout, so fall\n * back to reading the box directly until the observer catches up.\n */\nconst containerSize = computed(() => {\n  const observed = axis.value === \"horizontal\" ? containerWidth.value : containerHeight.value;\n  return observed > 0 ? observed : measureContainer();\n});\n\nconst minPx = computed(() => resolvePvResizeSize(props.minSize, containerSize.value) ?? 0);\nconst collapsedPx = computed(() => resolvePvResizeSize(props.collapsedSize, containerSize.value) ?? 0);\n\n/**\n * With no `maxSize` the natural ceiling is the container. Before the container\n * has been measured, use the viewport rather than exposing an unbounded End key\n * and ARIA range. Percentage defaults still wait for the actual container.\n */\nconst maxPx = computed(() => {\n  const resolved = resolvePvResizeSize(props.maxSize, containerSize.value);\n  if (resolved !== undefined && resolved > 0) return resolved;\n  return containerSize.value > 0\n    ? containerSize.value\n    : axis.value === \"horizontal\"\n      ? viewportWidth.value\n      : viewportHeight.value;\n});\n\nconst clamp = (value: number) =>\n  props.collapsible && value === collapsedPx.value ? value : Math.max(minPx.value, Math.min(maxPx.value, value));\n\nconst measureTarget = () => {\n  const element = target.value;\n  if (!element) return 0;\n  const rect = element.getBoundingClientRect();\n  return axis.value === \"horizontal\" ? rect.width : rect.height;\n};\n\nconst readSize = () => size.value ?? measureTarget();\n\nconst applyToTarget = (next: number) => {\n  if (props.controlled) return;\n  target.value?.style.setProperty(\"--pv-resize-size\", `${next}px`);\n};\n\nconst toEvent = (value: number): PvResizeEvent => ({\n  collapsed: props.collapsible && value <= collapsedPx.value,\n  edge: props.edge,\n  size: value,\n});\n\n// Safari's private mode and hardened browser profiles throw on storage access,\n// which must never take the handle down with it.\nconst readStoredSize = (): Pick<PvResizeEvent, \"size\" | \"collapsed\"> | undefined => {\n  if (!props.storageKey || typeof window === \"undefined\") return undefined;\n  try {\n    const raw = window.localStorage.getItem(props.storageKey);\n    if (raw === null) return undefined;\n    const parsed: unknown = JSON.parse(raw);\n    // Keep accepting the original numeric storage format.\n    if (typeof parsed === \"number\" && Number.isFinite(parsed)) return { size: parsed, collapsed: false };\n    if (\n      parsed &&\n      typeof parsed === \"object\" &&\n      \"size\" in parsed &&\n      typeof parsed.size === \"number\" &&\n      Number.isFinite(parsed.size)\n    ) {\n      return { size: parsed.size, collapsed: \"collapsed\" in parsed && parsed.collapsed === true };\n    }\n    return undefined;\n  } catch {\n    return undefined;\n  }\n};\n\nconst persistSize = (value: number) => {\n  if (!props.storageKey || typeof window === \"undefined\") return;\n  try {\n    // Persist intent as well as pixels: a percentage collapse changes with the container.\n    const { size, collapsed } = toEvent(value);\n    window.localStorage.setItem(props.storageKey, JSON.stringify({ size, collapsed }));\n  } catch {\n    // Storage is unavailable; the size still applies for this session.\n  }\n};\n\nconst commitSize = (next: number) => {\n  applyToTarget(next);\n  size.value = next;\n};\n\nconst { handleProps, isResizing, syncSize } = useResizable({\n  collapsedSize: collapsedPx,\n  collapsible: () => props.collapsible,\n  defaultSize: () => resolvePvResizeSize(props.defaultSize, containerSize.value) ?? minPx.value,\n  disabled: () => props.disabled,\n  edge: () => props.edge,\n  keyboardStep: () => props.keyboardStep,\n  label: () => props.ariaLabel,\n  max: maxPx,\n  min: minPx,\n  onResize: (next) => {\n    commitSize(next);\n    emit(\"resize\", toEvent(next));\n  },\n  onResizeEnd: (next) => {\n    persistSize(next);\n    emit(\"resize-end\", toEvent(next));\n  },\n  onResizeStart: (next) => emit(\"resize-start\", toEvent(next)),\n  readSize,\n  snapThreshold: () => props.snapThreshold,\n});\n\n// Model writes can originate in the consumer, not just our interaction handlers.\n// Synchronize without emitting another resize or persisting an unfinished change.\nwatch(size, (next) => {\n  if (!initialized) {\n    initializeSize();\n    return;\n  }\n  if (next === undefined) return;\n  const clamped = clamp(next);\n  commitSize(clamped);\n  syncSize(clamped);\n});\n\n// `.pv-resizable` needs to know which dimension `--pv-resize-size` feeds.\nwatch([target, axis], ([element, currentAxis]) => element?.setAttribute(\"data-pv-resize-axis\", currentAxis), {\n  immediate: true,\n});\n\n// Suppresses width/height transitions on the target for the length of the drag,\n// so the element tracks the pointer instead of easing along behind it.\nwatch(isResizing, (resizing) => {\n  const element = target.value;\n  if (!element) return;\n  if (resizing) element.setAttribute(\"data-pv-resizing\", \"\");\n  else element.removeAttribute(\"data-pv-resizing\");\n});\n\n// The container can change size underneath a percentage bound, which moves the\n// clamp without anything having been dragged.\nwatch([minPx, maxPx, collapsedPx], ([, , collapsed], [, , previousCollapsed]) => {\n  if (!initialized || isResizing.value) return;\n  const current = readSize();\n  // Compare with the old threshold, before a percentage change can make an\n  // already-collapsed panel appear expanded.\n  const wasCollapsed = props.collapsible && current <= previousCollapsed;\n  if (current === 0 && !wasCollapsed) return;\n  const clamped = wasCollapsed ? collapsed : clamp(current);\n  if (clamped !== current) commitSize(clamped);\n  syncSize(clamped);\n});\n\nconst initializeSize = () => {\n  if (initialized || !target.value) return;\n  const stored = size.value === undefined ? readStoredSize() : undefined;\n  const source =\n    size.value ?? (stored?.collapsed && props.collapsible ? props.collapsedSize : stored?.size) ?? props.defaultSize;\n  if (typeof source === \"string\" && source.trim().endsWith(\"%\") && containerSize.value <= 0) return;\n  initialized = true;\n\n  const initial = resolvePvResizeSize(source, containerSize.value);\n  if (initial === undefined) {\n    const current = readSize();\n    const clamped = current === 0 ? 0 : clamp(current);\n    if (clamped !== current) commitSize(clamped);\n    syncSize(clamped);\n    return;\n  }\n\n  const clamped = clamp(initial);\n  commitSize(clamped);\n  syncSize(clamped);\n};\n\nwatch(containerSize, initializeSize);\nonMounted(async () => {\n  target.value = findTarget(handle.value);\n  await nextTick();\n  initializeSize();\n});\n</script>\n\n<template>\n  <div ref=\"handle\" class=\"pv-resize-handle\" data-testid=\"pv-resize-handle\" v-bind=\"handleProps\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, ref, useTemplateRef, watch } from \"vue\";\nimport { useElementSize, useWindowSize } from \"@vueuse/core\";\n\nimport { pvResizeAxisFor, resolvePvResizeSize, useResizable } from \"@/composables/useResizable\";\nimport type { PvResizeEvent, PvResizeHandleProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvResizeHandleProps>(), {\n  ariaLabel: \"Resize\",\n  collapsedSize: 0,\n  collapsible: false,\n  controlled: false,\n  disabled: false,\n  edge: \"right\",\n  keyboardStep: 16,\n  minSize: 0,\n  snapThreshold: 0,\n});\n\n/** The resolved size in pixels. Optional: bind it only if you want to drive the size yourself. */\nconst size = defineModel<number>(\"size\");\n\nconst emit = defineEmits<{\n  (e: \"resize\", event: PvResizeEvent): void;\n  (e: \"resize-end\", event: PvResizeEvent): void;\n  (e: \"resize-start\", event: PvResizeEvent): void;\n}>();\n\nconst handle = useTemplateRef<HTMLElement>(\"handle\");\nconst target = ref<HTMLElement | null>(null);\n// Initial bounds must not turn the natural content width into a model value\n// before the explicit, persisted, or default size has been resolved.\nlet initialized = false;\n\nconst axis = computed(() => pvResizeAxisFor(props.edge));\n\n/**\n * The element the handle resizes is simply its parent. In the web component\n * build the handle renders inside a shadow root, so the walk has to hop from\n * the root to its host before it lands back in the light DOM.\n */\nconst findTarget = (element: HTMLElement | null): HTMLElement | null => {\n  let node = (element?.parentNode ?? null) as (Node & { host?: Element }) | null;\n  while (node) {\n    if (node.nodeType === 1) return node as HTMLElement;\n    node = (node.host ? node.host.parentNode : node.parentNode) as (Node & { host?: Element }) | null;\n  }\n  return null;\n};\n\nconst container = computed(() => target.value?.parentElement ?? null);\nconst { height: containerHeight, width: containerWidth } = useElementSize(container);\nconst { height: viewportHeight, width: viewportWidth } = useWindowSize({ initialWidth: 0, initialHeight: 0 });\n\nconst measureContainer = () => {\n  const element = container.value;\n  if (!element) return 0;\n  const rect = element.getBoundingClientRect();\n  return axis.value === \"horizontal\" ? rect.width : rect.height;\n};\n\n/**\n * ResizeObserver reports asynchronously, so on the first frame the observed\n * size is still zero. A percentage default resolved against zero would pin the\n * element to its minimum before the user ever saw the intended layout, so fall\n * back to reading the box directly until the observer catches up.\n */\nconst containerSize = computed(() => {\n  const observed = axis.value === \"horizontal\" ? containerWidth.value : containerHeight.value;\n  return observed > 0 ? observed : measureContainer();\n});\n\nconst minPx = computed(() => resolvePvResizeSize(props.minSize, containerSize.value) ?? 0);\nconst collapsedPx = computed(() => resolvePvResizeSize(props.collapsedSize, containerSize.value) ?? 0);\n\n/**\n * With no `maxSize` the natural ceiling is the container. Before the container\n * has been measured, use the viewport rather than exposing an unbounded End key\n * and ARIA range. Percentage defaults still wait for the actual container.\n */\nconst maxPx = computed(() => {\n  const resolved = resolvePvResizeSize(props.maxSize, containerSize.value);\n  if (resolved !== undefined && resolved > 0) return resolved;\n  return containerSize.value > 0\n    ? containerSize.value\n    : axis.value === \"horizontal\"\n      ? viewportWidth.value\n      : viewportHeight.value;\n});\n\nconst clamp = (value: number) =>\n  props.collapsible && value === collapsedPx.value ? value : Math.max(minPx.value, Math.min(maxPx.value, value));\n\nconst measureTarget = () => {\n  const element = target.value;\n  if (!element) return 0;\n  const rect = element.getBoundingClientRect();\n  return axis.value === \"horizontal\" ? rect.width : rect.height;\n};\n\nconst readSize = () => size.value ?? measureTarget();\n\nconst applyToTarget = (next: number) => {\n  if (props.controlled) return;\n  target.value?.style.setProperty(\"--pv-resize-size\", `${next}px`);\n};\n\nconst toEvent = (value: number): PvResizeEvent => ({\n  collapsed: props.collapsible && value <= collapsedPx.value,\n  edge: props.edge,\n  size: value,\n});\n\n// Safari's private mode and hardened browser profiles throw on storage access,\n// which must never take the handle down with it.\nconst readStoredSize = (): Pick<PvResizeEvent, \"size\" | \"collapsed\"> | undefined => {\n  if (!props.storageKey || typeof window === \"undefined\") return undefined;\n  try {\n    const raw = window.localStorage.getItem(props.storageKey);\n    if (raw === null) return undefined;\n    const parsed: unknown = JSON.parse(raw);\n    // Keep accepting the original numeric storage format.\n    if (typeof parsed === \"number\" && Number.isFinite(parsed)) return { size: parsed, collapsed: false };\n    if (\n      parsed &&\n      typeof parsed === \"object\" &&\n      \"size\" in parsed &&\n      typeof parsed.size === \"number\" &&\n      Number.isFinite(parsed.size)\n    ) {\n      return { size: parsed.size, collapsed: \"collapsed\" in parsed && parsed.collapsed === true };\n    }\n    return undefined;\n  } catch {\n    return undefined;\n  }\n};\n\nconst persistSize = (value: number) => {\n  if (!props.storageKey || typeof window === \"undefined\") return;\n  try {\n    // Persist intent as well as pixels: a percentage collapse changes with the container.\n    const { size, collapsed } = toEvent(value);\n    window.localStorage.setItem(props.storageKey, JSON.stringify({ size, collapsed }));\n  } catch {\n    // Storage is unavailable; the size still applies for this session.\n  }\n};\n\nconst commitSize = (next: number) => {\n  applyToTarget(next);\n  size.value = next;\n};\n\nconst { handleProps, isResizing, syncSize } = useResizable({\n  collapsedSize: collapsedPx,\n  collapsible: () => props.collapsible,\n  defaultSize: () => resolvePvResizeSize(props.defaultSize, containerSize.value) ?? minPx.value,\n  disabled: () => props.disabled,\n  edge: () => props.edge,\n  keyboardStep: () => props.keyboardStep,\n  label: () => props.ariaLabel,\n  max: maxPx,\n  min: minPx,\n  onResize: (next) => {\n    commitSize(next);\n    emit(\"resize\", toEvent(next));\n  },\n  onResizeEnd: (next) => {\n    persistSize(next);\n    emit(\"resize-end\", toEvent(next));\n  },\n  onResizeStart: (next) => emit(\"resize-start\", toEvent(next)),\n  readSize,\n  snapThreshold: () => props.snapThreshold,\n});\n\n// Model writes can originate in the consumer, not just our interaction handlers.\n// Synchronize without emitting another resize or persisting an unfinished change.\nwatch(size, (next) => {\n  if (!initialized) {\n    initializeSize();\n    return;\n  }\n  if (next === undefined) return;\n  const clamped = clamp(next);\n  commitSize(clamped);\n  syncSize(clamped);\n});\n\n// `.pv-resizable` needs to know which dimension `--pv-resize-size` feeds.\nwatch([target, axis], ([element, currentAxis]) => element?.setAttribute(\"data-pv-resize-axis\", currentAxis), {\n  immediate: true,\n});\n\n// Suppresses width/height transitions on the target for the length of the drag,\n// so the element tracks the pointer instead of easing along behind it.\nwatch(isResizing, (resizing) => {\n  const element = target.value;\n  if (!element) return;\n  if (resizing) element.setAttribute(\"data-pv-resizing\", \"\");\n  else element.removeAttribute(\"data-pv-resizing\");\n});\n\n// The container can change size underneath a percentage bound, which moves the\n// clamp without anything having been dragged.\nwatch([minPx, maxPx, collapsedPx], ([, , collapsed], [, , previousCollapsed]) => {\n  if (!initialized || isResizing.value) return;\n  const current = readSize();\n  // Compare with the old threshold, before a percentage change can make an\n  // already-collapsed panel appear expanded.\n  const wasCollapsed = props.collapsible && current <= previousCollapsed;\n  if (current === 0 && !wasCollapsed) return;\n  const clamped = wasCollapsed ? collapsed : clamp(current);\n  if (clamped !== current) commitSize(clamped);\n  syncSize(clamped);\n});\n\nconst initializeSize = () => {\n  if (initialized || !target.value) return;\n  const stored = size.value === undefined ? readStoredSize() : undefined;\n  const source =\n    size.value ?? (stored?.collapsed && props.collapsible ? props.collapsedSize : stored?.size) ?? props.defaultSize;\n  if (typeof source === \"string\" && source.trim().endsWith(\"%\") && containerSize.value <= 0) return;\n  initialized = true;\n\n  const initial = resolvePvResizeSize(source, containerSize.value);\n  if (initial === undefined) {\n    const current = readSize();\n    const clamped = current === 0 ? 0 : clamp(current);\n    if (clamped !== current) commitSize(clamped);\n    syncSize(clamped);\n    return;\n  }\n\n  const clamped = clamp(initial);\n  commitSize(clamped);\n  syncSize(clamped);\n};\n\nwatch(containerSize, initializeSize);\nonMounted(async () => {\n  target.value = findTarget(handle.value);\n  await nextTick();\n  initializeSize();\n});\n</script>\n\n<template>\n  <div ref=\"handle\" class=\"pv-resize-handle\" data-testid=\"pv-resize-handle\" v-bind=\"handleProps\" />\n</template>\n","<script setup lang=\"ts\">\nimport { watch, useTemplateRef, onMounted } from \"vue\";\nimport { onKeyStroke, onClickOutside, useWindowSize } from \"@vueuse/core\";\n\nimport PvSearchInput, { PvSearchInputProps } from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvResizeHandle from \"../PvResizeHandle/PvResizeHandle.vue\";\nimport { resolvePvResizeSize, type PvResizeSize } from \"@/composables/useResizable\";\n\nexport interface PvDrawerProps {\n  closeOnClickOutside?: boolean;\n  /** Initial resizable width. Defaults to 600px, capped by the viewport. */\n  defaultWidth?: PvResizeSize;\n  header?: string;\n  /** Omit the built-in header when the drawer content provides its own. */\n  hideHeader?: boolean;\n  /** Defaults to the viewport width. Percentages resolve against the viewport. */\n  maxWidth?: PvResizeSize;\n  /** Only used when `resizable` is set. */\n  minWidth?: PvResizeSize;\n  /** Show a drag handle that resizes the drawer horizontally. */\n  resizable?: boolean;\n  /**\n   * Which edge carries the drag handle. A drawer docked on the right of the\n   * page is resized from its left edge, and vice versa.\n   */\n  resizeEdge?: \"left\" | \"right\";\n  /** When set, the drawer's width is persisted to localStorage under this key. */\n  resizeStorageKey?: string;\n  searchInputProps?: PvSearchInputProps;\n  showSearchbar?: boolean;\n  subheader?: string;\n}\n\n/**\n * @deprecated Use `PvDrawerProps` instead. Retained as an alias for backwards\n * compatibility with any existing imports of the props interface.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface PvDrawer extends PvDrawerProps {}\n\nconst props = withDefaults(defineProps<PvDrawerProps>(), {\n  closeOnClickOutside: false,\n  minWidth: 240,\n  resizable: false,\n  resizeEdge: \"left\",\n});\n\nconst emit = defineEmits<{\n  (e: \"click-outside\"): void;\n}>();\n\nconst sidePanel = useTemplateRef(\"sidePanel\");\nconst { width: viewportWidth } = useWindowSize({ initialWidth: 0 });\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n});\n/** The drawer's current width in pixels. Only meaningful when `resizable` is set. */\nconst width = defineModel<number>(\"width\", {\n  required: false,\n});\nconst showDrawer = defineModel<boolean>({\n  required: true,\n});\n\nconst handleClose = () => {\n  sidePanel?.value?.removeAttribute(\"open\");\n  showDrawer.value = false;\n};\n\nconst attachClickOutsideHandler = () => {\n  if (!sidePanel.value) return;\n\n  onClickOutside(\n    sidePanel.value,\n    () => {\n      if (showDrawer.value) {\n        emit(\"click-outside\");\n        handleClose();\n      }\n    },\n    { ignore: [\".pv-click-outside-ignore\"] },\n  );\n};\n\nonMounted(() => {\n  if (showDrawer.value) {\n    sidePanel?.value?.setAttribute(\"open\", \"true\");\n  }\n\n  if (props.closeOnClickOutside) {\n    attachClickOutsideHandler();\n  }\n});\n\nwatch(\n  () => showDrawer.value,\n  () => {\n    if (showDrawer.value) {\n      sidePanel?.value?.setAttribute(\"open\", \"true\");\n    } else {\n      sidePanel?.value?.removeAttribute(\"open\");\n    }\n  },\n);\n\nonKeyStroke(\"Escape\", () => {\n  if (sidePanel.value && showDrawer.value) {\n    handleClose();\n  }\n});\n</script>\n\n<template>\n  <div\n    class=\"pv-drawer pv-surface\"\n    :class=\"{ 'pv-resizable': resizable }\"\n    ref=\"sidePanel\"\n    data-testid=\"pv-drawer\"\n    style=\"display: flex; flex-direction: column; height: 100%\"\n  >\n    <PvResizeHandle\n      v-if=\"resizable\"\n      v-model:size=\"width\"\n      ariaLabel=\"Resize drawer\"\n      :defaultSize=\"resolvePvResizeSize(defaultWidth, viewportWidth) ?? Math.min(600, viewportWidth)\"\n      :edge=\"resizeEdge\"\n      :maxSize=\"resolvePvResizeSize(maxWidth, viewportWidth) ?? viewportWidth\"\n      :minSize=\"resolvePvResizeSize(minWidth, viewportWidth)\"\n      :storageKey=\"resizeStorageKey\"\n    />\n    <!-- Header Section (Fixed) -->\n    <div v-if=\"!hideHeader\" class=\"pv-inset-squish-12 pv-border-bottom\" style=\"flex-shrink: 0\">\n      <slot v-if=\"$slots.header\" name=\"header\" />\n      <template v-else>\n        <div class=\"pv-flex-vertical pv-stack-16\" style=\"--flex-align: flex-start\">\n          <div class=\"pv-flex pv-full-width\">\n            <span class=\"pv-full-width pv-heading-3\">{{ header }}</span>\n            <PvButton\n              left-icon=\"close\"\n              ariaLabel=\"Close\"\n              size=\"md\"\n              @click=\"handleClose\"\n              data-testid=\"pv-side-panel-close-button\"\n              variant=\"ghost\"\n            />\n          </div>\n          <span v-if=\"subheader\" class=\"pv-text-body-md\">{{ subheader }}</span>\n        </div>\n        <div v-if=\"showSearchbar && searchInput !== undefined\" class=\"pv-inset-inline-16\">\n          <PvSearchInput\n            data-testid=\"pv-side-panel-input-search\"\n            v-model=\"searchInput\"\n            v-bind=\"props.searchInputProps\"\n          />\n        </div>\n      </template>\n    </div>\n\n    <!-- Main Content Section (Scrollable) -->\n    <div class=\"pv-inset-inline-16\" style=\"flex: 1; overflow-y: auto; min-height: 0\">\n      <slot />\n    </div>\n\n    <!-- Footer Section (Fixed) -->\n    <div v-if=\"$slots.footer\" class=\"pv-inset-squish-12 pv-border-top\" style=\"flex-shrink: 0\">\n      <slot name=\"footer\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { watch, useTemplateRef, onMounted } from \"vue\";\nimport { onKeyStroke, onClickOutside, useWindowSize } from \"@vueuse/core\";\n\nimport PvSearchInput, { PvSearchInputProps } from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvResizeHandle from \"../PvResizeHandle/PvResizeHandle.vue\";\nimport { resolvePvResizeSize, type PvResizeSize } from \"@/composables/useResizable\";\n\nexport interface PvDrawerProps {\n  closeOnClickOutside?: boolean;\n  /** Initial resizable width. Defaults to 600px, capped by the viewport. */\n  defaultWidth?: PvResizeSize;\n  header?: string;\n  /** Omit the built-in header when the drawer content provides its own. */\n  hideHeader?: boolean;\n  /** Defaults to the viewport width. Percentages resolve against the viewport. */\n  maxWidth?: PvResizeSize;\n  /** Only used when `resizable` is set. */\n  minWidth?: PvResizeSize;\n  /** Show a drag handle that resizes the drawer horizontally. */\n  resizable?: boolean;\n  /**\n   * Which edge carries the drag handle. A drawer docked on the right of the\n   * page is resized from its left edge, and vice versa.\n   */\n  resizeEdge?: \"left\" | \"right\";\n  /** When set, the drawer's width is persisted to localStorage under this key. */\n  resizeStorageKey?: string;\n  searchInputProps?: PvSearchInputProps;\n  showSearchbar?: boolean;\n  subheader?: string;\n}\n\n/**\n * @deprecated Use `PvDrawerProps` instead. Retained as an alias for backwards\n * compatibility with any existing imports of the props interface.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface PvDrawer extends PvDrawerProps {}\n\nconst props = withDefaults(defineProps<PvDrawerProps>(), {\n  closeOnClickOutside: false,\n  minWidth: 240,\n  resizable: false,\n  resizeEdge: \"left\",\n});\n\nconst emit = defineEmits<{\n  (e: \"click-outside\"): void;\n}>();\n\nconst sidePanel = useTemplateRef(\"sidePanel\");\nconst { width: viewportWidth } = useWindowSize({ initialWidth: 0 });\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n});\n/** The drawer's current width in pixels. Only meaningful when `resizable` is set. */\nconst width = defineModel<number>(\"width\", {\n  required: false,\n});\nconst showDrawer = defineModel<boolean>({\n  required: true,\n});\n\nconst handleClose = () => {\n  sidePanel?.value?.removeAttribute(\"open\");\n  showDrawer.value = false;\n};\n\nconst attachClickOutsideHandler = () => {\n  if (!sidePanel.value) return;\n\n  onClickOutside(\n    sidePanel.value,\n    () => {\n      if (showDrawer.value) {\n        emit(\"click-outside\");\n        handleClose();\n      }\n    },\n    { ignore: [\".pv-click-outside-ignore\"] },\n  );\n};\n\nonMounted(() => {\n  if (showDrawer.value) {\n    sidePanel?.value?.setAttribute(\"open\", \"true\");\n  }\n\n  if (props.closeOnClickOutside) {\n    attachClickOutsideHandler();\n  }\n});\n\nwatch(\n  () => showDrawer.value,\n  () => {\n    if (showDrawer.value) {\n      sidePanel?.value?.setAttribute(\"open\", \"true\");\n    } else {\n      sidePanel?.value?.removeAttribute(\"open\");\n    }\n  },\n);\n\nonKeyStroke(\"Escape\", () => {\n  if (sidePanel.value && showDrawer.value) {\n    handleClose();\n  }\n});\n</script>\n\n<template>\n  <div\n    class=\"pv-drawer pv-surface\"\n    :class=\"{ 'pv-resizable': resizable }\"\n    ref=\"sidePanel\"\n    data-testid=\"pv-drawer\"\n    style=\"display: flex; flex-direction: column; height: 100%\"\n  >\n    <PvResizeHandle\n      v-if=\"resizable\"\n      v-model:size=\"width\"\n      ariaLabel=\"Resize drawer\"\n      :defaultSize=\"resolvePvResizeSize(defaultWidth, viewportWidth) ?? Math.min(600, viewportWidth)\"\n      :edge=\"resizeEdge\"\n      :maxSize=\"resolvePvResizeSize(maxWidth, viewportWidth) ?? viewportWidth\"\n      :minSize=\"resolvePvResizeSize(minWidth, viewportWidth)\"\n      :storageKey=\"resizeStorageKey\"\n    />\n    <!-- Header Section (Fixed) -->\n    <div v-if=\"!hideHeader\" class=\"pv-inset-squish-12 pv-border-bottom\" style=\"flex-shrink: 0\">\n      <slot v-if=\"$slots.header\" name=\"header\" />\n      <template v-else>\n        <div class=\"pv-flex-vertical pv-stack-16\" style=\"--flex-align: flex-start\">\n          <div class=\"pv-flex pv-full-width\">\n            <span class=\"pv-full-width pv-heading-3\">{{ header }}</span>\n            <PvButton\n              left-icon=\"close\"\n              ariaLabel=\"Close\"\n              size=\"md\"\n              @click=\"handleClose\"\n              data-testid=\"pv-side-panel-close-button\"\n              variant=\"ghost\"\n            />\n          </div>\n          <span v-if=\"subheader\" class=\"pv-text-body-md\">{{ subheader }}</span>\n        </div>\n        <div v-if=\"showSearchbar && searchInput !== undefined\" class=\"pv-inset-inline-16\">\n          <PvSearchInput\n            data-testid=\"pv-side-panel-input-search\"\n            v-model=\"searchInput\"\n            v-bind=\"props.searchInputProps\"\n          />\n        </div>\n      </template>\n    </div>\n\n    <!-- Main Content Section (Scrollable) -->\n    <div class=\"pv-inset-inline-16\" style=\"flex: 1; overflow-y: auto; min-height: 0\">\n      <slot />\n    </div>\n\n    <!-- Footer Section (Fixed) -->\n    <div v-if=\"$slots.footer\" class=\"pv-inset-squish-12 pv-border-top\" style=\"flex-shrink: 0\">\n      <slot name=\"footer\" />\n    </div>\n  </div>\n</template>\n","import type { InjectionKey } from \"vue\";\n\n/** A single value within a `ContextEntityField`. Set `isClickable` to render it as interactive. */\nexport interface ContextEntityFieldValue {\n  name: string;\n  isClickable?: boolean;\n  /** Opaque identifier for this value (e.g. a knowledge-graph id). Not read internally; consumers resolve it themselves in their `show-context` handler. */\n  contextIdentifier?: string;\n}\n\n/** A pre-built label/value entry for PvSpinesEntityFields and PvContextFeedback. */\nexport interface ContextEntityField {\n  label: string;\n  value: ContextEntityFieldValue | ContextEntityFieldValue[];\n}\n\nexport interface ContextFeedbackPayload {\n  fields: string[];\n  comment: string;\n}\n\n/** Emitted as PvContextSurface's `show-context` event when a clickable value is activated. */\nexport interface ShowContextPayload {\n  contextIdentifier: string;\n}\n\n/**\n * Lets content slotted into PvContextSurface (e.g. PvSpinesEntityFields) request a context\n * change without the consumer manually relaying an intermediate event. PvContextSurface\n * provides this; slotted content injects it and calls `showContext` directly, and\n * PvContextSurface re-emits it as its own `show-context` event.\n */\nexport interface PvContextSurfaceContext {\n  showContext: (payload: ShowContextPayload) => void;\n}\n\nexport const PvContextSurfaceKey: InjectionKey<PvContextSurfaceContext> = Symbol(\"PvContextSurface\");\n","<script setup lang=\"ts\">\nimport { computed, provide, useId, useTemplateRef, onMounted, onUnmounted, useAttrs } from \"vue\";\nimport { onKeyStroke, onClickOutside } from \"@vueuse/core\";\nimport type { ShowContextPayload } from \"../config.ts\";\nimport { PvContextSurfaceKey } from \"../config.ts\";\nimport PvTag from \"../../PvTag/PvTag.vue\";\nimport PvButton from \"../../PvButton/PvButton.vue\";\nimport PvCompanyLogo from \"../../PvCompanyLogo/PvCompanyLogo.vue\";\n\ninterface PvContextSurfaceProps {\n  /** Controls the outer surface: `pv-card` or `pv-drawer pv-surface`. */\n  variant: \"card\" | \"drawer\";\n  /** Tag shown in the header row. Omit to hide the tag. Payer/Provider (case-insensitive) also swap in PvCompanyLogo next to the default title. */\n  contextType?: string;\n  /** Used by the default title when the `title` slot isn't provided. */\n  header: string;\n  /** Hides the close button. */\n  disableClose?: boolean;\n  /** Shows a back arrow in the header row, for callers that support drilling back up a navigation stack. */\n  showBack?: boolean;\n}\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps<PvContextSurfaceProps>();\n\nconst emit = defineEmits<{\n  (e: \"close\"): void;\n  (e: \"back\"): void;\n  (e: \"show-context\", payload: ShowContextPayload): void;\n}>();\n\nprovide(PvContextSurfaceKey, {\n  showContext: (payload) => emit(\"show-context\", payload),\n});\n\nconst surfaceClass = computed(() =>\n  props.variant === \"card\" ? \"pv-card pv-context-surface\" : \"pv-drawer pv-surface pv-context-surface\",\n);\n\nconst usesCompanyLogo = computed(() => {\n  const contextType = props.contextType?.toLowerCase();\n  return contextType === \"payer\" || contextType === \"provider\";\n});\n\nconst attrs = useAttrs();\nconst generatedTitleId = useId();\n// A caller-supplied `id` labels the title element (for `aria-labelledby`) instead of the\n// root, since the root itself has no reason to be addressed by id.\nconst resolvedTitleId = computed(() => (typeof attrs.id === \"string\" ? attrs.id : generatedTitleId));\nconst rootAttrs = computed(() => {\n  const rest = { ...attrs };\n  delete rest.id;\n  return rest;\n});\n\nconst panel = useTemplateRef(\"panel\");\nlet previouslyFocused: HTMLElement | null = null;\n\n// The surface is stateless: it never hides itself. Every dismissal path (close button,\n// Escape, outside click) just emits `close`, and the parent decides whether to unmount it.\nconst close = () => emit(\"close\");\n\nonClickOutside(panel, close);\nonKeyStroke(\"Escape\", close);\n\nonMounted(() => {\n  previouslyFocused = document.activeElement as HTMLElement | null;\n  panel.value?.focus();\n});\n\nonUnmounted(() => {\n  previouslyFocused?.focus();\n});\n</script>\n\n<template>\n  <div\n    ref=\"panel\"\n    v-bind=\"rootAttrs\"\n    :class=\"surfaceClass\"\n    :open=\"variant === 'drawer' ? true : undefined\"\n    style=\"display: flex; flex-direction: column\"\n    :role=\"variant === 'drawer' ? 'dialog' : undefined\"\n    :aria-modal=\"variant === 'drawer' ? 'true' : undefined\"\n    :aria-labelledby=\"resolvedTitleId\"\n    data-testid=\"pv-context-surface\"\n    tabindex=\"-1\"\n  >\n    <div class=\"pv-inset-square pv-border-bottom\" style=\"flex-shrink: 0\">\n      <div class=\"pv-flex pv-stack-8\" style=\"--flex-justify: space-between\">\n        <div class=\"pv-flex\" style=\"--flex-gap: 4px\">\n          <PvButton v-if=\"showBack\" left-icon=\"chevron-left\" aria-label=\"Back\" variant=\"ghost\" @click=\"emit('back')\" />\n          <PvTag v-if=\"contextType\" :label=\"contextType\" tabindex=\"-1\" style=\"pointer-events: none; cursor: default\" />\n        </div>\n        <PvButton v-if=\"!disableClose\" left-icon=\"close\" aria-label=\"Close\" variant=\"ghost\" @click=\"close\" />\n      </div>\n      <slot name=\"title\">\n        <div v-if=\"usesCompanyLogo\" class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 8px\">\n          <PvCompanyLogo :name=\"header\" />\n          <h2 :id=\"resolvedTitleId\" class=\"pv-heading-2\">{{ header }}</h2>\n        </div>\n        <h2 v-else :id=\"resolvedTitleId\" class=\"pv-heading-2\">{{ header }}</h2>\n      </slot>\n    </div>\n    <div\n      class=\"pv-inset-square\"\n      :class=\"{ 'pv-border-bottom': $slots.footer }\"\n      style=\"flex: 1 1 auto; overflow-y: auto; min-height: 0\"\n    >\n      <slot />\n    </div>\n    <div v-if=\"$slots.footer\" style=\"flex-shrink: 0\">\n      <slot name=\"footer\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide, useId, useTemplateRef, onMounted, onUnmounted, useAttrs } from \"vue\";\nimport { onKeyStroke, onClickOutside } from \"@vueuse/core\";\nimport type { ShowContextPayload } from \"../config.ts\";\nimport { PvContextSurfaceKey } from \"../config.ts\";\nimport PvTag from \"../../PvTag/PvTag.vue\";\nimport PvButton from \"../../PvButton/PvButton.vue\";\nimport PvCompanyLogo from \"../../PvCompanyLogo/PvCompanyLogo.vue\";\n\ninterface PvContextSurfaceProps {\n  /** Controls the outer surface: `pv-card` or `pv-drawer pv-surface`. */\n  variant: \"card\" | \"drawer\";\n  /** Tag shown in the header row. Omit to hide the tag. Payer/Provider (case-insensitive) also swap in PvCompanyLogo next to the default title. */\n  contextType?: string;\n  /** Used by the default title when the `title` slot isn't provided. */\n  header: string;\n  /** Hides the close button. */\n  disableClose?: boolean;\n  /** Shows a back arrow in the header row, for callers that support drilling back up a navigation stack. */\n  showBack?: boolean;\n}\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps<PvContextSurfaceProps>();\n\nconst emit = defineEmits<{\n  (e: \"close\"): void;\n  (e: \"back\"): void;\n  (e: \"show-context\", payload: ShowContextPayload): void;\n}>();\n\nprovide(PvContextSurfaceKey, {\n  showContext: (payload) => emit(\"show-context\", payload),\n});\n\nconst surfaceClass = computed(() =>\n  props.variant === \"card\" ? \"pv-card pv-context-surface\" : \"pv-drawer pv-surface pv-context-surface\",\n);\n\nconst usesCompanyLogo = computed(() => {\n  const contextType = props.contextType?.toLowerCase();\n  return contextType === \"payer\" || contextType === \"provider\";\n});\n\nconst attrs = useAttrs();\nconst generatedTitleId = useId();\n// A caller-supplied `id` labels the title element (for `aria-labelledby`) instead of the\n// root, since the root itself has no reason to be addressed by id.\nconst resolvedTitleId = computed(() => (typeof attrs.id === \"string\" ? attrs.id : generatedTitleId));\nconst rootAttrs = computed(() => {\n  const rest = { ...attrs };\n  delete rest.id;\n  return rest;\n});\n\nconst panel = useTemplateRef(\"panel\");\nlet previouslyFocused: HTMLElement | null = null;\n\n// The surface is stateless: it never hides itself. Every dismissal path (close button,\n// Escape, outside click) just emits `close`, and the parent decides whether to unmount it.\nconst close = () => emit(\"close\");\n\nonClickOutside(panel, close);\nonKeyStroke(\"Escape\", close);\n\nonMounted(() => {\n  previouslyFocused = document.activeElement as HTMLElement | null;\n  panel.value?.focus();\n});\n\nonUnmounted(() => {\n  previouslyFocused?.focus();\n});\n</script>\n\n<template>\n  <div\n    ref=\"panel\"\n    v-bind=\"rootAttrs\"\n    :class=\"surfaceClass\"\n    :open=\"variant === 'drawer' ? true : undefined\"\n    style=\"display: flex; flex-direction: column\"\n    :role=\"variant === 'drawer' ? 'dialog' : undefined\"\n    :aria-modal=\"variant === 'drawer' ? 'true' : undefined\"\n    :aria-labelledby=\"resolvedTitleId\"\n    data-testid=\"pv-context-surface\"\n    tabindex=\"-1\"\n  >\n    <div class=\"pv-inset-square pv-border-bottom\" style=\"flex-shrink: 0\">\n      <div class=\"pv-flex pv-stack-8\" style=\"--flex-justify: space-between\">\n        <div class=\"pv-flex\" style=\"--flex-gap: 4px\">\n          <PvButton v-if=\"showBack\" left-icon=\"chevron-left\" aria-label=\"Back\" variant=\"ghost\" @click=\"emit('back')\" />\n          <PvTag v-if=\"contextType\" :label=\"contextType\" tabindex=\"-1\" style=\"pointer-events: none; cursor: default\" />\n        </div>\n        <PvButton v-if=\"!disableClose\" left-icon=\"close\" aria-label=\"Close\" variant=\"ghost\" @click=\"close\" />\n      </div>\n      <slot name=\"title\">\n        <div v-if=\"usesCompanyLogo\" class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 8px\">\n          <PvCompanyLogo :name=\"header\" />\n          <h2 :id=\"resolvedTitleId\" class=\"pv-heading-2\">{{ header }}</h2>\n        </div>\n        <h2 v-else :id=\"resolvedTitleId\" class=\"pv-heading-2\">{{ header }}</h2>\n      </slot>\n    </div>\n    <div\n      class=\"pv-inset-square\"\n      :class=\"{ 'pv-border-bottom': $slots.footer }\"\n      style=\"flex: 1 1 auto; overflow-y: auto; min-height: 0\"\n    >\n      <slot />\n    </div>\n    <div v-if=\"$slots.footer\" style=\"flex-shrink: 0\">\n      <slot name=\"footer\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, inject } from \"vue\";\nimport type { ShowContextPayload, ContextEntityField, ContextEntityFieldValue } from \"../config.ts\";\nimport { PvContextSurfaceKey } from \"../config.ts\";\nimport PvTag from \"../../PvTag/PvTag.vue\";\nimport PvTooltipV2 from \"../../PvTooltipV2/PvTooltipV2.vue\";\n\ninterface PvSpinesEntityFieldsProps {\n  /** The label/value rows to render. */\n  entityFields: ContextEntityField[];\n}\n\nconst props = defineProps<PvSpinesEntityFieldsProps>();\n\nconst emit = defineEmits<{\n  /** Fired only when rendered outside a PvContextSurface. Inside one, the surface emits `show-context` instead. */\n  (e: \"show-context\", payload: ShowContextPayload): void;\n}>();\n\nconst surface = inject(PvContextSurfaceKey, null);\n\nconst MAX_VALUES = 4;\n\nconst rows = computed(() =>\n  props.entityFields.map((field) => {\n    const values = Array.isArray(field.value) ? field.value : [field.value];\n    const hasOverflow = values.length > MAX_VALUES;\n\n    return {\n      label: field.label,\n      values,\n      visibleValues: hasOverflow ? values.slice(0, MAX_VALUES) : values,\n      hiddenValues: hasOverflow ? values.slice(MAX_VALUES) : [],\n    };\n  }),\n);\n\nconst onValueClick = (value: ContextEntityFieldValue) => {\n  if (!value.isClickable || !value.contextIdentifier) return;\n\n  // Exactly one path fires: hand the request to the enclosing surface when there is one,\n  // otherwise it is this component's own event.\n  const payload: ShowContextPayload = { contextIdentifier: value.contextIdentifier };\n  if (surface) surface.showContext(payload);\n  else emit(\"show-context\", payload);\n};\n\nconst onValueKeydown = (event: KeyboardEvent, value: ContextEntityFieldValue) => {\n  if (event.key !== \"Enter\" && event.key !== \" \") return;\n  event.preventDefault();\n  onValueClick(value);\n};\n</script>\n\n<template>\n  <div v-for=\"row in rows\" :key=\"row.label\" class=\"pv-flex pv-text-body-md\" style=\"padding: 0.25rem\">\n    <span class=\"pv-text-subdued pv-flex-item\">{{ row.label }}</span>\n    <span class=\"pv-flex-item\" style=\"font-weight: 500\">\n      <template v-for=\"(value, index) in row.visibleValues\" :key=\"index\">\n        <span\n          :class=\"{ 'pv-underline-dotted': value.isClickable }\"\n          :style=\"{ cursor: value.isClickable ? 'pointer' : undefined }\"\n          :role=\"value.isClickable ? 'button' : undefined\"\n          :tabindex=\"value.isClickable ? 0 : undefined\"\n          @click=\"onValueClick(value)\"\n          @keydown=\"onValueKeydown($event, value)\"\n          >{{ value.name }}</span\n        ><template v-if=\"index < row.visibleValues.length - 1\">, </template>\n      </template>\n      <!-- useTeleport: escapes the internal-scroll clip of the surface this renders inside. -->\n      <PvTooltipV2 v-if=\"row.hiddenValues.length\" position=\"top-left\" variant=\"white\" :useTeleport=\"true\">\n        <template #trigger>\n          <PvTag :label=\"`+${row.hiddenValues.length} more`\" size=\"sm\" />\n        </template>\n        <template #content>\n          <div\n            v-for=\"(value, index) in row.hiddenValues\"\n            :key=\"index\"\n            :class=\"['pv-text-body-md', { 'pv-underline-dotted': value.isClickable }]\"\n            :style=\"{ cursor: value.isClickable ? 'pointer' : undefined, fontWeight: 500, padding: '4px 0' }\"\n            :role=\"value.isClickable ? 'button' : undefined\"\n            :tabindex=\"value.isClickable ? 0 : undefined\"\n            @click=\"onValueClick(value)\"\n            @keydown=\"onValueKeydown($event, value)\"\n          >\n            {{ value.name }}\n          </div>\n        </template>\n      </PvTooltipV2>\n    </span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, inject } from \"vue\";\nimport type { ShowContextPayload, ContextEntityField, ContextEntityFieldValue } from \"../config.ts\";\nimport { PvContextSurfaceKey } from \"../config.ts\";\nimport PvTag from \"../../PvTag/PvTag.vue\";\nimport PvTooltipV2 from \"../../PvTooltipV2/PvTooltipV2.vue\";\n\ninterface PvSpinesEntityFieldsProps {\n  /** The label/value rows to render. */\n  entityFields: ContextEntityField[];\n}\n\nconst props = defineProps<PvSpinesEntityFieldsProps>();\n\nconst emit = defineEmits<{\n  /** Fired only when rendered outside a PvContextSurface. Inside one, the surface emits `show-context` instead. */\n  (e: \"show-context\", payload: ShowContextPayload): void;\n}>();\n\nconst surface = inject(PvContextSurfaceKey, null);\n\nconst MAX_VALUES = 4;\n\nconst rows = computed(() =>\n  props.entityFields.map((field) => {\n    const values = Array.isArray(field.value) ? field.value : [field.value];\n    const hasOverflow = values.length > MAX_VALUES;\n\n    return {\n      label: field.label,\n      values,\n      visibleValues: hasOverflow ? values.slice(0, MAX_VALUES) : values,\n      hiddenValues: hasOverflow ? values.slice(MAX_VALUES) : [],\n    };\n  }),\n);\n\nconst onValueClick = (value: ContextEntityFieldValue) => {\n  if (!value.isClickable || !value.contextIdentifier) return;\n\n  // Exactly one path fires: hand the request to the enclosing surface when there is one,\n  // otherwise it is this component's own event.\n  const payload: ShowContextPayload = { contextIdentifier: value.contextIdentifier };\n  if (surface) surface.showContext(payload);\n  else emit(\"show-context\", payload);\n};\n\nconst onValueKeydown = (event: KeyboardEvent, value: ContextEntityFieldValue) => {\n  if (event.key !== \"Enter\" && event.key !== \" \") return;\n  event.preventDefault();\n  onValueClick(value);\n};\n</script>\n\n<template>\n  <div v-for=\"row in rows\" :key=\"row.label\" class=\"pv-flex pv-text-body-md\" style=\"padding: 0.25rem\">\n    <span class=\"pv-text-subdued pv-flex-item\">{{ row.label }}</span>\n    <span class=\"pv-flex-item\" style=\"font-weight: 500\">\n      <template v-for=\"(value, index) in row.visibleValues\" :key=\"index\">\n        <span\n          :class=\"{ 'pv-underline-dotted': value.isClickable }\"\n          :style=\"{ cursor: value.isClickable ? 'pointer' : undefined }\"\n          :role=\"value.isClickable ? 'button' : undefined\"\n          :tabindex=\"value.isClickable ? 0 : undefined\"\n          @click=\"onValueClick(value)\"\n          @keydown=\"onValueKeydown($event, value)\"\n          >{{ value.name }}</span\n        ><template v-if=\"index < row.visibleValues.length - 1\">, </template>\n      </template>\n      <!-- useTeleport: escapes the internal-scroll clip of the surface this renders inside. -->\n      <PvTooltipV2 v-if=\"row.hiddenValues.length\" position=\"top-left\" variant=\"white\" :useTeleport=\"true\">\n        <template #trigger>\n          <PvTag :label=\"`+${row.hiddenValues.length} more`\" size=\"sm\" />\n        </template>\n        <template #content>\n          <div\n            v-for=\"(value, index) in row.hiddenValues\"\n            :key=\"index\"\n            :class=\"['pv-text-body-md', { 'pv-underline-dotted': value.isClickable }]\"\n            :style=\"{ cursor: value.isClickable ? 'pointer' : undefined, fontWeight: 500, padding: '4px 0' }\"\n            :role=\"value.isClickable ? 'button' : undefined\"\n            :tabindex=\"value.isClickable ? 0 : undefined\"\n            @click=\"onValueClick(value)\"\n            @keydown=\"onValueKeydown($event, value)\"\n          >\n            {{ value.name }}\n          </div>\n        </template>\n      </PvTooltipV2>\n    </span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvTextAreaVariant } from \"./types\";\n\ninterface PvTextareaProps {\n  /** When true, applies invalid/error styling to the textarea and lower label. */\n  error?: boolean;\n  /** When true, the textarea is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Placeholder text shown when the textarea is empty. */\n  placeholder?: string;\n  /** HTML id for the textarea element. Auto-generated when omitted. */\n  id?: string;\n  /** Helper or validation text displayed below the textarea. Turns red when error is true. */\n  lowerLabel?: string;\n  /**\n   * Background color variant of the textarea.\n   */\n  variant?: PvTextAreaVariant;\n  /**\n   * Number of visible text rows.\n   */\n  rows?: number;\n}\n\nwithDefaults(defineProps<PvTextareaProps>(), {\n  id: Math.random().toString(),\n  variant: \"white\",\n  rows: 4,\n});\n\nconst value = defineModel<string>();\n</script>\n\n<template>\n  <div class=\"pv-flex-vertical\" style=\"--flex-align: flex-start\">\n    <label v-if=\"$slots.label\" class=\"pv-label\" :for=\"id\">\n      <slot name=\"label\" />\n    </label>\n    <textarea\n      v-bind=\"$attrs\"\n      v-model=\"value\"\n      :class=\"[\n        'pv-textarea',\n        {\n          'pv-surface-accent': variant === 'grey',\n        },\n      ]\"\n      :rows=\"rows\"\n      :disabled=\"disabled\"\n      :placeholder=\"placeholder\"\n      :id=\"id\"\n      :data-invalid=\"error ? true : undefined\"\n    />\n    <p\n      v-if=\"lowerLabel\"\n      style=\"margin-left: 12px\"\n      :class=\"[\n        'pv-text-body-xs',\n        {\n          'pv-text-red': error,\n          'pv-text-subdued': !error,\n        },\n      ]\"\n    >\n      {{ lowerLabel }}\n    </p>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvTextAreaVariant } from \"./types\";\n\ninterface PvTextareaProps {\n  /** When true, applies invalid/error styling to the textarea and lower label. */\n  error?: boolean;\n  /** When true, the textarea is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Placeholder text shown when the textarea is empty. */\n  placeholder?: string;\n  /** HTML id for the textarea element. Auto-generated when omitted. */\n  id?: string;\n  /** Helper or validation text displayed below the textarea. Turns red when error is true. */\n  lowerLabel?: string;\n  /**\n   * Background color variant of the textarea.\n   */\n  variant?: PvTextAreaVariant;\n  /**\n   * Number of visible text rows.\n   */\n  rows?: number;\n}\n\nwithDefaults(defineProps<PvTextareaProps>(), {\n  id: Math.random().toString(),\n  variant: \"white\",\n  rows: 4,\n});\n\nconst value = defineModel<string>();\n</script>\n\n<template>\n  <div class=\"pv-flex-vertical\" style=\"--flex-align: flex-start\">\n    <label v-if=\"$slots.label\" class=\"pv-label\" :for=\"id\">\n      <slot name=\"label\" />\n    </label>\n    <textarea\n      v-bind=\"$attrs\"\n      v-model=\"value\"\n      :class=\"[\n        'pv-textarea',\n        {\n          'pv-surface-accent': variant === 'grey',\n        },\n      ]\"\n      :rows=\"rows\"\n      :disabled=\"disabled\"\n      :placeholder=\"placeholder\"\n      :id=\"id\"\n      :data-invalid=\"error ? true : undefined\"\n    />\n    <p\n      v-if=\"lowerLabel\"\n      style=\"margin-left: 12px\"\n      :class=\"[\n        'pv-text-body-xs',\n        {\n          'pv-text-red': error,\n          'pv-text-subdued': !error,\n        },\n      ]\"\n    >\n      {{ lowerLabel }}\n    </p>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\n\nimport { PvCounterBadgeVariant } from \"../PvCounterBadge/types\";\nimport { PvToggleButtonSize, PvToggleButtonVariant } from \"./types\";\n\ninterface PvToggleButton {\n  /**\n   * The visual size of the toggle button.\n   */\n  size?: PvToggleButtonSize;\n  /**\n   * The visual style variant.\n   */\n  variant?: PvToggleButtonVariant;\n  /** When true, applies fully rounded (pill) corners. */\n  rounded?: boolean;\n  /** When true, the toggle button is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** The value emitted when this toggle is selected (used with radio-style groups). */\n  value?: string;\n  /** Visible text label displayed inside the toggle. */\n  label?: string;\n  /** Icon name displayed to the left of the label. */\n  leftIcon?: string;\n  /** Icon name displayed to the right of the label. */\n  rightIcon?: string;\n  /** HTML id for the underlying input element. Auto-generated from label when omitted. */\n  id?: string;\n  /** HTML name attribute, used to group radio-style toggles. */\n  name?: string;\n  /**\n   * When true, renders as a checkbox (can be deselected). When false, renders as a radio (stays selected).\n   */\n  deselect?: boolean;\n  /** Optional counter on the right side of the button */\n  rightCounterBadge?: number;\n}\n\nconst props = withDefaults(defineProps<PvToggleButton>(), {\n  variant: \"secondary\",\n  deselect: true,\n  size: \"xl\",\n});\n\nconst modelValue = defineModel<boolean | string>();\n\nconst counterBadgeInactiveVariant: Record<PvToggleButtonVariant, PvCounterBadgeVariant> = {\n  secondary: \"tertiary\",\n  tertiary: \"tertiary\",\n  ghost: \"ghost\",\n};\n\nconst counterBadgeActiveVariant: Record<PvToggleButtonVariant, PvCounterBadgeVariant> = {\n  secondary: \"primary\",\n  tertiary: \"primary\",\n  ghost: \"primary\",\n};\n\nconst counterBadgeVariant = computed(() => {\n  return modelValue.value ? counterBadgeActiveVariant[props.variant] : counterBadgeInactiveVariant[props.variant];\n});\n\nconst classes = computed(() => {\n  const variantSuffix = props.variant == \"secondary\" ? \"\" : \"-\" + props.variant;\n  return {\n    [`pv-toggle${variantSuffix}`]: true,\n    \"pv-toggle-round\": props.rounded,\n    \"pv-toggle-small\": props.size === \"lg\",\n  };\n});\n\nconst labelId = computed(() => {\n  if (props.id) {\n    return props.id;\n  }\n\n  return `${props.label}-${Math.random()}`;\n});\n</script>\n\n<template>\n  <label data-testid=\"pv-toggle-button\" :class=\"classes\" :for=\"labelId\">\n    <input\n      v-model=\"modelValue\"\n      class=\"pv-hide\"\n      :id=\"labelId\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :name=\"name\"\n      :disabled=\"disabled\"\n    />\n    <PvIcon v-if=\"leftIcon\" :name=\"leftIcon\" />\n    <span v-if=\"label\">{{ label }}</span>\n    <PvIcon v-if=\"rightIcon\" :name=\"rightIcon\" />\n    <PvCounterBadge v-if=\"rightCounterBadge\" :value=\"rightCounterBadge\" :variant=\"counterBadgeVariant\" />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\n\nimport { PvCounterBadgeVariant } from \"../PvCounterBadge/types\";\nimport { PvToggleButtonSize, PvToggleButtonVariant } from \"./types\";\n\ninterface PvToggleButton {\n  /**\n   * The visual size of the toggle button.\n   */\n  size?: PvToggleButtonSize;\n  /**\n   * The visual style variant.\n   */\n  variant?: PvToggleButtonVariant;\n  /** When true, applies fully rounded (pill) corners. */\n  rounded?: boolean;\n  /** When true, the toggle button is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** The value emitted when this toggle is selected (used with radio-style groups). */\n  value?: string;\n  /** Visible text label displayed inside the toggle. */\n  label?: string;\n  /** Icon name displayed to the left of the label. */\n  leftIcon?: string;\n  /** Icon name displayed to the right of the label. */\n  rightIcon?: string;\n  /** HTML id for the underlying input element. Auto-generated from label when omitted. */\n  id?: string;\n  /** HTML name attribute, used to group radio-style toggles. */\n  name?: string;\n  /**\n   * When true, renders as a checkbox (can be deselected). When false, renders as a radio (stays selected).\n   */\n  deselect?: boolean;\n  /** Optional counter on the right side of the button */\n  rightCounterBadge?: number;\n}\n\nconst props = withDefaults(defineProps<PvToggleButton>(), {\n  variant: \"secondary\",\n  deselect: true,\n  size: \"xl\",\n});\n\nconst modelValue = defineModel<boolean | string>();\n\nconst counterBadgeInactiveVariant: Record<PvToggleButtonVariant, PvCounterBadgeVariant> = {\n  secondary: \"tertiary\",\n  tertiary: \"tertiary\",\n  ghost: \"ghost\",\n};\n\nconst counterBadgeActiveVariant: Record<PvToggleButtonVariant, PvCounterBadgeVariant> = {\n  secondary: \"primary\",\n  tertiary: \"primary\",\n  ghost: \"primary\",\n};\n\nconst counterBadgeVariant = computed(() => {\n  return modelValue.value ? counterBadgeActiveVariant[props.variant] : counterBadgeInactiveVariant[props.variant];\n});\n\nconst classes = computed(() => {\n  const variantSuffix = props.variant == \"secondary\" ? \"\" : \"-\" + props.variant;\n  return {\n    [`pv-toggle${variantSuffix}`]: true,\n    \"pv-toggle-round\": props.rounded,\n    \"pv-toggle-small\": props.size === \"lg\",\n  };\n});\n\nconst labelId = computed(() => {\n  if (props.id) {\n    return props.id;\n  }\n\n  return `${props.label}-${Math.random()}`;\n});\n</script>\n\n<template>\n  <label data-testid=\"pv-toggle-button\" :class=\"classes\" :for=\"labelId\">\n    <input\n      v-model=\"modelValue\"\n      class=\"pv-hide\"\n      :id=\"labelId\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :name=\"name\"\n      :disabled=\"disabled\"\n    />\n    <PvIcon v-if=\"leftIcon\" :name=\"leftIcon\" />\n    <span v-if=\"label\">{{ label }}</span>\n    <PvIcon v-if=\"rightIcon\" :name=\"rightIcon\" />\n    <PvCounterBadge v-if=\"rightCounterBadge\" :value=\"rightCounterBadge\" :variant=\"counterBadgeVariant\" />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport type { PvToastVariants } from \"./types\";\n\ninterface PvToastProps {\n  /** Visual style variant determining color scheme and default icon */\n  variant?: PvToastVariants;\n  /** Custom icon name; overrides the default variant icon */\n  icon?: string;\n  /** Text message displayed in the toast */\n  label: string;\n  /** Shows a spinner in place of the variant/custom icon, for a toast representing an\n   * in-progress action rather than a completed one */\n  loading?: boolean;\n}\n\nconst mapVariantToClass: Record<PvToastVariants, string> = {\n  info: \"pv-toast-info\",\n  success: \"pv-toast-success\",\n  error: \"pv-toast-error\",\n  warning: \"pv-toast-warning\",\n  dark: \"pv-toast-dark\",\n};\n\nconst mapVariantToIcon: Record<PvToastVariants, string> = {\n  info: \"check-circle\",\n  success: \"check-circle\",\n  error: \"alert-circle\",\n  warning: \"triangle-alert\",\n  dark: \"ai\",\n};\n\nwithDefaults(defineProps<PvToastProps>(), {\n  variant: \"info\",\n  loading: false,\n});\n\ndefineEmits<{\n  (e: \"handle-close\"): void;\n}>();\n</script>\n\n<template>\n  <div :class=\"mapVariantToClass[variant]\">\n    <PvSpinner v-if=\"loading\" size=\"sm\" />\n    <PvIcon v-else :name=\"icon ? icon : mapVariantToIcon[variant]\" :size=\"20\" />\n    <div class=\"pv-flex-item\">\n      <slot name=\"header\" />\n      <p class=\"pv-text-body-md\">\n        {{ label }}\n      </p>\n    </div>\n    <slot />\n    <PvButton\n      variant=\"ghost\"\n      :inverse=\"variant === 'dark'\"\n      size=\"lg\"\n      left-icon=\"close\"\n      ariaLabel=\"Close\"\n      @click=\"$emit('handle-close')\"\n    />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvSpinner from \"../PvSpinner/PvSpinner.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport type { PvToastVariants } from \"./types\";\n\ninterface PvToastProps {\n  /** Visual style variant determining color scheme and default icon */\n  variant?: PvToastVariants;\n  /** Custom icon name; overrides the default variant icon */\n  icon?: string;\n  /** Text message displayed in the toast */\n  label: string;\n  /** Shows a spinner in place of the variant/custom icon, for a toast representing an\n   * in-progress action rather than a completed one */\n  loading?: boolean;\n}\n\nconst mapVariantToClass: Record<PvToastVariants, string> = {\n  info: \"pv-toast-info\",\n  success: \"pv-toast-success\",\n  error: \"pv-toast-error\",\n  warning: \"pv-toast-warning\",\n  dark: \"pv-toast-dark\",\n};\n\nconst mapVariantToIcon: Record<PvToastVariants, string> = {\n  info: \"check-circle\",\n  success: \"check-circle\",\n  error: \"alert-circle\",\n  warning: \"triangle-alert\",\n  dark: \"ai\",\n};\n\nwithDefaults(defineProps<PvToastProps>(), {\n  variant: \"info\",\n  loading: false,\n});\n\ndefineEmits<{\n  (e: \"handle-close\"): void;\n}>();\n</script>\n\n<template>\n  <div :class=\"mapVariantToClass[variant]\">\n    <PvSpinner v-if=\"loading\" size=\"sm\" />\n    <PvIcon v-else :name=\"icon ? icon : mapVariantToIcon[variant]\" :size=\"20\" />\n    <div class=\"pv-flex-item\">\n      <slot name=\"header\" />\n      <p class=\"pv-text-body-md\">\n        {{ label }}\n      </p>\n    </div>\n    <slot />\n    <PvButton\n      variant=\"ghost\"\n      :inverse=\"variant === 'dark'\"\n      size=\"lg\"\n      left-icon=\"close\"\n      ariaLabel=\"Close\"\n      @click=\"$emit('handle-close')\"\n    />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref } from \"vue\";\nimport PvButton from \"../../PvButton/PvButton.vue\";\nimport PvTextArea from \"../../PvTextArea/PvTextArea.vue\";\nimport PvToggleButton from \"../../PvToggleButton/PvToggleButton.vue\";\nimport PvToast from \"../../PvToast/PvToast.vue\";\nimport type { ContextEntityField, ContextFeedbackPayload } from \"../config.ts\";\n\ninterface PvContextFeedbackProps {\n  /** The field labels to offer for feedback selection. */\n  fields?: ContextEntityField[];\n  /**\n   * Handles the submitted feedback. Resolve `true` when the feedback was\n   * accepted (the form resets and a success toast appears) or `false` when it\n   * failed (an error toast appears and the form stays open so the user can\n   * retry). The submit button shows a spinner while the returned promise is\n   * pending.\n   */\n  onSubmitFeedback?: (payload: ContextFeedbackPayload) => Promise<boolean>;\n  /** Toast message shown after feedback is accepted. */\n  successMessage?: string;\n  /** Toast message shown when feedback submission fails. */\n  errorMessage?: string;\n}\n\nconst props = withDefaults(defineProps<PvContextFeedbackProps>(), {\n  successMessage: \"Thanks! Your feedback was submitted.\",\n  errorMessage: \"Something went wrong. Please try again.\",\n});\n\nconst showFeedback = ref(false);\nconst selectedFields = ref<string[]>([]);\nconst comment = ref(\"\");\nconst submitting = ref(false);\nconst toast = ref<{ variant: \"success\" | \"error\"; message: string } | null>(null);\n\nconst fieldLabels = computed(() => props.fields?.map((field) => field.label) ?? []);\nconst canSubmit = computed(() => selectedFields.value.length > 0);\n\nconst openFeedback = () => {\n  showFeedback.value = true;\n};\n\nconst resetFeedback = () => {\n  showFeedback.value = false;\n  selectedFields.value = [];\n  comment.value = \"\";\n};\n\nconst submitFeedback = async () => {\n  if (submitting.value) return;\n\n  const payload: ContextFeedbackPayload = {\n    fields: [...selectedFields.value],\n    comment: comment.value,\n  };\n\n  if (!props.onSubmitFeedback) {\n    resetFeedback();\n    toast.value = { variant: \"success\", message: props.successMessage };\n    return;\n  }\n\n  submitting.value = true;\n  try {\n    const succeeded = await props.onSubmitFeedback(payload);\n    if (succeeded) {\n      resetFeedback();\n      toast.value = { variant: \"success\", message: props.successMessage };\n    } else {\n      toast.value = { variant: \"error\", message: props.errorMessage };\n    }\n  } finally {\n    submitting.value = false;\n  }\n};\n\nconst toggleField = (label: string, selected: boolean) => {\n  if (selected) {\n    if (!selectedFields.value.includes(label)) {\n      selectedFields.value = [...selectedFields.value, label];\n    }\n  } else {\n    selectedFields.value = selectedFields.value.filter((f) => f !== label);\n  }\n};\n</script>\n\n<template>\n  <div class=\"pv-inset-square\" style=\"flex-shrink: 0\">\n    <PvToast\n      v-if=\"toast\"\n      class=\"pv-stack\"\n      :variant=\"toast.variant\"\n      :label=\"toast.message\"\n      @handle-close=\"toast = null\"\n    />\n    <div v-if=\"!showFeedback\" class=\"pv-flex pv-space-between\">\n      <span class=\"pv-text-body-md pv-text-subdued\">Something look off?</span>\n      <PvButton label=\"Give Feedback\" variant=\"ghost\" size=\"md\" @click=\"openFeedback\" />\n    </div>\n    <div v-else>\n      <h4 class=\"pv-heading-4 pv-stack\">Select fields for feedback.</h4>\n      <div class=\"pv-flex pv-stack\" style=\"--flex-gap: 4px; flex-wrap: wrap\">\n        <PvToggleButton\n          v-for=\"label in fieldLabels\"\n          :key=\"label\"\n          :label=\"label\"\n          :model-value=\"selectedFields.includes(label)\"\n          style=\"width: fit-content\"\n          size=\"lg\"\n          rounded\n          @update:model-value=\"toggleField(label, $event as boolean)\"\n        />\n      </div>\n      <div class=\"pv-stack\">\n        <PvTextArea v-model=\"comment\" placeholder=\"(Optional) Add a comment\" />\n      </div>\n      <div class=\"pv-flex pv-space-between\">\n        <PvButton variant=\"ghost\" label=\"Cancel\" size=\"md\" :disabled=\"submitting\" @click=\"resetFeedback\" />\n        <PvButton\n          variant=\"primary\"\n          label=\"Submit Feedback\"\n          size=\"md\"\n          :disabled=\"!canSubmit || submitting\"\n          :loading=\"submitting\"\n          @click=\"submitFeedback\"\n        />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref } from \"vue\";\nimport PvButton from \"../../PvButton/PvButton.vue\";\nimport PvTextArea from \"../../PvTextArea/PvTextArea.vue\";\nimport PvToggleButton from \"../../PvToggleButton/PvToggleButton.vue\";\nimport PvToast from \"../../PvToast/PvToast.vue\";\nimport type { ContextEntityField, ContextFeedbackPayload } from \"../config.ts\";\n\ninterface PvContextFeedbackProps {\n  /** The field labels to offer for feedback selection. */\n  fields?: ContextEntityField[];\n  /**\n   * Handles the submitted feedback. Resolve `true` when the feedback was\n   * accepted (the form resets and a success toast appears) or `false` when it\n   * failed (an error toast appears and the form stays open so the user can\n   * retry). The submit button shows a spinner while the returned promise is\n   * pending.\n   */\n  onSubmitFeedback?: (payload: ContextFeedbackPayload) => Promise<boolean>;\n  /** Toast message shown after feedback is accepted. */\n  successMessage?: string;\n  /** Toast message shown when feedback submission fails. */\n  errorMessage?: string;\n}\n\nconst props = withDefaults(defineProps<PvContextFeedbackProps>(), {\n  successMessage: \"Thanks! Your feedback was submitted.\",\n  errorMessage: \"Something went wrong. Please try again.\",\n});\n\nconst showFeedback = ref(false);\nconst selectedFields = ref<string[]>([]);\nconst comment = ref(\"\");\nconst submitting = ref(false);\nconst toast = ref<{ variant: \"success\" | \"error\"; message: string } | null>(null);\n\nconst fieldLabels = computed(() => props.fields?.map((field) => field.label) ?? []);\nconst canSubmit = computed(() => selectedFields.value.length > 0);\n\nconst openFeedback = () => {\n  showFeedback.value = true;\n};\n\nconst resetFeedback = () => {\n  showFeedback.value = false;\n  selectedFields.value = [];\n  comment.value = \"\";\n};\n\nconst submitFeedback = async () => {\n  if (submitting.value) return;\n\n  const payload: ContextFeedbackPayload = {\n    fields: [...selectedFields.value],\n    comment: comment.value,\n  };\n\n  if (!props.onSubmitFeedback) {\n    resetFeedback();\n    toast.value = { variant: \"success\", message: props.successMessage };\n    return;\n  }\n\n  submitting.value = true;\n  try {\n    const succeeded = await props.onSubmitFeedback(payload);\n    if (succeeded) {\n      resetFeedback();\n      toast.value = { variant: \"success\", message: props.successMessage };\n    } else {\n      toast.value = { variant: \"error\", message: props.errorMessage };\n    }\n  } finally {\n    submitting.value = false;\n  }\n};\n\nconst toggleField = (label: string, selected: boolean) => {\n  if (selected) {\n    if (!selectedFields.value.includes(label)) {\n      selectedFields.value = [...selectedFields.value, label];\n    }\n  } else {\n    selectedFields.value = selectedFields.value.filter((f) => f !== label);\n  }\n};\n</script>\n\n<template>\n  <div class=\"pv-inset-square\" style=\"flex-shrink: 0\">\n    <PvToast\n      v-if=\"toast\"\n      class=\"pv-stack\"\n      :variant=\"toast.variant\"\n      :label=\"toast.message\"\n      @handle-close=\"toast = null\"\n    />\n    <div v-if=\"!showFeedback\" class=\"pv-flex pv-space-between\">\n      <span class=\"pv-text-body-md pv-text-subdued\">Something look off?</span>\n      <PvButton label=\"Give Feedback\" variant=\"ghost\" size=\"md\" @click=\"openFeedback\" />\n    </div>\n    <div v-else>\n      <h4 class=\"pv-heading-4 pv-stack\">Select fields for feedback.</h4>\n      <div class=\"pv-flex pv-stack\" style=\"--flex-gap: 4px; flex-wrap: wrap\">\n        <PvToggleButton\n          v-for=\"label in fieldLabels\"\n          :key=\"label\"\n          :label=\"label\"\n          :model-value=\"selectedFields.includes(label)\"\n          style=\"width: fit-content\"\n          size=\"lg\"\n          rounded\n          @update:model-value=\"toggleField(label, $event as boolean)\"\n        />\n      </div>\n      <div class=\"pv-stack\">\n        <PvTextArea v-model=\"comment\" placeholder=\"(Optional) Add a comment\" />\n      </div>\n      <div class=\"pv-flex pv-space-between\">\n        <PvButton variant=\"ghost\" label=\"Cancel\" size=\"md\" :disabled=\"submitting\" @click=\"resetFeedback\" />\n        <PvButton\n          variant=\"primary\"\n          label=\"Submit Feedback\"\n          size=\"md\"\n          :disabled=\"!canSubmit || submitting\"\n          :loading=\"submitting\"\n          @click=\"submitFeedback\"\n        />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, useTemplateRef, watch, ref } from \"vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport { PvAlignmentPositions } from \"../baseProps\";\nimport { PvGhostInputInputVariant, PvGhostInputVariant } from \"./types\";\n\ninterface PvGhostInputProps {\n  /**\n   * The typographic style applied to the input text (e.g. h1, h2, text-md, caption).\n   */\n  variant?: PvGhostInputVariant;\n  /** Placeholder text shown when the input is empty. */\n  placeholder?: string;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Visual style of the input. `secondary` adds a hover background and tertiary text color. */\n  inputVariant?: PvGhostInputInputVariant;\n  /** Text shown in a dark tooltip when hovering the input. No tooltip is rendered when empty. */\n  tooltipText?: string;\n  /** Where the tooltip appears relative to the input. Defaults to centered below it. */\n  tooltipPosition?: PvAlignmentPositions;\n  /** When true, applies invalid/error border styling. */\n  error?: boolean;\n  /** When true, focuses the input as soon as it mounts. */\n  autofocus?: boolean;\n}\n\nconst inputRef = useTemplateRef(\"inputRef\");\n\nconst variantToInputNameMap: Record<PvGhostInputVariant, string> = {\n  h1: \"ghost-input-h1\",\n  h2: \"ghost-input-h2\",\n  h3: \"ghost-input-h3\",\n  h4: \"ghost-input-h4\",\n  \"text-lg\": \"ghost-input-text-large\",\n  \"text-md\": \"ghost-input-text-medium\",\n  \"text-sm\": \"ghost-input-text-small\",\n  caption: \"ghost-input-caption\",\n};\n\nconst variantToDataStyleMap: Record<PvGhostInputVariant, string> = {\n  h1: \"h1\",\n  h2: \"h2\",\n  h3: \"h3\",\n  h4: \"h4\",\n  \"text-sm\": \"text-small\",\n  \"text-md\": \"text-medium\",\n  \"text-lg\": \"text-large\",\n  caption: \"caption\",\n};\n\nconst props = withDefaults(defineProps<PvGhostInputProps>(), {\n  variant: \"h1\",\n  inputVariant: \"primary\",\n  tooltipPosition: \"bottom-center\",\n});\n\nconst inputValue = defineModel<string>();\nconst inputWidth = ref(0);\n\nonMounted(() => {\n  if (inputValue.value && inputValue.value.length > 0) {\n    calculateWidth(inputValue.value);\n  } else if (props.placeholder) {\n    calculateWidth(props.placeholder);\n  } else {\n    inputWidth.value = 240;\n  }\n  if (props.autofocus) {\n    inputRef.value?.focus();\n  }\n});\n\nwatch(\n  () => inputValue.value,\n  () => {\n    if (inputValue.value && inputValue.value.length > 0) {\n      calculateWidth(inputValue.value);\n    } else if (props.placeholder) {\n      calculateWidth(props.placeholder);\n    } else {\n      inputWidth.value = 240;\n    }\n  },\n);\n\nconst calculateWidth = (value: string) => {\n  if (!inputRef.value) return;\n\n  const canvas = document.createElement(\"canvas\");\n  const context = canvas.getContext(\"2d\");\n\n  if (!context) return;\n\n  const style = getComputedStyle(inputRef.value);\n  context.font = `${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n\n  inputWidth.value = context.measureText(value).width + 10;\n};\n</script>\n\n<template>\n  <div\n    class=\"pv-ghost-input pv-full-width\"\n    data-testid=\"pv-ghost-input\"\n    :data-style=\"variantToDataStyleMap[variant]\"\n    :data-variant=\"inputVariant\"\n    :data-invalid=\"error ? true : undefined\"\n  >\n    <slot name=\"action\" />\n    <PvTooltipV2\n      class=\"pv-ghost-input-tooltip\"\n      variant=\"dark\"\n      size=\"sm\"\n      :position=\"tooltipPosition\"\n      :description=\"tooltipText\"\n      :disabled=\"!tooltipText\"\n    >\n      <template #trigger>\n        <input\n          ref=\"inputRef\"\n          v-model=\"inputValue\"\n          type=\"text\"\n          :style=\"{\n            width: inputWidth + 'px',\n          }\"\n          :placeholder=\"placeholder\"\n          :disabled=\"disabled\"\n          :name=\"variantToInputNameMap[variant]\"\n        />\n      </template>\n    </PvTooltipV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, useTemplateRef, watch, ref } from \"vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport { PvAlignmentPositions } from \"../baseProps\";\nimport { PvGhostInputInputVariant, PvGhostInputVariant } from \"./types\";\n\ninterface PvGhostInputProps {\n  /**\n   * The typographic style applied to the input text (e.g. h1, h2, text-md, caption).\n   */\n  variant?: PvGhostInputVariant;\n  /** Placeholder text shown when the input is empty. */\n  placeholder?: string;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Visual style of the input. `secondary` adds a hover background and tertiary text color. */\n  inputVariant?: PvGhostInputInputVariant;\n  /** Text shown in a dark tooltip when hovering the input. No tooltip is rendered when empty. */\n  tooltipText?: string;\n  /** Where the tooltip appears relative to the input. Defaults to centered below it. */\n  tooltipPosition?: PvAlignmentPositions;\n  /** When true, applies invalid/error border styling. */\n  error?: boolean;\n  /** When true, focuses the input as soon as it mounts. */\n  autofocus?: boolean;\n}\n\nconst inputRef = useTemplateRef(\"inputRef\");\n\nconst variantToInputNameMap: Record<PvGhostInputVariant, string> = {\n  h1: \"ghost-input-h1\",\n  h2: \"ghost-input-h2\",\n  h3: \"ghost-input-h3\",\n  h4: \"ghost-input-h4\",\n  \"text-lg\": \"ghost-input-text-large\",\n  \"text-md\": \"ghost-input-text-medium\",\n  \"text-sm\": \"ghost-input-text-small\",\n  caption: \"ghost-input-caption\",\n};\n\nconst variantToDataStyleMap: Record<PvGhostInputVariant, string> = {\n  h1: \"h1\",\n  h2: \"h2\",\n  h3: \"h3\",\n  h4: \"h4\",\n  \"text-sm\": \"text-small\",\n  \"text-md\": \"text-medium\",\n  \"text-lg\": \"text-large\",\n  caption: \"caption\",\n};\n\nconst props = withDefaults(defineProps<PvGhostInputProps>(), {\n  variant: \"h1\",\n  inputVariant: \"primary\",\n  tooltipPosition: \"bottom-center\",\n});\n\nconst inputValue = defineModel<string>();\nconst inputWidth = ref(0);\n\nonMounted(() => {\n  if (inputValue.value && inputValue.value.length > 0) {\n    calculateWidth(inputValue.value);\n  } else if (props.placeholder) {\n    calculateWidth(props.placeholder);\n  } else {\n    inputWidth.value = 240;\n  }\n  if (props.autofocus) {\n    inputRef.value?.focus();\n  }\n});\n\nwatch(\n  () => inputValue.value,\n  () => {\n    if (inputValue.value && inputValue.value.length > 0) {\n      calculateWidth(inputValue.value);\n    } else if (props.placeholder) {\n      calculateWidth(props.placeholder);\n    } else {\n      inputWidth.value = 240;\n    }\n  },\n);\n\nconst calculateWidth = (value: string) => {\n  if (!inputRef.value) return;\n\n  const canvas = document.createElement(\"canvas\");\n  const context = canvas.getContext(\"2d\");\n\n  if (!context) return;\n\n  const style = getComputedStyle(inputRef.value);\n  context.font = `${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n\n  inputWidth.value = context.measureText(value).width + 10;\n};\n</script>\n\n<template>\n  <div\n    class=\"pv-ghost-input pv-full-width\"\n    data-testid=\"pv-ghost-input\"\n    :data-style=\"variantToDataStyleMap[variant]\"\n    :data-variant=\"inputVariant\"\n    :data-invalid=\"error ? true : undefined\"\n  >\n    <slot name=\"action\" />\n    <PvTooltipV2\n      class=\"pv-ghost-input-tooltip\"\n      variant=\"dark\"\n      size=\"sm\"\n      :position=\"tooltipPosition\"\n      :description=\"tooltipText\"\n      :disabled=\"!tooltipText\"\n    >\n      <template #trigger>\n        <input\n          ref=\"inputRef\"\n          v-model=\"inputValue\"\n          type=\"text\"\n          :style=\"{\n            width: inputWidth + 'px',\n          }\"\n          :placeholder=\"placeholder\"\n          :disabled=\"disabled\"\n          :name=\"variantToInputNameMap[variant]\"\n        />\n      </template>\n    </PvTooltipV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, ref, shallowRef, watch } from \"vue\";\nimport { useElementSize } from \"@vueuse/core\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvGhostInput from \"../PvGhostInput/PvGhostInput.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { Tab, TabOption, TabSize } from \"./types\";\n\ninterface PvTabsProps {\n  /** Folds the tabs that don't fit into a \"+N more\" menu, keeping \"addButton\" tabs visible after it. */\n  collapseOverflow?: boolean;\n  /** Array of tab objects defining each tab's label, icon, and counter */\n  tabs: Tab[];\n  /** Size of the tab list */\n  size?: TabSize;\n}\n\nconst props = withDefaults(defineProps<PvTabsProps>(), {\n  size: \"lg\",\n});\n\nconst emit = defineEmits<{\n  /** Emitted when a tab with type \"addButton\" is clicked, or, with the option's value, when one of its `options` is picked */\n  \"add-button-click\": [value: string, option?: string];\n  /**\n   * Emitted for a tab with type \"input\" whenever editing ends — Enter,\n   * losing focus (clicking outside), or Escape — so the consumer can revert\n   * the tab out of edit mode. `text` is the current value, unchanged if the\n   * edit was cancelled or nothing was typed. The tab's `label`/`type` are not\n   * updated internally — the consumer must update its own `tabs` array.\n   */\n  \"handle-input-submit\": [value: string, text: string];\n  /** Emitted when an option is chosen from a tab's \"...\" options popover */\n  \"option-click\": [tabValue: string, optionValue: string];\n}>();\n\nconst selectedTab = defineModel<string>({ required: true });\n\nconst tabValue = (tab: Tab) => tab.value ?? tab.label;\n\nconst DEFAULT_ADD_BUTTON_TAB: Tab = {\n  label: \"Add View\",\n  value: \"add\",\n  icon: \"add\",\n  type: \"addButton\",\n};\n\n/**\n * Auto-injects a default \"addButton\" tab when any tab exposes a \"delete\"\n * option and the consumer hasn't already included one, so deleting a tab\n * always leaves a way to add a new one.\n */\nconst renderedTabs = computed<Tab[]>(() => {\n  const hasAddButton = props.tabs.some((tab) => tab.type === \"addButton\");\n  const hasDeleteOption = props.tabs.some((tab) => tab.options?.some((option) => option.value === \"delete\"));\n\n  return hasAddButton || !hasDeleteOption ? props.tabs : [...props.tabs, DEFAULT_ADD_BUTTON_TAB];\n});\n\nconst OVERFLOW_TAB_VALUE = \"__pv-tabs-overflow__\";\n\nconst listRef = ref<HTMLElement | null>(null);\nconst { width: availableWidth } = useElementSize(listRef);\nconst columnGap = ref(0);\nconst isMeasuring = ref(false);\nconst overflowMenuOpen = ref(false);\n// Tab widths, including the \"+N more\" tab, read while all of them are rendered so folded tabs keep a width.\nconst tabWidths = shallowRef<Record<string, number>>({});\n\nconst isPinned = (tab: Tab) => tab.type === \"addButton\";\nconst isOverflowTab = (tab: Tab) => tab.value === OVERFLOW_TAB_VALUE;\nconst widthOf = (tab: Tab) => tabWidths.value[tabValue(tab)] ?? 0;\n\nconst regularTabs = computed(() => renderedTabs.value.filter((tab) => !isPinned(tab)));\nconst pinnedTabs = computed(() => renderedTabs.value.filter(isPinned));\n\nconst selectedIndex = computed(() => regularTabs.value.findIndex((tab) => tabValue(tab) === selectedTab.value));\n\n// A selected tab past the first `count` takes the last slot in the row, so its options stay reachable.\nconst rowTabsFor = (count: number) => {\n  const leadingTabs = regularTabs.value.slice(0, count);\n  return selectedIndex.value >= count ? [...leadingTabs, regularTabs.value[selectedIndex.value]] : leadingTabs;\n};\n\n// How many leading regular tabs stay visible; being a number, it only re-renders the list when the count changes.\nconst visibleCount = computed(() => {\n  const total = regularTabs.value.length;\n  if (!props.collapseOverflow || availableWidth.value <= 0) return total;\n\n  const pinnedWidths = pinnedTabs.value.map(widthOf);\n  const overflowWidth = tabWidths.value[OVERFLOW_TAB_VALUE] ?? 0;\n  const fits = (count: number) => {\n    const rowTabs = rowTabsFor(count);\n    const rowWidths = [...rowTabs.map(widthOf), ...(rowTabs.length < total ? [overflowWidth] : []), ...pinnedWidths];\n    const gaps = columnGap.value * (rowWidths.length - 1);\n    return rowWidths.reduce((sum, width) => sum + width, gaps) <= availableWidth.value;\n  };\n\n  let count = total;\n  while (count > 0 && !fits(count)) count--;\n  return count;\n});\n\nconst visibleTabs = computed(() => rowTabsFor(visibleCount.value));\n\nconst overflowedTabs = computed(() =>\n  regularTabs.value.filter((_, index) => index >= visibleCount.value && index !== selectedIndex.value),\n);\n\nconst overflowTab = computed<Tab>(() => ({\n  label: `+${isMeasuring.value ? regularTabs.value.length : overflowedTabs.value.length} more`,\n  value: OVERFLOW_TAB_VALUE,\n}));\n\nconst displayedTabs = computed<Tab[]>(() => {\n  // Measuring renders every tab plus the widest \"+N more\" tab, so each has a width to compare against.\n  if (isMeasuring.value) return [...renderedTabs.value, overflowTab.value];\n  if (!overflowedTabs.value.length) return renderedTabs.value;\n  return [...visibleTabs.value, overflowTab.value, ...pinnedTabs.value];\n});\n\nconst measureTabs = async () => {\n  const list = listRef.value;\n  if (!props.collapseOverflow || !list) return;\n\n  isMeasuring.value = true;\n  await nextTick();\n\n  const widths: Record<string, number> = {};\n  [...renderedTabs.value, overflowTab.value].forEach((tab, index) => {\n    widths[tabValue(tab)] = list.children[index]?.getBoundingClientRect().width ?? 0;\n  });\n  tabWidths.value = widths;\n  columnGap.value = parseFloat(getComputedStyle(list).columnGap) || 0;\n  isMeasuring.value = false;\n};\n\nconst tabsSignature = computed(() => JSON.stringify(renderedTabs.value, [\"value\", \"label\", \"icon\", \"counter\", \"type\"]));\n\n// The list gaining width also re-measures, which covers the first measure and mounting while hidden.\nwatch([() => props.collapseOverflow, () => props.size, tabsSignature, () => availableWidth.value > 0], measureTabs, {\n  flush: \"post\",\n});\n\nonMounted(() => {\n  void document.fonts?.ready.then(measureTabs);\n});\n\nwatch(\n  () => overflowedTabs.value.length,\n  (count) => {\n    if (!count) overflowMenuOpen.value = false;\n  },\n);\n\n/** Draft text for the tab currently in edit mode. Only one tab is expected to have type \"input\" at a time. */\nconst inputDraft = ref<string>();\n\nconst draftValue = (tab: Tab) => inputDraft.value ?? tab.label;\n\nconst handleInputChange = (text: string | undefined) => {\n  inputDraft.value = text;\n};\n\nconst commitInput = (tab: Tab) => {\n  const draft = inputDraft.value ?? tab.label;\n  emit(\"handle-input-submit\", tabValue(tab), draft.trim().length > 0 ? draft : tab.label);\n  inputDraft.value = undefined;\n};\n\nconst cancelInput = (event: Event) => {\n  inputDraft.value = undefined;\n  if (event.target instanceof HTMLInputElement) {\n    event.target.blur();\n  }\n};\n\nconst handleSelectTab = (tab: Tab) => {\n  if (tab.disabled) {\n    return;\n  }\n  if (tab.type === \"addButton\") {\n    emit(\"add-button-click\", tabValue(tab));\n    return;\n  }\n  if (tab.type === \"input\") {\n    return;\n  }\n  selectedTab.value = tabValue(tab);\n};\n\nconst selectFoldedTab = (tab: Tab) => {\n  if (tab.disabled) return;\n  handleSelectTab(tab);\n  overflowMenuOpen.value = false;\n};\n\nconst isTabSelected = (tab: Tab) => (tab.type !== \"addButton\" && tabValue(tab) === selectedTab.value ? true : null);\n\nconst tabKind = (tab: Tab) => {\n  if (isOverflowTab(tab)) return \"overflow\";\n  if (tab.type === \"addButton\") return \"add-button\";\n  if (tab.type === \"input\") return \"input\";\n  return undefined;\n};\n\nconst hasOptions = (tab: Tab) => Boolean(tab.options?.length) && tab.type !== \"input\" && tab.type !== \"addButton\";\n\nconst handleOptionClick = (tab: Tab, option: TabOption) => {\n  emit(\"option-click\", tabValue(tab), option.value);\n};\n\nconst addMenuOpen = ref(false);\n\n// An add button with options opens them as a menu instead of emitting right away.\nconst hasAddMenu = (tab: Tab) => tab.type === \"addButton\" && Boolean(tab.options?.length);\n\nconst selectAddMenuOption = (tab: Tab, option: TabOption) => {\n  emit(\"add-button-click\", tabValue(tab), option.value);\n  addMenuOpen.value = false;\n};\n</script>\n\n<template>\n  <ul\n    ref=\"listRef\"\n    data-testid=\"pv-tabs\"\n    role=\"list\"\n    :class=\"{\n      'pv-tab-list-small': size === 'lg',\n      'pv-tab-list': size === 'xl',\n      'pv-tab-list-collapsible': collapseOverflow,\n    }\"\n  >\n    <li\n      v-for=\"tab in displayedTabs\"\n      :key=\"tabValue(tab)\"\n      class=\"pv-flex\"\n      :data-active=\"isTabSelected(tab)\"\n      :data-type=\"tabKind(tab)\"\n      :data-testid=\"tabKind(tab) ? `pv-tab-${tabKind(tab)}` : 'pv-tab'\"\n      @click=\"() => handleSelectTab(tab)\"\n    >\n      <div v-if=\"tab.type === 'input'\" class=\"pv-tab-input\">\n        <PvGhostInput\n          variant=\"text-md\"\n          autofocus\n          :placeholder=\"tab.label\"\n          :model-value=\"draftValue(tab)\"\n          @update:model-value=\"handleInputChange\"\n          @keydown.enter=\"() => commitInput(tab)\"\n          @keydown.esc=\"cancelInput\"\n          @focusout=\"() => commitInput(tab)\"\n        />\n      </div>\n      <PvPopoverV2\n        v-else-if=\"isOverflowTab(tab)\"\n        v-model=\"overflowMenuOpen\"\n        class=\"pv-tab-overflow\"\n        position=\"bottom-left\"\n        disable-auto-placement\n        @click.stop\n      >\n        <template #trigger>\n          <button type=\"button\" aria-haspopup=\"true\" :aria-expanded=\"overflowMenuOpen\">\n            {{ tab.label }}\n          </button>\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"foldedTab in overflowedTabs\" :key=\"tabValue(foldedTab)\">\n              <a\n                href=\"#\"\n                :aria-disabled=\"foldedTab.disabled\"\n                :title=\"foldedTab.disabled ? foldedTab.disabledReason : undefined\"\n                @click.prevent=\"selectFoldedTab(foldedTab)\"\n                >{{ foldedTab.label }}</a\n              >\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n      <PvPopoverV2\n        v-else-if=\"hasAddMenu(tab)\"\n        v-model=\"addMenuOpen\"\n        class=\"pv-tab-add-menu\"\n        position=\"bottom-left\"\n        disable-auto-placement\n        :disabled=\"tab.disabled\"\n        @click.stop\n      >\n        <template #trigger>\n          <button\n            type=\"button\"\n            aria-haspopup=\"true\"\n            :aria-expanded=\"addMenuOpen\"\n            :disabled=\"tab.disabled\"\n            :title=\"tab.disabled ? tab.disabledReason : undefined\"\n          >\n            <PvIcon v-if=\"tab.icon\" :name=\"tab.icon\" />\n            {{ tab.label }}\n          </button>\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"option in tab.options\" :key=\"option.value\">\n              <a href=\"#\" @click.prevent=\"selectAddMenuOption(tab, option)\">{{ option.label }}</a>\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n      <button v-else type=\"button\" :disabled=\"tab.disabled\" :title=\"tab.disabled ? tab.disabledReason : undefined\">\n        <PvIcon v-if=\"tab.icon\" :name=\"tab.icon\" />\n        {{ tab.label }}\n        <PvCounterBadge\n          v-if=\"tab.counter\"\n          :value=\"tab.counter\"\n          :variant=\"isTabSelected(tab) ? 'primary' : 'tertiary'\"\n          size=\"sm\"\n        />\n      </button>\n      <PvPopoverV2 v-if=\"hasOptions(tab)\" class=\"pv-tab-options\" show-on-hover @click.stop>\n        <template #trigger>\n          <PvButton left-icon=\"ellipsis-vertical\" variant=\"ghost\" size=\"md\" ariaLabel=\"Tab options\" />\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"option in tab.options\" :key=\"option.value\">\n              <a\n                href=\"#\"\n                :class=\"{ 'pv-text-critical': option.value === 'delete' }\"\n                @click.prevent=\"handleOptionClick(tab, option)\"\n                >{{ option.label }}</a\n              >\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, ref, shallowRef, watch } from \"vue\";\nimport { useElementSize } from \"@vueuse/core\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvGhostInput from \"../PvGhostInput/PvGhostInput.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { Tab, TabOption, TabSize } from \"./types\";\n\ninterface PvTabsProps {\n  /** Folds the tabs that don't fit into a \"+N more\" menu, keeping \"addButton\" tabs visible after it. */\n  collapseOverflow?: boolean;\n  /** Array of tab objects defining each tab's label, icon, and counter */\n  tabs: Tab[];\n  /** Size of the tab list */\n  size?: TabSize;\n}\n\nconst props = withDefaults(defineProps<PvTabsProps>(), {\n  size: \"lg\",\n});\n\nconst emit = defineEmits<{\n  /** Emitted when a tab with type \"addButton\" is clicked, or, with the option's value, when one of its `options` is picked */\n  \"add-button-click\": [value: string, option?: string];\n  /**\n   * Emitted for a tab with type \"input\" whenever editing ends — Enter,\n   * losing focus (clicking outside), or Escape — so the consumer can revert\n   * the tab out of edit mode. `text` is the current value, unchanged if the\n   * edit was cancelled or nothing was typed. The tab's `label`/`type` are not\n   * updated internally — the consumer must update its own `tabs` array.\n   */\n  \"handle-input-submit\": [value: string, text: string];\n  /** Emitted when an option is chosen from a tab's \"...\" options popover */\n  \"option-click\": [tabValue: string, optionValue: string];\n}>();\n\nconst selectedTab = defineModel<string>({ required: true });\n\nconst tabValue = (tab: Tab) => tab.value ?? tab.label;\n\nconst DEFAULT_ADD_BUTTON_TAB: Tab = {\n  label: \"Add View\",\n  value: \"add\",\n  icon: \"add\",\n  type: \"addButton\",\n};\n\n/**\n * Auto-injects a default \"addButton\" tab when any tab exposes a \"delete\"\n * option and the consumer hasn't already included one, so deleting a tab\n * always leaves a way to add a new one.\n */\nconst renderedTabs = computed<Tab[]>(() => {\n  const hasAddButton = props.tabs.some((tab) => tab.type === \"addButton\");\n  const hasDeleteOption = props.tabs.some((tab) => tab.options?.some((option) => option.value === \"delete\"));\n\n  return hasAddButton || !hasDeleteOption ? props.tabs : [...props.tabs, DEFAULT_ADD_BUTTON_TAB];\n});\n\nconst OVERFLOW_TAB_VALUE = \"__pv-tabs-overflow__\";\n\nconst listRef = ref<HTMLElement | null>(null);\nconst { width: availableWidth } = useElementSize(listRef);\nconst columnGap = ref(0);\nconst isMeasuring = ref(false);\nconst overflowMenuOpen = ref(false);\n// Tab widths, including the \"+N more\" tab, read while all of them are rendered so folded tabs keep a width.\nconst tabWidths = shallowRef<Record<string, number>>({});\n\nconst isPinned = (tab: Tab) => tab.type === \"addButton\";\nconst isOverflowTab = (tab: Tab) => tab.value === OVERFLOW_TAB_VALUE;\nconst widthOf = (tab: Tab) => tabWidths.value[tabValue(tab)] ?? 0;\n\nconst regularTabs = computed(() => renderedTabs.value.filter((tab) => !isPinned(tab)));\nconst pinnedTabs = computed(() => renderedTabs.value.filter(isPinned));\n\nconst selectedIndex = computed(() => regularTabs.value.findIndex((tab) => tabValue(tab) === selectedTab.value));\n\n// A selected tab past the first `count` takes the last slot in the row, so its options stay reachable.\nconst rowTabsFor = (count: number) => {\n  const leadingTabs = regularTabs.value.slice(0, count);\n  return selectedIndex.value >= count ? [...leadingTabs, regularTabs.value[selectedIndex.value]] : leadingTabs;\n};\n\n// How many leading regular tabs stay visible; being a number, it only re-renders the list when the count changes.\nconst visibleCount = computed(() => {\n  const total = regularTabs.value.length;\n  if (!props.collapseOverflow || availableWidth.value <= 0) return total;\n\n  const pinnedWidths = pinnedTabs.value.map(widthOf);\n  const overflowWidth = tabWidths.value[OVERFLOW_TAB_VALUE] ?? 0;\n  const fits = (count: number) => {\n    const rowTabs = rowTabsFor(count);\n    const rowWidths = [...rowTabs.map(widthOf), ...(rowTabs.length < total ? [overflowWidth] : []), ...pinnedWidths];\n    const gaps = columnGap.value * (rowWidths.length - 1);\n    return rowWidths.reduce((sum, width) => sum + width, gaps) <= availableWidth.value;\n  };\n\n  let count = total;\n  while (count > 0 && !fits(count)) count--;\n  return count;\n});\n\nconst visibleTabs = computed(() => rowTabsFor(visibleCount.value));\n\nconst overflowedTabs = computed(() =>\n  regularTabs.value.filter((_, index) => index >= visibleCount.value && index !== selectedIndex.value),\n);\n\nconst overflowTab = computed<Tab>(() => ({\n  label: `+${isMeasuring.value ? regularTabs.value.length : overflowedTabs.value.length} more`,\n  value: OVERFLOW_TAB_VALUE,\n}));\n\nconst displayedTabs = computed<Tab[]>(() => {\n  // Measuring renders every tab plus the widest \"+N more\" tab, so each has a width to compare against.\n  if (isMeasuring.value) return [...renderedTabs.value, overflowTab.value];\n  if (!overflowedTabs.value.length) return renderedTabs.value;\n  return [...visibleTabs.value, overflowTab.value, ...pinnedTabs.value];\n});\n\nconst measureTabs = async () => {\n  const list = listRef.value;\n  if (!props.collapseOverflow || !list) return;\n\n  isMeasuring.value = true;\n  await nextTick();\n\n  const widths: Record<string, number> = {};\n  [...renderedTabs.value, overflowTab.value].forEach((tab, index) => {\n    widths[tabValue(tab)] = list.children[index]?.getBoundingClientRect().width ?? 0;\n  });\n  tabWidths.value = widths;\n  columnGap.value = parseFloat(getComputedStyle(list).columnGap) || 0;\n  isMeasuring.value = false;\n};\n\nconst tabsSignature = computed(() => JSON.stringify(renderedTabs.value, [\"value\", \"label\", \"icon\", \"counter\", \"type\"]));\n\n// The list gaining width also re-measures, which covers the first measure and mounting while hidden.\nwatch([() => props.collapseOverflow, () => props.size, tabsSignature, () => availableWidth.value > 0], measureTabs, {\n  flush: \"post\",\n});\n\nonMounted(() => {\n  void document.fonts?.ready.then(measureTabs);\n});\n\nwatch(\n  () => overflowedTabs.value.length,\n  (count) => {\n    if (!count) overflowMenuOpen.value = false;\n  },\n);\n\n/** Draft text for the tab currently in edit mode. Only one tab is expected to have type \"input\" at a time. */\nconst inputDraft = ref<string>();\n\nconst draftValue = (tab: Tab) => inputDraft.value ?? tab.label;\n\nconst handleInputChange = (text: string | undefined) => {\n  inputDraft.value = text;\n};\n\nconst commitInput = (tab: Tab) => {\n  const draft = inputDraft.value ?? tab.label;\n  emit(\"handle-input-submit\", tabValue(tab), draft.trim().length > 0 ? draft : tab.label);\n  inputDraft.value = undefined;\n};\n\nconst cancelInput = (event: Event) => {\n  inputDraft.value = undefined;\n  if (event.target instanceof HTMLInputElement) {\n    event.target.blur();\n  }\n};\n\nconst handleSelectTab = (tab: Tab) => {\n  if (tab.disabled) {\n    return;\n  }\n  if (tab.type === \"addButton\") {\n    emit(\"add-button-click\", tabValue(tab));\n    return;\n  }\n  if (tab.type === \"input\") {\n    return;\n  }\n  selectedTab.value = tabValue(tab);\n};\n\nconst selectFoldedTab = (tab: Tab) => {\n  if (tab.disabled) return;\n  handleSelectTab(tab);\n  overflowMenuOpen.value = false;\n};\n\nconst isTabSelected = (tab: Tab) => (tab.type !== \"addButton\" && tabValue(tab) === selectedTab.value ? true : null);\n\nconst tabKind = (tab: Tab) => {\n  if (isOverflowTab(tab)) return \"overflow\";\n  if (tab.type === \"addButton\") return \"add-button\";\n  if (tab.type === \"input\") return \"input\";\n  return undefined;\n};\n\nconst hasOptions = (tab: Tab) => Boolean(tab.options?.length) && tab.type !== \"input\" && tab.type !== \"addButton\";\n\nconst handleOptionClick = (tab: Tab, option: TabOption) => {\n  emit(\"option-click\", tabValue(tab), option.value);\n};\n\nconst addMenuOpen = ref(false);\n\n// An add button with options opens them as a menu instead of emitting right away.\nconst hasAddMenu = (tab: Tab) => tab.type === \"addButton\" && Boolean(tab.options?.length);\n\nconst selectAddMenuOption = (tab: Tab, option: TabOption) => {\n  emit(\"add-button-click\", tabValue(tab), option.value);\n  addMenuOpen.value = false;\n};\n</script>\n\n<template>\n  <ul\n    ref=\"listRef\"\n    data-testid=\"pv-tabs\"\n    role=\"list\"\n    :class=\"{\n      'pv-tab-list-small': size === 'lg',\n      'pv-tab-list': size === 'xl',\n      'pv-tab-list-collapsible': collapseOverflow,\n    }\"\n  >\n    <li\n      v-for=\"tab in displayedTabs\"\n      :key=\"tabValue(tab)\"\n      class=\"pv-flex\"\n      :data-active=\"isTabSelected(tab)\"\n      :data-type=\"tabKind(tab)\"\n      :data-testid=\"tabKind(tab) ? `pv-tab-${tabKind(tab)}` : 'pv-tab'\"\n      @click=\"() => handleSelectTab(tab)\"\n    >\n      <div v-if=\"tab.type === 'input'\" class=\"pv-tab-input\">\n        <PvGhostInput\n          variant=\"text-md\"\n          autofocus\n          :placeholder=\"tab.label\"\n          :model-value=\"draftValue(tab)\"\n          @update:model-value=\"handleInputChange\"\n          @keydown.enter=\"() => commitInput(tab)\"\n          @keydown.esc=\"cancelInput\"\n          @focusout=\"() => commitInput(tab)\"\n        />\n      </div>\n      <PvPopoverV2\n        v-else-if=\"isOverflowTab(tab)\"\n        v-model=\"overflowMenuOpen\"\n        class=\"pv-tab-overflow\"\n        position=\"bottom-left\"\n        disable-auto-placement\n        @click.stop\n      >\n        <template #trigger>\n          <button type=\"button\" aria-haspopup=\"true\" :aria-expanded=\"overflowMenuOpen\">\n            {{ tab.label }}\n          </button>\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"foldedTab in overflowedTabs\" :key=\"tabValue(foldedTab)\">\n              <a\n                href=\"#\"\n                :aria-disabled=\"foldedTab.disabled\"\n                :title=\"foldedTab.disabled ? foldedTab.disabledReason : undefined\"\n                @click.prevent=\"selectFoldedTab(foldedTab)\"\n                >{{ foldedTab.label }}</a\n              >\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n      <PvPopoverV2\n        v-else-if=\"hasAddMenu(tab)\"\n        v-model=\"addMenuOpen\"\n        class=\"pv-tab-add-menu\"\n        position=\"bottom-left\"\n        disable-auto-placement\n        :disabled=\"tab.disabled\"\n        @click.stop\n      >\n        <template #trigger>\n          <button\n            type=\"button\"\n            aria-haspopup=\"true\"\n            :aria-expanded=\"addMenuOpen\"\n            :disabled=\"tab.disabled\"\n            :title=\"tab.disabled ? tab.disabledReason : undefined\"\n          >\n            <PvIcon v-if=\"tab.icon\" :name=\"tab.icon\" />\n            {{ tab.label }}\n          </button>\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"option in tab.options\" :key=\"option.value\">\n              <a href=\"#\" @click.prevent=\"selectAddMenuOption(tab, option)\">{{ option.label }}</a>\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n      <button v-else type=\"button\" :disabled=\"tab.disabled\" :title=\"tab.disabled ? tab.disabledReason : undefined\">\n        <PvIcon v-if=\"tab.icon\" :name=\"tab.icon\" />\n        {{ tab.label }}\n        <PvCounterBadge\n          v-if=\"tab.counter\"\n          :value=\"tab.counter\"\n          :variant=\"isTabSelected(tab) ? 'primary' : 'tertiary'\"\n          size=\"sm\"\n        />\n      </button>\n      <PvPopoverV2 v-if=\"hasOptions(tab)\" class=\"pv-tab-options\" show-on-hover @click.stop>\n        <template #trigger>\n          <PvButton left-icon=\"ellipsis-vertical\" variant=\"ghost\" size=\"md\" ariaLabel=\"Tab options\" />\n        </template>\n        <template #content>\n          <ul class=\"pv-popover pv-popover-list\" style=\"--width: fit-content\">\n            <li v-for=\"option in tab.options\" :key=\"option.value\">\n              <a\n                href=\"#\"\n                :class=\"{ 'pv-text-critical': option.value === 'delete' }\"\n                @click.prevent=\"handleOptionClick(tab, option)\"\n                >{{ option.label }}</a\n              >\n            </li>\n          </ul>\n        </template>\n      </PvPopoverV2>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { PvBreadcrumbsOptions } from \"./types\";\n\ninterface PvBreadcrumbsProps {\n  /** Array of breadcrumb items defining the navigation trail */\n  options: PvBreadcrumbsOptions[];\n}\n\ndefineProps<PvBreadcrumbsProps>();\n\ndefineEmits<{\n  (e: \"handle-click\", payload: string): void;\n}>();\n</script>\n\n<template>\n  <ul class=\"pv-breadcrumbs\" role=\"list\" data-testid=\"pv-breadcrumbs\">\n    <li v-for=\"(option, index) in options\" :key=\"`${index}-${option.label}`\">\n      <a v-if=\"option.href\" :href=\"option.href\">{{ option.label }}</a>\n      <span v-else @click=\"$emit('handle-click', option.label)\">{{ option.label }}</span>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { PvBreadcrumbsOptions } from \"./types\";\n\ninterface PvBreadcrumbsProps {\n  /** Array of breadcrumb items defining the navigation trail */\n  options: PvBreadcrumbsOptions[];\n}\n\ndefineProps<PvBreadcrumbsProps>();\n\ndefineEmits<{\n  (e: \"handle-click\", payload: string): void;\n}>();\n</script>\n\n<template>\n  <ul class=\"pv-breadcrumbs\" role=\"list\" data-testid=\"pv-breadcrumbs\">\n    <li v-for=\"(option, index) in options\" :key=\"`${index}-${option.label}`\">\n      <a v-if=\"option.href\" :href=\"option.href\">{{ option.label }}</a>\n      <span v-else @click=\"$emit('handle-click', option.label)\">{{ option.label }}</span>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { MenuActionsVariant } from \"@/components/base/PvMultiSelectButton/types.ts\";\n\nconst props = defineProps<{\n  variant?: MenuActionsVariant;\n  disabled?: boolean;\n  /**\n   * Human-readable filter name used to derive `data-dd-action-name` on the\n   * Select All and Clear All buttons (e.g. \"Select all Payer Network options\",\n   * \"Clear Payer Network selections\"). Leave unset to skip the attributes.\n   * Cancel/Confirm intentionally don't get derived labels — the cancel-confirm\n   * variant has no production consumers today.\n   */\n  rumFilterName?: string;\n}>();\n\nconst rumSelectAllActionName = computed(() =>\n  props.rumFilterName ? `Select all ${props.rumFilterName} options` : undefined,\n);\nconst rumClearAllActionName = computed(() =>\n  props.rumFilterName ? `Clear ${props.rumFilterName} selections` : undefined,\n);\n\ndefineEmits<{\n  (e: \"handle-select-all\"): void;\n  (e: \"handle-clear-all\"): void;\n  (e: \"handle-cancel\"): void;\n  (e: \"handle-confirm\"): void;\n}>();\n</script>\n\n<template>\n  <div data-testid=\"pv-select-menu-control-panel\" class=\"pv-flex pv-space-between\">\n    <template v-if=\"variant === 'select-clear'\">\n      <PvButton\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-select-all\"\n        :data-dd-action-name=\"rumSelectAllActionName\"\n        @click=\"$emit('handle-select-all')\"\n        label=\"Select All\"\n        :disabled=\"disabled\"\n      />\n      <PvButton\n        label=\"Clear All\"\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-clear-all\"\n        :data-dd-action-name=\"rumClearAllActionName\"\n        @click=\"$emit('handle-clear-all')\"\n        :disabled=\"disabled\"\n      />\n    </template>\n    <template v-else-if=\"variant === 'cancel-confirm'\">\n      <PvButton\n        label=\"Cancel\"\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-cancel\"\n        @click=\"$emit('handle-cancel')\"\n        :disabled=\"disabled\"\n      />\n      <PvButton\n        label=\"Confirm\"\n        data-testid=\"pv-select-menu-item-confirm\"\n        @click=\"$emit('handle-confirm')\"\n        :disabled=\"disabled\"\n      />\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { MenuActionsVariant } from \"@/components/base/PvMultiSelectButton/types.ts\";\n\nconst props = defineProps<{\n  variant?: MenuActionsVariant;\n  disabled?: boolean;\n  /**\n   * Human-readable filter name used to derive `data-dd-action-name` on the\n   * Select All and Clear All buttons (e.g. \"Select all Payer Network options\",\n   * \"Clear Payer Network selections\"). Leave unset to skip the attributes.\n   * Cancel/Confirm intentionally don't get derived labels — the cancel-confirm\n   * variant has no production consumers today.\n   */\n  rumFilterName?: string;\n}>();\n\nconst rumSelectAllActionName = computed(() =>\n  props.rumFilterName ? `Select all ${props.rumFilterName} options` : undefined,\n);\nconst rumClearAllActionName = computed(() =>\n  props.rumFilterName ? `Clear ${props.rumFilterName} selections` : undefined,\n);\n\ndefineEmits<{\n  (e: \"handle-select-all\"): void;\n  (e: \"handle-clear-all\"): void;\n  (e: \"handle-cancel\"): void;\n  (e: \"handle-confirm\"): void;\n}>();\n</script>\n\n<template>\n  <div data-testid=\"pv-select-menu-control-panel\" class=\"pv-flex pv-space-between\">\n    <template v-if=\"variant === 'select-clear'\">\n      <PvButton\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-select-all\"\n        :data-dd-action-name=\"rumSelectAllActionName\"\n        @click=\"$emit('handle-select-all')\"\n        label=\"Select All\"\n        :disabled=\"disabled\"\n      />\n      <PvButton\n        label=\"Clear All\"\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-clear-all\"\n        :data-dd-action-name=\"rumClearAllActionName\"\n        @click=\"$emit('handle-clear-all')\"\n        :disabled=\"disabled\"\n      />\n    </template>\n    <template v-else-if=\"variant === 'cancel-confirm'\">\n      <PvButton\n        label=\"Cancel\"\n        variant=\"ghost\"\n        data-testid=\"pv-select-menu-item-cancel\"\n        @click=\"$emit('handle-cancel')\"\n        :disabled=\"disabled\"\n      />\n      <PvButton\n        label=\"Confirm\"\n        data-testid=\"pv-select-menu-item-confirm\"\n        @click=\"$emit('handle-confirm')\"\n        :disabled=\"disabled\"\n      />\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { PvIconSize } from \"../baseProps\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvAvatarProps, PvAvatarSize } from \"./types\";\n\nconst avatarSizeToClass: Record<PvAvatarSize, string> = {\n  sm: \"pv-avatar-16\",\n  md: \"pv-avatar-20\",\n  lg: \"pv-avatar-xs\",\n  xl: \"pv-avatar-sm\",\n  \"2x\": \"pv-avatar-md\",\n};\n\nconst iconSizeToAvatarSize: Partial<Record<PvAvatarSize, PvIconSize>> = {\n  sm: 10,\n  md: 12,\n  lg: undefined,\n  xl: 20,\n  \"2x\": 20,\n};\n\nwithDefaults(defineProps<PvAvatarProps>(), {\n  shape: \"circle\",\n  size: \"lg\",\n});\n</script>\n\n<template>\n  <div :class=\"avatarSizeToClass[size]\" data-testid=\"pv-avatar\" :data-style=\"variant\" :data-shape=\"shape\">\n    <PvIcon v-if=\"icon\" :name=\"icon\" :size=\"iconSizeToAvatarSize[size]\" />\n    <template v-else-if=\"initials\">{{ initials }}</template>\n    <template v-else-if=\"image\">\n      <img :src=\"image\" :alt=\"alt ?? ''\" />\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { PvIconSize } from \"../baseProps\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvAvatarProps, PvAvatarSize } from \"./types\";\n\nconst avatarSizeToClass: Record<PvAvatarSize, string> = {\n  sm: \"pv-avatar-16\",\n  md: \"pv-avatar-20\",\n  lg: \"pv-avatar-xs\",\n  xl: \"pv-avatar-sm\",\n  \"2x\": \"pv-avatar-md\",\n};\n\nconst iconSizeToAvatarSize: Partial<Record<PvAvatarSize, PvIconSize>> = {\n  sm: 10,\n  md: 12,\n  lg: undefined,\n  xl: 20,\n  \"2x\": 20,\n};\n\nwithDefaults(defineProps<PvAvatarProps>(), {\n  shape: \"circle\",\n  size: \"lg\",\n});\n</script>\n\n<template>\n  <div :class=\"avatarSizeToClass[size]\" data-testid=\"pv-avatar\" :data-style=\"variant\" :data-shape=\"shape\">\n    <PvIcon v-if=\"icon\" :name=\"icon\" :size=\"iconSizeToAvatarSize[size]\" />\n    <template v-else-if=\"initials\">{{ initials }}</template>\n    <template v-else-if=\"image\">\n      <img :src=\"image\" :alt=\"alt ?? ''\" />\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../../PvCounterBadge/PvCounterBadge.vue\";\nimport PvCompanyLogo from \"../../PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvAvatar from \"../../PvAvatar/PvAvatar.vue\";\nimport PvTooltip from \"../../PvTooltip/PvTooltip.vue\";\nimport { computed } from \"vue\";\nimport type { PvAvatarSize } from \"@/components/base/PvAvatar/types\";\nimport type { PvIconSize } from \"@/components/base/baseProps\";\nimport { pvButtonSizeToClass, supportedInverseButtonVariants } from \"@/components/base/PvButton/helpers.ts\";\nimport type { PvSelectButtonTriggerProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvSelectButtonTriggerProps>(), {\n  size: \"lg\",\n  variant: \"secondary\",\n  showDropdown: true,\n  counterStyle: \"primary\",\n});\n\ndefineEmits<{\n  (e: \"handle-clear\"): void;\n}>();\n\nconst classes = computed(() => {\n  const output = [\"pv-select-button-trigger\", \"pv-flex\", \"pv-space-between\", \"pv-full-width\"];\n  if (props.inverse && supportedInverseButtonVariants.includes(props.variant)) {\n    output.push(`pv-button-${props.variant}-inverse`);\n  } else {\n    output.push(`pv-button-${props.variant}`);\n  }\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n\nconst avatarSize = computed<PvAvatarSize>(() => (props.size === \"xl\" ? \"lg\" : \"sm\"));\nconst iconSize = computed<PvIconSize>(() => (props.size === \"xl\" ? 20 : undefined));\n\nconst labelValue = computed(() => {\n  if (props.isLoading) {\n    return \"Loading...\";\n  }\n\n  if (props.selectedItems && props.selectedItems.length > 0 && props.counterStyle === \"secondary\") {\n    return props.selectedItems[0].text;\n  }\n\n  return props.label;\n});\n\nconst rendererProps = computed(() => {\n  if (!props.selectedOption) return undefined;\n\n  return {\n    ...props.selectedOption,\n    menuOptionConfig: props.menuOptionConfig,\n    queryText: null,\n    selected: true,\n  };\n});\n</script>\n\n<template>\n  <button\n    data-testid=\"pv-multi-select-button-trigger\"\n    :class=\"classes\"\n    style=\"--flex-gap: 0.25rem\"\n    :disabled=\"disabled || isLoading\"\n  >\n    <div class=\"pv-flex pv-select-button-trigger-content\">\n      <p\n        data-testid=\"pv-select-prefix-label\"\n        v-if=\"prefixLabel\"\n        class=\"pv-border-right pv-text-quaternary\"\n        style=\"padding-right: 4px\"\n      >\n        {{ prefixLabel }}\n      </p>\n      <PvCounterBadge\n        v-if=\"counterPosition === 'left' && counterValue && counterStyle === 'primary'\"\n        data-testid=\"pv-multi-select-left-counter-badge\"\n        :value=\"counterValue\"\n        :variant=\"counterBadgeVariant\"\n        size=\"sm\"\n      />\n      <template v-if=\"!isLoading && renderer && rendererProps\">\n        <component :is=\"renderer\" v-bind=\"rendererProps\" />\n      </template>\n      <template v-else>\n        <PvIcon v-if=\"icon\" data-testid=\"pv-multi-select-button-icon\" :name=\"icon\" :size=\"iconSize\" />\n        <PvCompanyLogo v-if=\"companyLogo\" :name=\"companyLogo\" size=\"sm\" />\n        <PvAvatar\n          v-if=\"avatar\"\n          class=\"pv-select-button-trigger-avatar\"\n          data-testid=\"pv-multi-select-button-avatar\"\n          :initials=\"avatar.initials\"\n          :image=\"avatar.image\"\n          :variant=\"avatar.variant\"\n          :shape=\"avatar.shape\"\n          :size=\"avatarSize\"\n        />\n        <span\n          v-if=\"isLoading || label\"\n          class=\"pv-text-body-md pv-text-regular pv-truncate pv-select-button-trigger-label\"\n          :title=\"labelValue\"\n        >\n          {{ labelValue }}\n        </span>\n      </template>\n      <PvCounterBadge\n        v-if=\"counterPosition === 'right' && counterValue && counterStyle === 'primary'\"\n        data-testid=\"pv-multi-select-right-counter-badge\"\n        :value=\"counterValue\"\n        :variant=\"counterBadgeVariant\"\n        size=\"sm\"\n      />\n      <PvCounterBadge\n        v-if=\"counterStyle === 'secondary' && (counterValue ?? 0) >= 2\"\n        data-testid=\"pv-multi-select-secondary-counter-badge\"\n        prefix=\"+\"\n        :value=\"(counterValue ?? 0) - 1\"\n        variant=\"tertiary\"\n        size=\"sm\"\n      />\n    </div>\n\n    <PvIcon v-if=\"showDropdown\" :name=\"open ? 'chevron-up' : 'chevron-down'\" />\n    <PvTooltip v-if=\"showClear\" size=\"sm\" variant=\"dark\" tooltip-position=\"top-left\">\n      <template #label>\n        <PvIcon name=\"close\" @click.stop=\"$emit('handle-clear')\" />\n      </template>\n      <template #tooltip-content> Clear Selections </template>\n    </PvTooltip>\n  </button>\n</template>\n\n<style scoped>\n/* Allow the label to truncate with an ellipsis instead of overflowing the\n   trigger when the selected option's text is wider than the button. The flex\n   wrapper and label both need min-width: 0 so the label can shrink below its\n   intrinsic content width. */\n.pv-select-button-trigger-content {\n  min-width: 0;\n}\n\n.pv-select-button-trigger {\n  height: 1.5rem;\n  padding-block: 0;\n}\n\n.pv-select-button-trigger.pv-button-large {\n  height: 2rem;\n}\n\n.pv-select-button-trigger-label {\n  min-width: 0;\n  flex: 1 1 auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../../PvIcon/PvIcon.vue\";\nimport PvCounterBadge from \"../../PvCounterBadge/PvCounterBadge.vue\";\nimport PvCompanyLogo from \"../../PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvAvatar from \"../../PvAvatar/PvAvatar.vue\";\nimport PvTooltip from \"../../PvTooltip/PvTooltip.vue\";\nimport { computed } from \"vue\";\nimport type { PvAvatarSize } from \"@/components/base/PvAvatar/types\";\nimport type { PvIconSize } from \"@/components/base/baseProps\";\nimport { pvButtonSizeToClass, supportedInverseButtonVariants } from \"@/components/base/PvButton/helpers.ts\";\nimport type { PvSelectButtonTriggerProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvSelectButtonTriggerProps>(), {\n  size: \"lg\",\n  variant: \"secondary\",\n  showDropdown: true,\n  counterStyle: \"primary\",\n});\n\ndefineEmits<{\n  (e: \"handle-clear\"): void;\n}>();\n\nconst classes = computed(() => {\n  const output = [\"pv-select-button-trigger\", \"pv-flex\", \"pv-space-between\", \"pv-full-width\"];\n  if (props.inverse && supportedInverseButtonVariants.includes(props.variant)) {\n    output.push(`pv-button-${props.variant}-inverse`);\n  } else {\n    output.push(`pv-button-${props.variant}`);\n  }\n  const sizeClass = pvButtonSizeToClass(props.size);\n  if (sizeClass) {\n    output.push(sizeClass);\n  }\n  return output;\n});\n\nconst avatarSize = computed<PvAvatarSize>(() => (props.size === \"xl\" ? \"lg\" : \"sm\"));\nconst iconSize = computed<PvIconSize>(() => (props.size === \"xl\" ? 20 : undefined));\n\nconst labelValue = computed(() => {\n  if (props.isLoading) {\n    return \"Loading...\";\n  }\n\n  if (props.selectedItems && props.selectedItems.length > 0 && props.counterStyle === \"secondary\") {\n    return props.selectedItems[0].text;\n  }\n\n  return props.label;\n});\n\nconst rendererProps = computed(() => {\n  if (!props.selectedOption) return undefined;\n\n  return {\n    ...props.selectedOption,\n    menuOptionConfig: props.menuOptionConfig,\n    queryText: null,\n    selected: true,\n  };\n});\n</script>\n\n<template>\n  <button\n    data-testid=\"pv-multi-select-button-trigger\"\n    :class=\"classes\"\n    style=\"--flex-gap: 0.25rem\"\n    :disabled=\"disabled || isLoading\"\n  >\n    <div class=\"pv-flex pv-select-button-trigger-content\">\n      <p\n        data-testid=\"pv-select-prefix-label\"\n        v-if=\"prefixLabel\"\n        class=\"pv-border-right pv-text-quaternary\"\n        style=\"padding-right: 4px\"\n      >\n        {{ prefixLabel }}\n      </p>\n      <PvCounterBadge\n        v-if=\"counterPosition === 'left' && counterValue && counterStyle === 'primary'\"\n        data-testid=\"pv-multi-select-left-counter-badge\"\n        :value=\"counterValue\"\n        :variant=\"counterBadgeVariant\"\n        size=\"sm\"\n      />\n      <template v-if=\"!isLoading && renderer && rendererProps\">\n        <component :is=\"renderer\" v-bind=\"rendererProps\" />\n      </template>\n      <template v-else>\n        <PvIcon v-if=\"icon\" data-testid=\"pv-multi-select-button-icon\" :name=\"icon\" :size=\"iconSize\" />\n        <PvCompanyLogo v-if=\"companyLogo\" :name=\"companyLogo\" size=\"sm\" />\n        <PvAvatar\n          v-if=\"avatar\"\n          class=\"pv-select-button-trigger-avatar\"\n          data-testid=\"pv-multi-select-button-avatar\"\n          :initials=\"avatar.initials\"\n          :image=\"avatar.image\"\n          :variant=\"avatar.variant\"\n          :shape=\"avatar.shape\"\n          :size=\"avatarSize\"\n        />\n        <span\n          v-if=\"isLoading || label\"\n          class=\"pv-text-body-md pv-text-regular pv-truncate pv-select-button-trigger-label\"\n          :title=\"labelValue\"\n        >\n          {{ labelValue }}\n        </span>\n      </template>\n      <PvCounterBadge\n        v-if=\"counterPosition === 'right' && counterValue && counterStyle === 'primary'\"\n        data-testid=\"pv-multi-select-right-counter-badge\"\n        :value=\"counterValue\"\n        :variant=\"counterBadgeVariant\"\n        size=\"sm\"\n      />\n      <PvCounterBadge\n        v-if=\"counterStyle === 'secondary' && (counterValue ?? 0) >= 2\"\n        data-testid=\"pv-multi-select-secondary-counter-badge\"\n        prefix=\"+\"\n        :value=\"(counterValue ?? 0) - 1\"\n        variant=\"tertiary\"\n        size=\"sm\"\n      />\n    </div>\n\n    <PvIcon v-if=\"showDropdown\" :name=\"open ? 'chevron-up' : 'chevron-down'\" />\n    <PvTooltip v-if=\"showClear\" size=\"sm\" variant=\"dark\" tooltip-position=\"top-left\">\n      <template #label>\n        <PvIcon name=\"close\" @click.stop=\"$emit('handle-clear')\" />\n      </template>\n      <template #tooltip-content> Clear Selections </template>\n    </PvTooltip>\n  </button>\n</template>\n\n<style scoped>\n/* Allow the label to truncate with an ellipsis instead of overflowing the\n   trigger when the selected option's text is wider than the button. The flex\n   wrapper and label both need min-width: 0 so the label can shrink below its\n   intrinsic content width. */\n.pv-select-button-trigger-content {\n  min-width: 0;\n}\n\n.pv-select-button-trigger {\n  height: 1.5rem;\n  padding-block: 0;\n}\n\n.pv-select-button-trigger.pv-button-large {\n  height: 2rem;\n}\n\n.pv-select-button-trigger-label {\n  min-width: 0;\n  flex: 1 1 auto;\n}\n</style>\n","<template>\n  <div class=\"pv-text-subdued pv-text-center pv-text-body-md pv-inset-square-12\">No Results Found</div>\n</template>\n","import type { MenuOption, MultiSelectState } from \"@/types\";\n\n/**\n * Returns true when an option has children, whether they are already loaded or\n * only represented by the server-provided `totalChildCount` for lazy-loading.\n * Fully loaded children still count as cascade children — this helper answers\n * \"is this a parent?\", not \"are there more children to load?\".\n */\nexport function hasCascadeChildren<T>(option: MenuOption<T>): boolean {\n  return !!option.children?.length || (option.totalChildCount ?? 0) > 0;\n}\n\n/** Recursively collect all leaf (childless) options from a tree. */\nexport function collectLeafOptions<T>(options: MenuOption<T>[]): MenuOption<T>[] {\n  return options.flatMap((option) => {\n    if (option.children?.length) return collectLeafOptions(option.children);\n    return (option.totalChildCount ?? 0) > 0 ? [] : [option];\n  });\n}\n\n/**\n * Merge two sets of leaf options, deduplicating by ID.\n *\n * Returns a single array containing every leaf from `base`, plus any leaves\n * from `overlay` whose ID doesn't already appear in `base`. This is used to\n * combine original (unfiltered) leaves with dynamically loaded (see-more)\n * leaves so that the full set is available for selection / checked-state logic.\n */\nexport function mergeLeafOptions<T>(base: MenuOption<T>[], overlay: MenuOption<T>[]): MenuOption<T>[] {\n  const seenIds = new Set(base.map((l) => l.id));\n  const extras = overlay.filter((l) => !seenIds.has(l.id));\n  return extras.length > 0 ? [...base, ...extras] : base;\n}\n\n/**\n * Count selected items, collapsing fully-selected parents to 1.\n *\n * Walks the option tree bottom-up. A parent whose leaf descendants are ALL\n * selected counts as 1 (replacing the individual counts of its sub-tree).\n * Selected leaves not under a fully-selected parent each count as 1.\n *\n * This is order-independent — it walks the tree structure directly and does\n * not depend on Map iteration order.\n */\nexport function countWithCollapsedParents<T>(options: MenuOption<T>[], selectedIds: Set<string>): number {\n  const walk = (nodes: MenuOption<T>[]): { leafCount: number; selectedLeafCount: number; displayCount: number } => {\n    let leafCount = 0;\n    let selectedLeafCount = 0;\n    let displayCount = 0;\n\n    for (const node of nodes) {\n      if (node.children?.length) {\n        const sub = walk(node.children);\n        leafCount += sub.leafCount;\n        selectedLeafCount += sub.selectedLeafCount;\n        if (sub.leafCount > 0 && sub.leafCount === sub.selectedLeafCount) {\n          displayCount += 1;\n        } else {\n          displayCount += sub.displayCount;\n        }\n      } else {\n        leafCount += 1;\n        if (selectedIds.has(node.id)) {\n          selectedLeafCount += 1;\n          displayCount += 1;\n        }\n      }\n    }\n\n    return { leafCount, selectedLeafCount, displayCount };\n  };\n\n  return walk(options).displayCount;\n}\n\nexport function countFromSelectionState(state: MultiSelectState): number {\n  return state.filter((node) => node.state === \"selected\").length;\n}\n\n/**\n * Recursively filter a tree for a search value.\n *\n * - If a node's own text matches, it is kept with all its children intact.\n * - If a node's own text does NOT match but one or more of its descendants do,\n *   the node is kept as a container showing only the matching descendants.\n *   This means a search term that matches a child will surface that child even\n *   when the parent label itself doesn't contain the search term.\n * - Nodes with no match anywhere in their subtree are removed entirely.\n */\nexport function filterOptionsRecursive<T>(\n  options: MenuOption<T>[],\n  searchValue: string,\n  showParentOnChildQueryMatch = true,\n): MenuOption<T>[] {\n  return options.flatMap((option) => {\n    const selfMatches =\n      option.text.toLocaleLowerCase().includes(searchValue) ||\n      option.searchText?.toLocaleLowerCase().includes(searchValue);\n\n    if (selfMatches) return [option]; // keep with all children intact\n\n    if (option.children?.length) {\n      const filteredChildren = filterOptionsRecursive(option.children, searchValue, showParentOnChildQueryMatch);\n      if (filteredChildren.length) {\n        return showParentOnChildQueryMatch ? [{ ...option, children: filteredChildren }] : filteredChildren;\n      }\n    }\n\n    return [];\n  });\n}\n","<script setup lang=\"ts\">\nimport PvCompanyLogo from \"@/components/base/PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvAvatar from \"@/components/base/PvAvatar/PvAvatar.vue\";\nimport PvCounterBadge from \"@/components/base/PvCounterBadge/PvCounterBadge.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { PvAvatarSize } from \"@/components/base/PvAvatar/types\";\nimport type { PvIconSize } from \"@/components/base/baseProps\";\nimport type { MenuOption, MenuOptionConfig } from \"@/types.ts\";\nimport { computed, onMounted, ref, watch, type CSSProperties } from \"vue\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\ninterface PvMenuBaseItemProps extends MenuOption {\n  menuOptionConfig?: MenuOptionConfig;\n  queryText?: string | null;\n}\n\nconst props = defineProps<PvMenuBaseItemProps>();\n\nconst mainText = ref<HTMLElement | null>(null);\nconst subText = ref<HTMLElement | null>(null);\n\nconst avatarSize = computed<PvAvatarSize>(() => (props.menuOptionConfig?.size === \"lg\" ? \"sm\" : \"lg\"));\nconst iconSize = computed<PvIconSize>(() => (props.menuOptionConfig?.size === \"xl\" ? 20 : undefined));\nconst renderedSubText = computed(() => {\n  return props.subText || null;\n});\n// Wrapped text is fully visible, so it needs no hover title unless the consumer set one.\n// `anywhere` over `break-word`: both break a word only when it cannot fit, but only `anywhere` lets\n// this flex item shrink, so one long unbroken token wraps instead of widening the menu.\nconst WRAP_TEXT_STYLE: CSSProperties = { whiteSpace: \"normal\", overflowWrap: \"anywhere\" };\nconst wrapText = computed(() => !!props.menuOptionConfig?.wrapText);\nconst textStyle = computed<CSSProperties | undefined>(() => (wrapText.value ? WRAP_TEXT_STYLE : undefined));\n\nconst escapeRegex = (str: string): string => {\n  return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n\nconst getHighlightRanges = (originalText: string, searchQuery: string, explicitRanges?: [number, number][]) => {\n  let candidates = explicitRanges;\n  if (candidates === undefined) {\n    if (!searchQuery) return [];\n    const regex = new RegExp(escapeRegex(searchQuery), \"gi\");\n    candidates = Array.from(originalText.matchAll(regex), (match) => [match.index, match.index + match[0].length]);\n  }\n  if (!Array.isArray(candidates)) return [];\n\n  const splitsSurrogate = (index: number) =>\n    /[\\uD800-\\uDBFF]/.test(originalText[index - 1] ?? \"\") && /[\\uDC00-\\uDFFF]/.test(originalText[index] ?? \"\");\n  const ranges: [number, number][] = [];\n  const valid = candidates\n    .filter(\n      (range) =>\n        Array.isArray(range) &&\n        range.length === 2 &&\n        Number.isInteger(range[0]) &&\n        Number.isInteger(range[1]) &&\n        range[0] >= 0 &&\n        range[1] <= originalText.length &&\n        range[0] < range[1] &&\n        !splitsSurrogate(range[0]) &&\n        !splitsSurrogate(range[1]),\n    )\n    .sort((a, b) => a[0] - b[0]);\n  for (const [start, end] of valid) {\n    const previous = ranges[ranges.length - 1];\n    if (previous && start <= previous[1]) previous[1] = Math.max(previous[1], end);\n    else ranges.push([start, end]);\n  }\n  return ranges;\n};\n\n// Render consumer labels as text, never HTML.\nconst highlightText = (\n  element: HTMLElement,\n  originalText: string,\n  searchQuery: string,\n  explicitRanges?: [number, number][],\n) => {\n  const ranges = getHighlightRanges(originalText, searchQuery, explicitRanges);\n  const nodes: Node[] = [];\n  let lastIndex = 0;\n  for (const [start, end] of ranges) {\n    if (start > lastIndex) {\n      nodes.push(document.createTextNode(originalText.slice(lastIndex, start)));\n    }\n    const highlight = document.createElement(\"span\");\n    highlight.dataset.testId = \"pv-matched-text\";\n    highlight.style.fontWeight = \"bold\";\n    highlight.textContent = originalText.slice(start, end);\n    nodes.push(highlight);\n    lastIndex = end;\n  }\n  if (lastIndex < originalText.length) {\n    nodes.push(document.createTextNode(originalText.slice(lastIndex)));\n  }\n  element.replaceChildren(...nodes);\n};\n\nconst applyHighlight = () => {\n  const query = props.queryText ?? \"\";\n  const mainTextMatches = query && new RegExp(escapeRegex(query), \"gi\").test(props.text);\n  if (mainText.value) {\n    highlightText(mainText.value, props.text, query, props.textMatchRanges);\n  }\n  if (subText.value && renderedSubText.value) {\n    // Each line owns its explicit ranges; unset subtext ranges keep the main-text-first fallback.\n    highlightText(subText.value, renderedSubText.value, mainTextMatches ? \"\" : query, props.subTextMatchRanges);\n  }\n};\n\nonMounted(() => {\n  applyHighlight();\n});\n\n// text and subText are watched alongside queryText: the highlight is written into the DOM\n// imperatively, so a text change that reuses the same component instance would otherwise\n// leave Vue's plain interpolation in place with no highlight. flush: \"post\" runs this after\n// that interpolation has been patched in, rather than before it overwrites the highlight.\nwatch(\n  () => [props.queryText, props.text, props.subText, props.textMatchRanges, props.subTextMatchRanges],\n  () => {\n    applyHighlight();\n  },\n  { flush: \"post\", deep: true },\n);\n</script>\n\n<template>\n  <PvAvatar\n    v-if=\"avatar\"\n    :initials=\"avatar.initials\"\n    :image=\"avatar.image\"\n    :variant=\"avatar.variant\"\n    :shape=\"avatar.shape\"\n    :size=\"avatarSize\"\n  />\n  <PvIcon :class=\"{ 'pv-text-subdued': !disabled }\" v-if=\"icon\" :name=\"icon\" :size=\"iconSize\" />\n  <PvCompanyLogo v-if=\"companyName\" :name=\"companyName\" size=\"sm\" />\n  <div\n    :class=\"['pv-full-width', 'pv-flex-vertical', { 'pv-truncate': !wrapText }]\"\n    style=\"align-items: flex-start; --flex-gap: 0\"\n  >\n    <span\n      :class=\"['pv-text-body-md', 'pv-full-width', { 'pv-truncate': !wrapText }]\"\n      :style=\"textStyle\"\n      :title=\"hoverTitle ?? (wrapText ? undefined : text)\"\n    >\n      <span ref=\"mainText\">{{ text }}</span>\n      <span v-if=\"subduedText\" :class=\"{ 'pv-text-subdued': !disabled }\" style=\"padding-left: 4px\">\n        {{ subduedText }}\n      </span>\n    </span>\n    <span\n      ref=\"subText\"\n      v-if=\"renderedSubText\"\n      :class=\"['pv-text-body-xs', 'pv-full-width', { 'pv-truncate': !wrapText, 'pv-text-subdued': !disabled }]\"\n      :style=\"textStyle\"\n      :title=\"hoverTitle ?? (wrapText ? undefined : renderedSubText)\"\n    >\n      {{ renderedSubText }}\n    </span>\n  </div>\n  <PvSpinner v-if=\"secondaryLoading\" size=\"xs\" variant=\"dark\" />\n  <PvIcon v-else-if=\"secondaryIcon\" :class=\"{ 'pv-text-subdued': !disabled }\" :name=\"secondaryIcon\" :size=\"iconSize\" />\n  <PvTooltipV2\n    v-else-if=\"description\"\n    variant=\"dark\"\n    position=\"top-center\"\n    :useTeleport=\"true\"\n    :showOnHover=\"true\"\n    :disableInteractive=\"true\"\n    style=\"pointer-events: auto\"\n  >\n    <template #trigger>\n      <!-- stop the click so reading the description doesn't also toggle the option -->\n      <PvIcon :size=\"12\" name=\"info-circle\" class=\"pv-text-subdued\" @click.stop.prevent />\n    </template>\n    <template #content>\n      <div style=\"max-width: 220px; white-space: normal; overflow-wrap: break-word\">{{ description }}</div>\n    </template>\n  </PvTooltipV2>\n  <PvCounterBadge\n    v-else-if=\"secondaryText && typeof secondaryText === 'number'\"\n    :value=\"secondaryText\"\n    :variant=\"menuOptionConfig?.counterBadgeVariant\"\n  />\n  <span v-else-if=\"secondaryText && typeof secondaryText === 'string'\" class=\"pv-text-subdued pv-text-body-xs\">{{\n    secondaryText\n  }}</span>\n</template>\n","<script setup lang=\"ts\">\nimport PvCompanyLogo from \"@/components/base/PvCompanyLogo/PvCompanyLogo.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvAvatar from \"@/components/base/PvAvatar/PvAvatar.vue\";\nimport PvCounterBadge from \"@/components/base/PvCounterBadge/PvCounterBadge.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { PvAvatarSize } from \"@/components/base/PvAvatar/types\";\nimport type { PvIconSize } from \"@/components/base/baseProps\";\nimport type { MenuOption, MenuOptionConfig } from \"@/types.ts\";\nimport { computed, onMounted, ref, watch, type CSSProperties } from \"vue\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\ninterface PvMenuBaseItemProps extends MenuOption {\n  menuOptionConfig?: MenuOptionConfig;\n  queryText?: string | null;\n}\n\nconst props = defineProps<PvMenuBaseItemProps>();\n\nconst mainText = ref<HTMLElement | null>(null);\nconst subText = ref<HTMLElement | null>(null);\n\nconst avatarSize = computed<PvAvatarSize>(() => (props.menuOptionConfig?.size === \"lg\" ? \"sm\" : \"lg\"));\nconst iconSize = computed<PvIconSize>(() => (props.menuOptionConfig?.size === \"xl\" ? 20 : undefined));\nconst renderedSubText = computed(() => {\n  return props.subText || null;\n});\n// Wrapped text is fully visible, so it needs no hover title unless the consumer set one.\n// `anywhere` over `break-word`: both break a word only when it cannot fit, but only `anywhere` lets\n// this flex item shrink, so one long unbroken token wraps instead of widening the menu.\nconst WRAP_TEXT_STYLE: CSSProperties = { whiteSpace: \"normal\", overflowWrap: \"anywhere\" };\nconst wrapText = computed(() => !!props.menuOptionConfig?.wrapText);\nconst textStyle = computed<CSSProperties | undefined>(() => (wrapText.value ? WRAP_TEXT_STYLE : undefined));\n\nconst escapeRegex = (str: string): string => {\n  return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n};\n\nconst getHighlightRanges = (originalText: string, searchQuery: string, explicitRanges?: [number, number][]) => {\n  let candidates = explicitRanges;\n  if (candidates === undefined) {\n    if (!searchQuery) return [];\n    const regex = new RegExp(escapeRegex(searchQuery), \"gi\");\n    candidates = Array.from(originalText.matchAll(regex), (match) => [match.index, match.index + match[0].length]);\n  }\n  if (!Array.isArray(candidates)) return [];\n\n  const splitsSurrogate = (index: number) =>\n    /[\\uD800-\\uDBFF]/.test(originalText[index - 1] ?? \"\") && /[\\uDC00-\\uDFFF]/.test(originalText[index] ?? \"\");\n  const ranges: [number, number][] = [];\n  const valid = candidates\n    .filter(\n      (range) =>\n        Array.isArray(range) &&\n        range.length === 2 &&\n        Number.isInteger(range[0]) &&\n        Number.isInteger(range[1]) &&\n        range[0] >= 0 &&\n        range[1] <= originalText.length &&\n        range[0] < range[1] &&\n        !splitsSurrogate(range[0]) &&\n        !splitsSurrogate(range[1]),\n    )\n    .sort((a, b) => a[0] - b[0]);\n  for (const [start, end] of valid) {\n    const previous = ranges[ranges.length - 1];\n    if (previous && start <= previous[1]) previous[1] = Math.max(previous[1], end);\n    else ranges.push([start, end]);\n  }\n  return ranges;\n};\n\n// Render consumer labels as text, never HTML.\nconst highlightText = (\n  element: HTMLElement,\n  originalText: string,\n  searchQuery: string,\n  explicitRanges?: [number, number][],\n) => {\n  const ranges = getHighlightRanges(originalText, searchQuery, explicitRanges);\n  const nodes: Node[] = [];\n  let lastIndex = 0;\n  for (const [start, end] of ranges) {\n    if (start > lastIndex) {\n      nodes.push(document.createTextNode(originalText.slice(lastIndex, start)));\n    }\n    const highlight = document.createElement(\"span\");\n    highlight.dataset.testId = \"pv-matched-text\";\n    highlight.style.fontWeight = \"bold\";\n    highlight.textContent = originalText.slice(start, end);\n    nodes.push(highlight);\n    lastIndex = end;\n  }\n  if (lastIndex < originalText.length) {\n    nodes.push(document.createTextNode(originalText.slice(lastIndex)));\n  }\n  element.replaceChildren(...nodes);\n};\n\nconst applyHighlight = () => {\n  const query = props.queryText ?? \"\";\n  const mainTextMatches = query && new RegExp(escapeRegex(query), \"gi\").test(props.text);\n  if (mainText.value) {\n    highlightText(mainText.value, props.text, query, props.textMatchRanges);\n  }\n  if (subText.value && renderedSubText.value) {\n    // Each line owns its explicit ranges; unset subtext ranges keep the main-text-first fallback.\n    highlightText(subText.value, renderedSubText.value, mainTextMatches ? \"\" : query, props.subTextMatchRanges);\n  }\n};\n\nonMounted(() => {\n  applyHighlight();\n});\n\n// text and subText are watched alongside queryText: the highlight is written into the DOM\n// imperatively, so a text change that reuses the same component instance would otherwise\n// leave Vue's plain interpolation in place with no highlight. flush: \"post\" runs this after\n// that interpolation has been patched in, rather than before it overwrites the highlight.\nwatch(\n  () => [props.queryText, props.text, props.subText, props.textMatchRanges, props.subTextMatchRanges],\n  () => {\n    applyHighlight();\n  },\n  { flush: \"post\", deep: true },\n);\n</script>\n\n<template>\n  <PvAvatar\n    v-if=\"avatar\"\n    :initials=\"avatar.initials\"\n    :image=\"avatar.image\"\n    :variant=\"avatar.variant\"\n    :shape=\"avatar.shape\"\n    :size=\"avatarSize\"\n  />\n  <PvIcon :class=\"{ 'pv-text-subdued': !disabled }\" v-if=\"icon\" :name=\"icon\" :size=\"iconSize\" />\n  <PvCompanyLogo v-if=\"companyName\" :name=\"companyName\" size=\"sm\" />\n  <div\n    :class=\"['pv-full-width', 'pv-flex-vertical', { 'pv-truncate': !wrapText }]\"\n    style=\"align-items: flex-start; --flex-gap: 0\"\n  >\n    <span\n      :class=\"['pv-text-body-md', 'pv-full-width', { 'pv-truncate': !wrapText }]\"\n      :style=\"textStyle\"\n      :title=\"hoverTitle ?? (wrapText ? undefined : text)\"\n    >\n      <span ref=\"mainText\">{{ text }}</span>\n      <span v-if=\"subduedText\" :class=\"{ 'pv-text-subdued': !disabled }\" style=\"padding-left: 4px\">\n        {{ subduedText }}\n      </span>\n    </span>\n    <span\n      ref=\"subText\"\n      v-if=\"renderedSubText\"\n      :class=\"['pv-text-body-xs', 'pv-full-width', { 'pv-truncate': !wrapText, 'pv-text-subdued': !disabled }]\"\n      :style=\"textStyle\"\n      :title=\"hoverTitle ?? (wrapText ? undefined : renderedSubText)\"\n    >\n      {{ renderedSubText }}\n    </span>\n  </div>\n  <PvSpinner v-if=\"secondaryLoading\" size=\"xs\" variant=\"dark\" />\n  <PvIcon v-else-if=\"secondaryIcon\" :class=\"{ 'pv-text-subdued': !disabled }\" :name=\"secondaryIcon\" :size=\"iconSize\" />\n  <PvTooltipV2\n    v-else-if=\"description\"\n    variant=\"dark\"\n    position=\"top-center\"\n    :useTeleport=\"true\"\n    :showOnHover=\"true\"\n    :disableInteractive=\"true\"\n    style=\"pointer-events: auto\"\n  >\n    <template #trigger>\n      <!-- stop the click so reading the description doesn't also toggle the option -->\n      <PvIcon :size=\"12\" name=\"info-circle\" class=\"pv-text-subdued\" @click.stop.prevent />\n    </template>\n    <template #content>\n      <div style=\"max-width: 220px; white-space: normal; overflow-wrap: break-word\">{{ description }}</div>\n    </template>\n  </PvTooltipV2>\n  <PvCounterBadge\n    v-else-if=\"secondaryText && typeof secondaryText === 'number'\"\n    :value=\"secondaryText\"\n    :variant=\"menuOptionConfig?.counterBadgeVariant\"\n  />\n  <span v-else-if=\"secondaryText && typeof secondaryText === 'string'\" class=\"pv-text-subdued pv-text-body-xs\">{{\n    secondaryText\n  }}</span>\n</template>\n","<script setup lang=\"ts\">\nimport { useId } from \"vue\";\nimport { PvSwitchSize } from \"./types\";\n\ninterface PvSwitchProps {\n  /**\n   * The visual size of the switch track and thumb.\n   */\n  size?: PvSwitchSize;\n  /** Optional text label displayed next to the switch. */\n  label?: string;\n  /** Accessible name for the switch when no visible label is provided. */\n  ariaLabel?: string;\n  /** When true, the switch is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** HTML id for the underlying checkbox input. Auto-generated when omitted. */\n  id?: string;\n  /**\n   * When true, hides the checkmark icon inside the switch thumb.\n   */\n  hideCheckIcon?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvSwitchProps>(), {\n  size: \"md\",\n  disabled: false,\n  hideCheckIcon: false,\n});\n\nconst inputId = props.id ?? useId();\n\nconst value = defineModel<boolean>({ required: true });\n</script>\n\n<template>\n  <label\n    :for=\"inputId\"\n    :class=\"[\n      'pv-label pv-switch pv-label-hover',\n      {\n        'pv-input-small': size === 'md',\n        'pv-input-xsmall': size === 'sm',\n        'pv-switch-hide-check': hideCheckIcon,\n      },\n    ]\"\n  >\n    <span v-if=\"label\">{{ label }}</span>\n    <input v-model=\"value\" :disabled=\"disabled\" :aria-label=\"ariaLabel\" type=\"checkbox\" role=\"switch\" :id=\"inputId\" />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { useId } from \"vue\";\nimport { PvSwitchSize } from \"./types\";\n\ninterface PvSwitchProps {\n  /**\n   * The visual size of the switch track and thumb.\n   */\n  size?: PvSwitchSize;\n  /** Optional text label displayed next to the switch. */\n  label?: string;\n  /** Accessible name for the switch when no visible label is provided. */\n  ariaLabel?: string;\n  /** When true, the switch is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** HTML id for the underlying checkbox input. Auto-generated when omitted. */\n  id?: string;\n  /**\n   * When true, hides the checkmark icon inside the switch thumb.\n   */\n  hideCheckIcon?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvSwitchProps>(), {\n  size: \"md\",\n  disabled: false,\n  hideCheckIcon: false,\n});\n\nconst inputId = props.id ?? useId();\n\nconst value = defineModel<boolean>({ required: true });\n</script>\n\n<template>\n  <label\n    :for=\"inputId\"\n    :class=\"[\n      'pv-label pv-switch pv-label-hover',\n      {\n        'pv-input-small': size === 'md',\n        'pv-input-xsmall': size === 'sm',\n        'pv-switch-hide-check': hideCheckIcon,\n      },\n    ]\"\n  >\n    <span v-if=\"label\">{{ label }}</span>\n    <input v-model=\"value\" :disabled=\"disabled\" :aria-label=\"ariaLabel\" type=\"checkbox\" role=\"switch\" :id=\"inputId\" />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { MenuAction, MenuOption } from \"@/types\";\nimport PvActionButton from \"@/components/base/PvActionButton/PvActionButton.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\n\ninterface PvMenuItemActionProps {\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  action: MenuAction<any>;\n  option: MenuOption;\n  disabled?: boolean;\n}\n\nconst props = defineProps<PvMenuItemActionProps>();\n\nconst actionIcon = computed(() => {\n  return typeof props.action.icon === \"function\" ? props.action.icon(props.option) : props.action.icon;\n});\n\nconst actionDisabled = computed(() => {\n  const disabled =\n    typeof props.action.isDisabled === \"function\" ? props.action.isDisabled(props.option) : props.action.isDisabled;\n  return props.disabled || (disabled ?? false) || !props.action.action;\n});\n\nconst actionTooltip = computed(() => {\n  return typeof props.action.tooltipText === \"function\"\n    ? props.action.tooltipText(props.option)\n    : props.action.tooltipText;\n});\n\nconst actionInteractive = computed(() => {\n  const interactive =\n    typeof props.action.interactive === \"function\" ? props.action.interactive(props.option) : props.action.interactive;\n  return interactive ?? true;\n});\n\nconst alwaysShow = computed(() => {\n  return typeof props.action.alwaysShow === \"function\"\n    ? props.action.alwaysShow(props.option)\n    : props.action.alwaysShow;\n});\n\nconst handleActionClick = () => {\n  if (actionInteractive.value && !actionDisabled.value) {\n    props.action.action?.(props.option);\n  }\n};\n</script>\n\n<template>\n  <PvActionButton\n    v-if=\"actionInteractive\"\n    :icon=\"actionIcon\"\n    :tooltip-text=\"actionTooltip ?? ''\"\n    :disabled=\"actionDisabled\"\n    :always-show=\"!!alwaysShow\"\n    @click=\"handleActionClick\"\n    size=\"sm\"\n  />\n  <!-- Non-interactive actions render as an informational icon rather than a button. -->\n  <PvTooltipV2 v-else :disable-interactive=\"true\" :use-teleport=\"true\">\n    <template #trigger>\n      <!-- Stop propagation so the icon does not toggle the surrounding menu item's selection. -->\n      <span\n        class=\"pv-text-brand\"\n        :class=\"{ 'pv-action-button-reveal-on-hover': !alwaysShow }\"\n        role=\"img\"\n        :aria-label=\"actionTooltip\"\n        @click.stop\n      >\n        <PvIcon :name=\"actionIcon\" />\n      </span>\n    </template>\n    <template #content v-if=\"actionTooltip\">\n      {{ actionTooltip }}\n    </template>\n  </PvTooltipV2>\n</template>\n\n<!-- Not scoped: the reveal class lives on PvActionButton's inner button, which is outside this component's style scope. -->\n<style>\n.pv-action-button-reveal-on-hover {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n\n.pv-label:hover .pv-action-button-reveal-on-hover {\n  opacity: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { MenuAction, MenuOption } from \"@/types\";\nimport PvActionButton from \"@/components/base/PvActionButton/PvActionButton.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\n\ninterface PvMenuItemActionProps {\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  action: MenuAction<any>;\n  option: MenuOption;\n  disabled?: boolean;\n}\n\nconst props = defineProps<PvMenuItemActionProps>();\n\nconst actionIcon = computed(() => {\n  return typeof props.action.icon === \"function\" ? props.action.icon(props.option) : props.action.icon;\n});\n\nconst actionDisabled = computed(() => {\n  const disabled =\n    typeof props.action.isDisabled === \"function\" ? props.action.isDisabled(props.option) : props.action.isDisabled;\n  return props.disabled || (disabled ?? false) || !props.action.action;\n});\n\nconst actionTooltip = computed(() => {\n  return typeof props.action.tooltipText === \"function\"\n    ? props.action.tooltipText(props.option)\n    : props.action.tooltipText;\n});\n\nconst actionInteractive = computed(() => {\n  const interactive =\n    typeof props.action.interactive === \"function\" ? props.action.interactive(props.option) : props.action.interactive;\n  return interactive ?? true;\n});\n\nconst alwaysShow = computed(() => {\n  return typeof props.action.alwaysShow === \"function\"\n    ? props.action.alwaysShow(props.option)\n    : props.action.alwaysShow;\n});\n\nconst handleActionClick = () => {\n  if (actionInteractive.value && !actionDisabled.value) {\n    props.action.action?.(props.option);\n  }\n};\n</script>\n\n<template>\n  <PvActionButton\n    v-if=\"actionInteractive\"\n    :icon=\"actionIcon\"\n    :tooltip-text=\"actionTooltip ?? ''\"\n    :disabled=\"actionDisabled\"\n    :always-show=\"!!alwaysShow\"\n    @click=\"handleActionClick\"\n    size=\"sm\"\n  />\n  <!-- Non-interactive actions render as an informational icon rather than a button. -->\n  <PvTooltipV2 v-else :disable-interactive=\"true\" :use-teleport=\"true\">\n    <template #trigger>\n      <!-- Stop propagation so the icon does not toggle the surrounding menu item's selection. -->\n      <span\n        class=\"pv-text-brand\"\n        :class=\"{ 'pv-action-button-reveal-on-hover': !alwaysShow }\"\n        role=\"img\"\n        :aria-label=\"actionTooltip\"\n        @click.stop\n      >\n        <PvIcon :name=\"actionIcon\" />\n      </span>\n    </template>\n    <template #content v-if=\"actionTooltip\">\n      {{ actionTooltip }}\n    </template>\n  </PvTooltipV2>\n</template>\n\n<!-- Not scoped: the reveal class lives on PvActionButton's inner button, which is outside this component's style scope. -->\n<style>\n.pv-action-button-reveal-on-hover {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n\n.pv-label:hover .pv-action-button-reveal-on-hover {\n  opacity: 1;\n}\n</style>\n","import type { ComputedRef, InjectionKey, Ref } from \"vue\";\nimport type { MenuOption } from \"@/types\";\n\nexport const SelectedItemsKey: InjectionKey<Ref<MenuOption[]>> = Symbol(\"SelectedItemsKey\");\nexport const EnableCascadeSelectionKey: InjectionKey<ComputedRef<boolean>> = Symbol(\"EnableCascadeSelectionKey\");\nexport const MenuInteractionModeKey: InjectionKey<ComputedRef<boolean>> = Symbol(\"MenuInteractionModeKey\");\nexport const MenuAncestorIdsKey: InjectionKey<string[]> = Symbol(\"MenuAncestorIdsKey\");\nexport const OriginalOptionsMapKey: InjectionKey<ComputedRef<Map<string, MenuOption>>> =\n  Symbol(\"OriginalOptionsMapKey\");\nexport const CascadeSelectedParentIdsKey: InjectionKey<Ref<Set<string>>> = Symbol(\"CascadeSelectedParentIdsKey\");\nexport const CascadeDeselectedChildIdsKey: InjectionKey<Ref<Map<string, Set<string>>>> =\n  Symbol(\"CascadeDeselectedChildIdsKey\");\nexport const ParentSelectsAllChildrenKey: InjectionKey<ComputedRef<boolean>> = Symbol(\"ParentSelectsAllChildrenKey\");\nexport const EnableChildExpansionKey: InjectionKey<ComputedRef<boolean>> = Symbol(\"EnableChildExpansionKey\");\n","<script lang=\"ts\" setup>\nimport { computed, getCurrentInstance, inject, nextTick, ref, useTemplateRef } from \"vue\";\n\nimport PvMenuBaseItem from \"@/components/base/PvMenu/items/PvMenuBaseItem.vue\";\nimport PvSwitch from \"@/components/base/PvSwitch/PvSwitch.vue\";\nimport { MenuOption, MenuOptionConfig, MenuOptionSelectedEvent } from \"@/types.ts\";\nimport PvMenuItemAction from \"@/components/base/PvMenu/items/PvMenuItemAction.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport { collectLeafOptions, hasCascadeChildren, mergeLeafOptions } from \"@/components/base/PvMenu/cascadeUtils\";\nimport {\n  SelectedItemsKey,\n  EnableCascadeSelectionKey,\n  OriginalOptionsMapKey,\n  CascadeSelectedParentIdsKey,\n  MenuInteractionModeKey,\n} from \"@/components/base/PvMenu/symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nexport interface PvMenuItemVariantProps extends MenuOption {\n  selected?: boolean;\n  indeterminate?: boolean;\n  queryText?: string | null;\n  highlightSearchText?: boolean;\n  menuOptionConfig?: MenuOptionConfig;\n  showChevron?: boolean;\n  chevronIcon?: string;\n  expanded?: boolean;\n}\n\nconst props = defineProps<PvMenuItemVariantProps>();\n\nconst inputRef = useTemplateRef<HTMLInputElement>(\"inputRef\");\n\nconst selectedItems = inject(SelectedItemsKey, undefined);\nconst enableCascadeSelection = inject(EnableCascadeSelectionKey, ref(false));\nconst originalOptionsMap = inject(OriginalOptionsMapKey, undefined);\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst menuInteractionMode = inject(\n  MenuInteractionModeKey,\n  computed(() => false),\n);\n\n// Resolve the effective leaf options for this parent node. Always use original\n// (unfiltered) children so the checked/indeterminate state reflects all children.\n// When children have been dynamically loaded (see-more), props.children may have\n// more entries than the original snapshot — use whichever is larger.\nconst effectiveLeafOptions = computed(() => {\n  if (!enableCascadeSelection.value || !hasCascadeChildren(props)) return [];\n  const currentLeaves = props.children ? collectLeafOptions(props.children) : [];\n  if (originalOptionsMap?.value) {\n    const originalOption = originalOptionsMap.value.get(props.id);\n    const originalLeaves = originalOption?.children ? collectLeafOptions(originalOption.children) : [];\n    return mergeLeafOptions(originalLeaves, currentLeaves);\n  }\n  return currentLeaves;\n});\n\nconst isChecked = computed(() => {\n  if (!selectedItems?.value) return props.selected ?? false;\n  if (enableCascadeSelection.value && hasCascadeChildren(props)) {\n    const leafOptions = effectiveLeafOptions.value;\n    const originalLeafCount = leafOptions.length;\n    const selectedCount = leafOptions.filter((lo) => selectedItems.value.some((item) => item.id === lo.id)).length;\n    // Parent was explicitly clicked and all loaded children are selected → checked\n    if (cascadeSelectedParentIds?.value?.has(props.id) && selectedCount >= originalLeafCount) {\n      return true;\n    }\n    const totalCount = props.totalChildCount ?? originalLeafCount;\n    return totalCount > 0 && selectedCount >= totalCount;\n  }\n  return selectedItems.value.some((item) => item.id === props.id);\n});\n\nconst isIndeterminate = computed(() => {\n  if (!selectedItems?.value || !enableCascadeSelection.value || !hasCascadeChildren(props)) {\n    return props.indeterminate ?? false;\n  }\n  const leafOptions = effectiveLeafOptions.value;\n  const originalLeafCount = leafOptions.length;\n  const selectedCount = leafOptions.filter((lo) => selectedItems.value.some((item) => item.id === lo.id)).length;\n  // Parent was explicitly clicked and all loaded children are selected → not indeterminate\n  if (cascadeSelectedParentIds?.value?.has(props.id) && selectedCount >= originalLeafCount) {\n    return false;\n  }\n  const totalCount = props.totalChildCount ?? originalLeafCount;\n  return selectedCount > 0 && selectedCount < totalCount;\n});\n\nconst computedClassList = computed(() => {\n  const classes = props.classList ? [...props.classList] : [];\n  if (props.disabled) {\n    classes.push(\"pv-menu-item-disabled\");\n  } else {\n    classes.push(\"pv-menu-item\");\n  }\n  return classes;\n});\n\nconst disabledStyle = computed(() => {\n  if (props.disabled && props.menuOptionConfig?.disabledVariant !== \"ghost\") {\n    return { background: \"var(--color-background-disabled, #ececec)\" };\n  }\n  return {};\n});\n\nconst computedOption = computed(() => {\n  // Exclude classList: Vue maps it to the `class` attr on fallthrough, overriding\n  // child components' own root classes.\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  const { classList: _classList, ...rest } = props;\n  const option: MenuOption = {\n    ...rest,\n    avatar: props.menuOptionConfig?.variant === \"avatar\" ? props.avatar : undefined,\n    icon: props.menuOptionConfig?.variant === \"icon\" ? props.icon : undefined,\n    companyName: props.menuOptionConfig?.variant === \"company\" ? props.companyName || props.text : undefined,\n  };\n  return option;\n});\n\nconst effectiveAction = computed(() => props.action ?? props.menuOptionConfig?.action);\n\nconst inputHidden = computed(() => {\n  const variant = props.menuOptionConfig?.variant;\n  return variant !== \"checkbox\" && variant !== \"radio\";\n});\n\n// we only show the input for checkbox and radio variants\nconst inputType = computed(() => {\n  return props.menuOptionConfig?.variant === \"radio\" ? \"radio\" : \"checkbox\";\n});\n\nconst inputName = `${inputType.value}-${getCurrentInstance()?.uid}`;\n\nconst inputClass = computed(() => {\n  return props.menuOptionConfig?.variant === \"checkbox\" ? \"pv-checkbox\" : \"pv-radio\";\n});\n\nconst dataTestId = computed(() => {\n  const type =\n    props.menuOptionConfig?.variant === \"checkbox\"\n      ? \"-checkbox\"\n      : props.menuOptionConfig?.variant === \"radio\"\n        ? \"-radio\"\n        : \"\";\n  return `pv-menu${type}-item`;\n});\n\nconst emits = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"toggle-expanded\"): void;\n}>();\n\nconst handleSelected = (event: Event) => {\n  if (props.disabled) {\n    return;\n  }\n  const option: MenuOption = {\n    ...props,\n  };\n  emits(\"handle-selected\", {\n    option,\n    event,\n  });\n  // After the reactive state settles, force-sync the DOM checked/indeterminate\n  // properties. Vue skips patching when the computed value doesn't change (e.g.\n  // indeterminate parent: isChecked was false before and is still false after\n  // deselecting all children), leaving the browser-toggled state stale.\n  nextTick(() => {\n    if (inputRef.value) {\n      inputRef.value.checked = isChecked.value;\n      inputRef.value.indeterminate = isIndeterminate.value;\n    }\n  });\n};\n\nconst handleMenuItemClick = (event: MouseEvent) => {\n  if (!menuInteractionMode.value) return;\n  const target = event.target as Element;\n  const interactiveTarget = target.closest(\n    \"a, button, input, select, textarea, [contenteditable], [role='button'], [role='checkbox'], [role='link'], [role='radio'], [role='switch']\",\n  );\n  if (interactiveTarget && interactiveTarget !== event.currentTarget && interactiveTarget !== inputRef.value) return;\n  event.preventDefault();\n  handleSelected(event);\n};\n</script>\n\n<template>\n  <label\n    v-bind=\"$attrs\"\n    class=\"pv-label pv-label-hover pv-flex pv-full-width pv-stack-4 pv-inset-square-8\"\n    :class=\"computedClassList\"\n    :style=\"[\n      disabledStyle,\n      { cursor: 'pointer', paddingTop: subText ? '4px' : undefined, paddingBottom: subText ? '4px' : undefined },\n    ]\"\n    :data-testid=\"dataTestId\"\n    @click=\"handleMenuItemClick\"\n  >\n    <input\n      ref=\"inputRef\"\n      :hidden=\"inputHidden\"\n      :type=\"inputType\"\n      :name=\"inputName\"\n      :checked=\"isChecked\"\n      :indeterminate=\"isIndeterminate\"\n      :class=\"inputClass\"\n      :tabindex=\"menuInteractionMode ? -1 : undefined\"\n      :aria-hidden=\"menuInteractionMode ? true : undefined\"\n      :disabled=\"disabled\"\n      @change=\"menuInteractionMode ? undefined : handleSelected($event)\"\n    />\n    <template v-if=\"menuOptionConfig?.renderer\">\n      <component :is=\"menuOptionConfig?.renderer\" v-bind=\"computedOption\" :selected=\"isChecked\" />\n    </template>\n    <template v-else>\n      <PvMenuBaseItem\n        v-bind=\"computedOption\"\n        :menuOptionConfig=\"menuOptionConfig\"\n        :queryText=\"queryText\"\n        :highlightSearchText=\"highlightSearchText\"\n      />\n    </template>\n    <PvIcon v-if=\"menuOptionConfig?.variant === 'checkmark' && isChecked\" name=\"check\" class=\"pv-text-success\" />\n    <PvSwitch\n      v-if=\"menuOptionConfig?.variant === 'toggle'\"\n      :modelValue=\"isChecked\"\n      :ariaLabel=\"props.text || 'Toggle'\"\n      size=\"sm\"\n      hideCheckIcon\n      style=\"pointer-events: none\"\n    />\n    <span v-if=\"effectiveAction\" class=\"pv-menu-item-action\">\n      <PvMenuItemAction :action=\"effectiveAction\" :option=\"props\" :disabled=\"disabled\" />\n    </span>\n    <button\n      v-if=\"showChevron\"\n      type=\"button\"\n      class=\"pv-button-ghost pv-menu-item-expand-chevron\"\n      :aria-label=\"props.text ? `Toggle children for ${props.text}` : 'Toggle children'\"\n      :aria-expanded=\"expanded\"\n      @click.prevent.stop=\"emits('toggle-expanded')\"\n    >\n      <PvIcon :name=\"chevronIcon ?? 'chevron-right'\" :size=\"12\" />\n    </button>\n  </label>\n</template>\n","<script lang=\"ts\" setup>\nimport { computed, getCurrentInstance, inject, nextTick, ref, useTemplateRef } from \"vue\";\n\nimport PvMenuBaseItem from \"@/components/base/PvMenu/items/PvMenuBaseItem.vue\";\nimport PvSwitch from \"@/components/base/PvSwitch/PvSwitch.vue\";\nimport { MenuOption, MenuOptionConfig, MenuOptionSelectedEvent } from \"@/types.ts\";\nimport PvMenuItemAction from \"@/components/base/PvMenu/items/PvMenuItemAction.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport { collectLeafOptions, hasCascadeChildren, mergeLeafOptions } from \"@/components/base/PvMenu/cascadeUtils\";\nimport {\n  SelectedItemsKey,\n  EnableCascadeSelectionKey,\n  OriginalOptionsMapKey,\n  CascadeSelectedParentIdsKey,\n  MenuInteractionModeKey,\n} from \"@/components/base/PvMenu/symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nexport interface PvMenuItemVariantProps extends MenuOption {\n  selected?: boolean;\n  indeterminate?: boolean;\n  queryText?: string | null;\n  highlightSearchText?: boolean;\n  menuOptionConfig?: MenuOptionConfig;\n  showChevron?: boolean;\n  chevronIcon?: string;\n  expanded?: boolean;\n}\n\nconst props = defineProps<PvMenuItemVariantProps>();\n\nconst inputRef = useTemplateRef<HTMLInputElement>(\"inputRef\");\n\nconst selectedItems = inject(SelectedItemsKey, undefined);\nconst enableCascadeSelection = inject(EnableCascadeSelectionKey, ref(false));\nconst originalOptionsMap = inject(OriginalOptionsMapKey, undefined);\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst menuInteractionMode = inject(\n  MenuInteractionModeKey,\n  computed(() => false),\n);\n\n// Resolve the effective leaf options for this parent node. Always use original\n// (unfiltered) children so the checked/indeterminate state reflects all children.\n// When children have been dynamically loaded (see-more), props.children may have\n// more entries than the original snapshot — use whichever is larger.\nconst effectiveLeafOptions = computed(() => {\n  if (!enableCascadeSelection.value || !hasCascadeChildren(props)) return [];\n  const currentLeaves = props.children ? collectLeafOptions(props.children) : [];\n  if (originalOptionsMap?.value) {\n    const originalOption = originalOptionsMap.value.get(props.id);\n    const originalLeaves = originalOption?.children ? collectLeafOptions(originalOption.children) : [];\n    return mergeLeafOptions(originalLeaves, currentLeaves);\n  }\n  return currentLeaves;\n});\n\nconst isChecked = computed(() => {\n  if (!selectedItems?.value) return props.selected ?? false;\n  if (enableCascadeSelection.value && hasCascadeChildren(props)) {\n    const leafOptions = effectiveLeafOptions.value;\n    const originalLeafCount = leafOptions.length;\n    const selectedCount = leafOptions.filter((lo) => selectedItems.value.some((item) => item.id === lo.id)).length;\n    // Parent was explicitly clicked and all loaded children are selected → checked\n    if (cascadeSelectedParentIds?.value?.has(props.id) && selectedCount >= originalLeafCount) {\n      return true;\n    }\n    const totalCount = props.totalChildCount ?? originalLeafCount;\n    return totalCount > 0 && selectedCount >= totalCount;\n  }\n  return selectedItems.value.some((item) => item.id === props.id);\n});\n\nconst isIndeterminate = computed(() => {\n  if (!selectedItems?.value || !enableCascadeSelection.value || !hasCascadeChildren(props)) {\n    return props.indeterminate ?? false;\n  }\n  const leafOptions = effectiveLeafOptions.value;\n  const originalLeafCount = leafOptions.length;\n  const selectedCount = leafOptions.filter((lo) => selectedItems.value.some((item) => item.id === lo.id)).length;\n  // Parent was explicitly clicked and all loaded children are selected → not indeterminate\n  if (cascadeSelectedParentIds?.value?.has(props.id) && selectedCount >= originalLeafCount) {\n    return false;\n  }\n  const totalCount = props.totalChildCount ?? originalLeafCount;\n  return selectedCount > 0 && selectedCount < totalCount;\n});\n\nconst computedClassList = computed(() => {\n  const classes = props.classList ? [...props.classList] : [];\n  if (props.disabled) {\n    classes.push(\"pv-menu-item-disabled\");\n  } else {\n    classes.push(\"pv-menu-item\");\n  }\n  return classes;\n});\n\nconst disabledStyle = computed(() => {\n  if (props.disabled && props.menuOptionConfig?.disabledVariant !== \"ghost\") {\n    return { background: \"var(--color-background-disabled, #ececec)\" };\n  }\n  return {};\n});\n\nconst computedOption = computed(() => {\n  // Exclude classList: Vue maps it to the `class` attr on fallthrough, overriding\n  // child components' own root classes.\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  const { classList: _classList, ...rest } = props;\n  const option: MenuOption = {\n    ...rest,\n    avatar: props.menuOptionConfig?.variant === \"avatar\" ? props.avatar : undefined,\n    icon: props.menuOptionConfig?.variant === \"icon\" ? props.icon : undefined,\n    companyName: props.menuOptionConfig?.variant === \"company\" ? props.companyName || props.text : undefined,\n  };\n  return option;\n});\n\nconst effectiveAction = computed(() => props.action ?? props.menuOptionConfig?.action);\n\nconst inputHidden = computed(() => {\n  const variant = props.menuOptionConfig?.variant;\n  return variant !== \"checkbox\" && variant !== \"radio\";\n});\n\n// we only show the input for checkbox and radio variants\nconst inputType = computed(() => {\n  return props.menuOptionConfig?.variant === \"radio\" ? \"radio\" : \"checkbox\";\n});\n\nconst inputName = `${inputType.value}-${getCurrentInstance()?.uid}`;\n\nconst inputClass = computed(() => {\n  return props.menuOptionConfig?.variant === \"checkbox\" ? \"pv-checkbox\" : \"pv-radio\";\n});\n\nconst dataTestId = computed(() => {\n  const type =\n    props.menuOptionConfig?.variant === \"checkbox\"\n      ? \"-checkbox\"\n      : props.menuOptionConfig?.variant === \"radio\"\n        ? \"-radio\"\n        : \"\";\n  return `pv-menu${type}-item`;\n});\n\nconst emits = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"toggle-expanded\"): void;\n}>();\n\nconst handleSelected = (event: Event) => {\n  if (props.disabled) {\n    return;\n  }\n  const option: MenuOption = {\n    ...props,\n  };\n  emits(\"handle-selected\", {\n    option,\n    event,\n  });\n  // After the reactive state settles, force-sync the DOM checked/indeterminate\n  // properties. Vue skips patching when the computed value doesn't change (e.g.\n  // indeterminate parent: isChecked was false before and is still false after\n  // deselecting all children), leaving the browser-toggled state stale.\n  nextTick(() => {\n    if (inputRef.value) {\n      inputRef.value.checked = isChecked.value;\n      inputRef.value.indeterminate = isIndeterminate.value;\n    }\n  });\n};\n\nconst handleMenuItemClick = (event: MouseEvent) => {\n  if (!menuInteractionMode.value) return;\n  const target = event.target as Element;\n  const interactiveTarget = target.closest(\n    \"a, button, input, select, textarea, [contenteditable], [role='button'], [role='checkbox'], [role='link'], [role='radio'], [role='switch']\",\n  );\n  if (interactiveTarget && interactiveTarget !== event.currentTarget && interactiveTarget !== inputRef.value) return;\n  event.preventDefault();\n  handleSelected(event);\n};\n</script>\n\n<template>\n  <label\n    v-bind=\"$attrs\"\n    class=\"pv-label pv-label-hover pv-flex pv-full-width pv-stack-4 pv-inset-square-8\"\n    :class=\"computedClassList\"\n    :style=\"[\n      disabledStyle,\n      { cursor: 'pointer', paddingTop: subText ? '4px' : undefined, paddingBottom: subText ? '4px' : undefined },\n    ]\"\n    :data-testid=\"dataTestId\"\n    @click=\"handleMenuItemClick\"\n  >\n    <input\n      ref=\"inputRef\"\n      :hidden=\"inputHidden\"\n      :type=\"inputType\"\n      :name=\"inputName\"\n      :checked=\"isChecked\"\n      :indeterminate=\"isIndeterminate\"\n      :class=\"inputClass\"\n      :tabindex=\"menuInteractionMode ? -1 : undefined\"\n      :aria-hidden=\"menuInteractionMode ? true : undefined\"\n      :disabled=\"disabled\"\n      @change=\"menuInteractionMode ? undefined : handleSelected($event)\"\n    />\n    <template v-if=\"menuOptionConfig?.renderer\">\n      <component :is=\"menuOptionConfig?.renderer\" v-bind=\"computedOption\" :selected=\"isChecked\" />\n    </template>\n    <template v-else>\n      <PvMenuBaseItem\n        v-bind=\"computedOption\"\n        :menuOptionConfig=\"menuOptionConfig\"\n        :queryText=\"queryText\"\n        :highlightSearchText=\"highlightSearchText\"\n      />\n    </template>\n    <PvIcon v-if=\"menuOptionConfig?.variant === 'checkmark' && isChecked\" name=\"check\" class=\"pv-text-success\" />\n    <PvSwitch\n      v-if=\"menuOptionConfig?.variant === 'toggle'\"\n      :modelValue=\"isChecked\"\n      :ariaLabel=\"props.text || 'Toggle'\"\n      size=\"sm\"\n      hideCheckIcon\n      style=\"pointer-events: none\"\n    />\n    <span v-if=\"effectiveAction\" class=\"pv-menu-item-action\">\n      <PvMenuItemAction :action=\"effectiveAction\" :option=\"props\" :disabled=\"disabled\" />\n    </span>\n    <button\n      v-if=\"showChevron\"\n      type=\"button\"\n      class=\"pv-button-ghost pv-menu-item-expand-chevron\"\n      :aria-label=\"props.text ? `Toggle children for ${props.text}` : 'Toggle children'\"\n      :aria-expanded=\"expanded\"\n      @click.prevent.stop=\"emits('toggle-expanded')\"\n    >\n      <PvIcon :name=\"chevronIcon ?? 'chevron-right'\" :size=\"12\" />\n    </button>\n  </label>\n</template>\n","<script lang=\"ts\" setup>\nimport { computed, inject, ref, useAttrs, watch } from \"vue\";\n\nimport { MenuOption, MenuOptionConfig, MenuOptionSelectedEvent, SeeMoreEvent } from \"@/types.ts\";\nimport { hasCascadeChildren } from \"@/components/base/PvMenu/cascadeUtils\";\nimport PvMenuItemVariant from \"@/components/base/PvMenu/items/PvMenuItemVariant.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport {\n  SelectedItemsKey,\n  EnableChildExpansionKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n  ParentSelectsAllChildrenKey,\n  MenuInteractionModeKey,\n} from \"@/components/base/PvMenu/symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nconst MAX_LEVEL_DEPTH = 4;\n\ninterface PvMenuItemProps extends MenuOption {\n  level?: number;\n  config?: MenuOptionConfig;\n  queryText?: string | null;\n  highlightSearchText?: boolean;\n  itemClass?: string;\n}\n\nconst props = withDefaults(defineProps<PvMenuItemProps>(), {\n  level: 0,\n});\nconst injectedSelectedItems = inject(SelectedItemsKey, undefined);\nconst modelSelectedIds = defineModel<string[]>(\"selectedIds\", { default: () => [] });\n\nconst enableChildExpansion = inject(EnableChildExpansionKey, ref(false));\nconst parentSelectsAllChildren = inject(ParentSelectsAllChildrenKey, ref(false));\nconst menuInteractionMode = inject(\n  MenuInteractionModeKey,\n  computed(() => false),\n);\nconst attrs = useAttrs();\nconst menuItemAttrs = computed(() => {\n  if (!menuInteractionMode.value) return {};\n  const allowedAttrs = new Set([\n    \"aria-checked\",\n    \"aria-controls\",\n    \"aria-disabled\",\n    \"aria-expanded\",\n    \"aria-haspopup\",\n    \"data-active\",\n    \"data-dd-action-name\",\n    \"data-option-id\",\n    \"onFocus\",\n    \"onKeydown\",\n    \"role\",\n    \"tabindex\",\n  ]);\n  return Object.fromEntries(Object.entries(attrs).filter(([key]) => allowedAttrs.has(key)));\n});\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst cascadeDeselectedChildIds = inject(CascadeDeselectedChildIdsKey, undefined);\n\nconst isExpanded = ref(props.defaultExpanded ?? false);\n\n// Honor a later flip of `defaultExpanded` (e.g. selection resolving after an async\n// rebuild that reuses this instance). Only forces open, never overrides a manual collapse.\nwatch(\n  () => props.defaultExpanded,\n  (val) => {\n    if (val) isExpanded.value = true;\n  },\n);\n\nconst isSeeMoreLoading = ref(false);\nconst hasExhaustedChildren = ref(false);\nconst childOptions = ref<MenuOption[]>(props.children ?? []);\nconst lazyLoadedChildIds = ref<Set<string>>(new Set());\n\nwatch(\n  () => props.children,\n  (newChildren) => {\n    if (!newChildren) {\n      childOptions.value = [];\n      return;\n    }\n    // Preserve lazily loaded children (from handleSeeMore) that aren't in the\n    // new prop value, but drop any original children that were filtered out.\n    const lazyChildren = childOptions.value.filter((c) => lazyLoadedChildIds.value.has(c.id));\n    const newChildIds = new Set(newChildren.map((c) => c.id));\n    const extras = lazyChildren.filter((c) => !newChildIds.has(c.id));\n    childOptions.value = [...newChildren, ...extras];\n    hasExhaustedChildren.value = false;\n  },\n);\n\nconst toggleExpanded = () => {\n  isExpanded.value = !isExpanded.value;\n};\n\nconst paddingLeft = computed(() => ({ paddingLeft: `${props.level * 12 + 12}px` }));\n\n// Omit PvMenuItem-only props so v-bind doesn't leak them as DOM attributes\n// on PvMenuItemVariant (which doesn't declare them).\nconst variantProps = computed(() => {\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  const { level, config, itemClass, ...rest } = props;\n  if (menuInteractionMode.value) delete (rest as Record<string, unknown>).selectedIds;\n  return rest;\n});\n\nconst hasChildren = computed(() => {\n  return hasCascadeChildren({ ...props, children: childOptions.value }) && props.level < MAX_LEVEL_DEPTH;\n});\n\nconst showSubMenu = computed(() => {\n  if (!hasChildren.value) return false;\n  if (enableChildExpansion.value) return isExpanded.value;\n  return true;\n});\n\nconst chevronIcon = computed(() => {\n  return isExpanded.value ? \"chevron-down\" : \"chevron-right\";\n});\n\nconst optionIsSelected = (option: PvMenuItemProps): boolean => {\n  if (injectedSelectedItems && Array.isArray(injectedSelectedItems.value)) {\n    return injectedSelectedItems.value.some((item) => item.id === option.id);\n  }\n  return modelSelectedIds.value.includes(option.id);\n};\n\nconst emits = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n}>();\n\nconst hasMoreChildren = computed(() => {\n  if (hasExhaustedChildren.value) return false;\n  if (props.totalChildCount == null) return false;\n  return props.totalChildCount > childOptions.value.length;\n});\n\nconst handleSeeMoreClick = async () => {\n  if (isSeeMoreLoading.value) return;\n\n  if (!props.handleSeeMore) {\n    emits(\"see-more\", { parentId: props.id, offset: childOptions.value.length });\n    return;\n  }\n\n  const parentIsSelected = cascadeSelectedParentIds?.value?.has(props.id) ?? false;\n\n  isSeeMoreLoading.value = true;\n  try {\n    const newChildren = await props.handleSeeMore({ parentId: props.id, offset: childOptions.value.length });\n    if (Array.isArray(newChildren) && newChildren.length > 0) {\n      const existingIds = new Set(childOptions.value.map((c) => c.id));\n      const uniqueNewChildren = newChildren.filter((c) => !existingIds.has(c.id));\n      if (uniqueNewChildren.length === 0) {\n        hasExhaustedChildren.value = true;\n        return;\n      }\n      const nextLazy = new Set(lazyLoadedChildIds.value);\n      for (const c of uniqueNewChildren) nextLazy.add(c.id);\n      lazyLoadedChildIds.value = nextLazy;\n      childOptions.value = [...childOptions.value, ...uniqueNewChildren];\n      // If the parent was selected, auto-select newly loaded children\n      // (excluding any that were explicitly deselected by the user)\n      if (parentIsSelected && injectedSelectedItems?.value) {\n        const deselected = cascadeDeselectedChildIds?.value?.get(props.id);\n        const candidates = deselected ? uniqueNewChildren.filter((c) => !deselected.has(c.id)) : uniqueNewChildren;\n        if (candidates.length > 0) {\n          const existingSelectedIds = new Set(injectedSelectedItems.value.map((item) => item.id));\n          const toSelect = candidates.filter((c) => !existingSelectedIds.has(c.id));\n          if (toSelect.length > 0) {\n            injectedSelectedItems.value = [...injectedSelectedItems.value, ...toSelect];\n          }\n        }\n      }\n    } else if (Array.isArray(newChildren)) {\n      hasExhaustedChildren.value = true;\n    }\n  } finally {\n    isSeeMoreLoading.value = false;\n  }\n};\n\nconst handleSelected = (event: MenuOptionSelectedEvent) => {\n  // If this item is expandable and has children, clicking it toggles expansion\n  // rather than selection — unless parentSelectsAllChildren is enabled, in which\n  // case the parent click should cascade-select all children (expansion stays\n  // available via the chevron button).\n  if (\n    enableChildExpansion.value &&\n    hasChildren.value &&\n    event.option.id === props.id &&\n    !parentSelectsAllChildren.value\n  ) {\n    toggleExpanded();\n    return;\n  }\n  if (!injectedSelectedItems) {\n    const index = modelSelectedIds.value.indexOf(event.option.id);\n    if (index > -1) {\n      modelSelectedIds.value = [...modelSelectedIds.value.slice(0, index), ...modelSelectedIds.value.slice(index + 1)];\n    } else {\n      modelSelectedIds.value = [...modelSelectedIds.value, event.option.id];\n    }\n  }\n  emits(\"handle-selected\", event);\n};\n\n// Bubble child handle-selected events without toggling modelSelectedIds again\n// (the child PvMenuItem already updated the shared modelSelectedIds via v-model).\nconst handleChildSelected = (event: MenuOptionSelectedEvent) => {\n  emits(\"handle-selected\", event);\n};\n</script>\n\n<template v-if=\"level < MAX_LEVEL_DEPTH\">\n  <PvMenuItemVariant\n    v-bind=\"{ ...variantProps, ...menuItemAttrs }\"\n    :children=\"childOptions\"\n    :menuOptionConfig=\"config\"\n    :queryText=\"queryText\"\n    :highlightSearchText=\"highlightSearchText\"\n    :showChevron=\"enableChildExpansion && hasChildren\"\n    :chevronIcon=\"chevronIcon\"\n    :expanded=\"isExpanded\"\n    @handle-selected=\"handleSelected\"\n    @toggle-expanded=\"toggleExpanded\"\n    :selected=\"optionIsSelected(props)\"\n  />\n  <ul v-if=\"showSubMenu\" role=\"list\" :style=\"paddingLeft\">\n    <li\n      v-for=\"childOption in childOptions\"\n      :key=\"childOption.id\"\n      :data-active=\"optionIsSelected(childOption) ? 'true' : null\"\n      :class=\"itemClass\"\n    >\n      <PvMenuItem\n        v-bind=\"childOption\"\n        :disabled=\"props.disabled || childOption.disabled\"\n        v-model:selectedIds=\"modelSelectedIds\"\n        :config=\"childOption.config ?? config\"\n        :queryText=\"queryText\"\n        :highlightSearchText=\"highlightSearchText\"\n        :level=\"level + 1\"\n        @handle-selected=\"handleChildSelected\"\n        @see-more=\"emits('see-more', $event)\"\n      />\n    </li>\n    <li v-if=\"hasMoreChildren\">\n      <PvButton\n        class=\"pv-text-brand\"\n        variant=\"ghost\"\n        label=\"See more\"\n        :loading=\"isSeeMoreLoading\"\n        data-testid=\"pv-menu-item-see-more\"\n        @click=\"handleSeeMoreClick\"\n      />\n    </li>\n  </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { computed, inject, ref, useAttrs, watch } from \"vue\";\n\nimport { MenuOption, MenuOptionConfig, MenuOptionSelectedEvent, SeeMoreEvent } from \"@/types.ts\";\nimport { hasCascadeChildren } from \"@/components/base/PvMenu/cascadeUtils\";\nimport PvMenuItemVariant from \"@/components/base/PvMenu/items/PvMenuItemVariant.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport {\n  SelectedItemsKey,\n  EnableChildExpansionKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n  ParentSelectsAllChildrenKey,\n  MenuInteractionModeKey,\n} from \"@/components/base/PvMenu/symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nconst MAX_LEVEL_DEPTH = 4;\n\ninterface PvMenuItemProps extends MenuOption {\n  level?: number;\n  config?: MenuOptionConfig;\n  queryText?: string | null;\n  highlightSearchText?: boolean;\n  itemClass?: string;\n}\n\nconst props = withDefaults(defineProps<PvMenuItemProps>(), {\n  level: 0,\n});\nconst injectedSelectedItems = inject(SelectedItemsKey, undefined);\nconst modelSelectedIds = defineModel<string[]>(\"selectedIds\", { default: () => [] });\n\nconst enableChildExpansion = inject(EnableChildExpansionKey, ref(false));\nconst parentSelectsAllChildren = inject(ParentSelectsAllChildrenKey, ref(false));\nconst menuInteractionMode = inject(\n  MenuInteractionModeKey,\n  computed(() => false),\n);\nconst attrs = useAttrs();\nconst menuItemAttrs = computed(() => {\n  if (!menuInteractionMode.value) return {};\n  const allowedAttrs = new Set([\n    \"aria-checked\",\n    \"aria-controls\",\n    \"aria-disabled\",\n    \"aria-expanded\",\n    \"aria-haspopup\",\n    \"data-active\",\n    \"data-dd-action-name\",\n    \"data-option-id\",\n    \"onFocus\",\n    \"onKeydown\",\n    \"role\",\n    \"tabindex\",\n  ]);\n  return Object.fromEntries(Object.entries(attrs).filter(([key]) => allowedAttrs.has(key)));\n});\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst cascadeDeselectedChildIds = inject(CascadeDeselectedChildIdsKey, undefined);\n\nconst isExpanded = ref(props.defaultExpanded ?? false);\n\n// Honor a later flip of `defaultExpanded` (e.g. selection resolving after an async\n// rebuild that reuses this instance). Only forces open, never overrides a manual collapse.\nwatch(\n  () => props.defaultExpanded,\n  (val) => {\n    if (val) isExpanded.value = true;\n  },\n);\n\nconst isSeeMoreLoading = ref(false);\nconst hasExhaustedChildren = ref(false);\nconst childOptions = ref<MenuOption[]>(props.children ?? []);\nconst lazyLoadedChildIds = ref<Set<string>>(new Set());\n\nwatch(\n  () => props.children,\n  (newChildren) => {\n    if (!newChildren) {\n      childOptions.value = [];\n      return;\n    }\n    // Preserve lazily loaded children (from handleSeeMore) that aren't in the\n    // new prop value, but drop any original children that were filtered out.\n    const lazyChildren = childOptions.value.filter((c) => lazyLoadedChildIds.value.has(c.id));\n    const newChildIds = new Set(newChildren.map((c) => c.id));\n    const extras = lazyChildren.filter((c) => !newChildIds.has(c.id));\n    childOptions.value = [...newChildren, ...extras];\n    hasExhaustedChildren.value = false;\n  },\n);\n\nconst toggleExpanded = () => {\n  isExpanded.value = !isExpanded.value;\n};\n\nconst paddingLeft = computed(() => ({ paddingLeft: `${props.level * 12 + 12}px` }));\n\n// Omit PvMenuItem-only props so v-bind doesn't leak them as DOM attributes\n// on PvMenuItemVariant (which doesn't declare them).\nconst variantProps = computed(() => {\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  const { level, config, itemClass, ...rest } = props;\n  if (menuInteractionMode.value) delete (rest as Record<string, unknown>).selectedIds;\n  return rest;\n});\n\nconst hasChildren = computed(() => {\n  return hasCascadeChildren({ ...props, children: childOptions.value }) && props.level < MAX_LEVEL_DEPTH;\n});\n\nconst showSubMenu = computed(() => {\n  if (!hasChildren.value) return false;\n  if (enableChildExpansion.value) return isExpanded.value;\n  return true;\n});\n\nconst chevronIcon = computed(() => {\n  return isExpanded.value ? \"chevron-down\" : \"chevron-right\";\n});\n\nconst optionIsSelected = (option: PvMenuItemProps): boolean => {\n  if (injectedSelectedItems && Array.isArray(injectedSelectedItems.value)) {\n    return injectedSelectedItems.value.some((item) => item.id === option.id);\n  }\n  return modelSelectedIds.value.includes(option.id);\n};\n\nconst emits = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n}>();\n\nconst hasMoreChildren = computed(() => {\n  if (hasExhaustedChildren.value) return false;\n  if (props.totalChildCount == null) return false;\n  return props.totalChildCount > childOptions.value.length;\n});\n\nconst handleSeeMoreClick = async () => {\n  if (isSeeMoreLoading.value) return;\n\n  if (!props.handleSeeMore) {\n    emits(\"see-more\", { parentId: props.id, offset: childOptions.value.length });\n    return;\n  }\n\n  const parentIsSelected = cascadeSelectedParentIds?.value?.has(props.id) ?? false;\n\n  isSeeMoreLoading.value = true;\n  try {\n    const newChildren = await props.handleSeeMore({ parentId: props.id, offset: childOptions.value.length });\n    if (Array.isArray(newChildren) && newChildren.length > 0) {\n      const existingIds = new Set(childOptions.value.map((c) => c.id));\n      const uniqueNewChildren = newChildren.filter((c) => !existingIds.has(c.id));\n      if (uniqueNewChildren.length === 0) {\n        hasExhaustedChildren.value = true;\n        return;\n      }\n      const nextLazy = new Set(lazyLoadedChildIds.value);\n      for (const c of uniqueNewChildren) nextLazy.add(c.id);\n      lazyLoadedChildIds.value = nextLazy;\n      childOptions.value = [...childOptions.value, ...uniqueNewChildren];\n      // If the parent was selected, auto-select newly loaded children\n      // (excluding any that were explicitly deselected by the user)\n      if (parentIsSelected && injectedSelectedItems?.value) {\n        const deselected = cascadeDeselectedChildIds?.value?.get(props.id);\n        const candidates = deselected ? uniqueNewChildren.filter((c) => !deselected.has(c.id)) : uniqueNewChildren;\n        if (candidates.length > 0) {\n          const existingSelectedIds = new Set(injectedSelectedItems.value.map((item) => item.id));\n          const toSelect = candidates.filter((c) => !existingSelectedIds.has(c.id));\n          if (toSelect.length > 0) {\n            injectedSelectedItems.value = [...injectedSelectedItems.value, ...toSelect];\n          }\n        }\n      }\n    } else if (Array.isArray(newChildren)) {\n      hasExhaustedChildren.value = true;\n    }\n  } finally {\n    isSeeMoreLoading.value = false;\n  }\n};\n\nconst handleSelected = (event: MenuOptionSelectedEvent) => {\n  // If this item is expandable and has children, clicking it toggles expansion\n  // rather than selection — unless parentSelectsAllChildren is enabled, in which\n  // case the parent click should cascade-select all children (expansion stays\n  // available via the chevron button).\n  if (\n    enableChildExpansion.value &&\n    hasChildren.value &&\n    event.option.id === props.id &&\n    !parentSelectsAllChildren.value\n  ) {\n    toggleExpanded();\n    return;\n  }\n  if (!injectedSelectedItems) {\n    const index = modelSelectedIds.value.indexOf(event.option.id);\n    if (index > -1) {\n      modelSelectedIds.value = [...modelSelectedIds.value.slice(0, index), ...modelSelectedIds.value.slice(index + 1)];\n    } else {\n      modelSelectedIds.value = [...modelSelectedIds.value, event.option.id];\n    }\n  }\n  emits(\"handle-selected\", event);\n};\n\n// Bubble child handle-selected events without toggling modelSelectedIds again\n// (the child PvMenuItem already updated the shared modelSelectedIds via v-model).\nconst handleChildSelected = (event: MenuOptionSelectedEvent) => {\n  emits(\"handle-selected\", event);\n};\n</script>\n\n<template v-if=\"level < MAX_LEVEL_DEPTH\">\n  <PvMenuItemVariant\n    v-bind=\"{ ...variantProps, ...menuItemAttrs }\"\n    :children=\"childOptions\"\n    :menuOptionConfig=\"config\"\n    :queryText=\"queryText\"\n    :highlightSearchText=\"highlightSearchText\"\n    :showChevron=\"enableChildExpansion && hasChildren\"\n    :chevronIcon=\"chevronIcon\"\n    :expanded=\"isExpanded\"\n    @handle-selected=\"handleSelected\"\n    @toggle-expanded=\"toggleExpanded\"\n    :selected=\"optionIsSelected(props)\"\n  />\n  <ul v-if=\"showSubMenu\" role=\"list\" :style=\"paddingLeft\">\n    <li\n      v-for=\"childOption in childOptions\"\n      :key=\"childOption.id\"\n      :data-active=\"optionIsSelected(childOption) ? 'true' : null\"\n      :class=\"itemClass\"\n    >\n      <PvMenuItem\n        v-bind=\"childOption\"\n        :disabled=\"props.disabled || childOption.disabled\"\n        v-model:selectedIds=\"modelSelectedIds\"\n        :config=\"childOption.config ?? config\"\n        :queryText=\"queryText\"\n        :highlightSearchText=\"highlightSearchText\"\n        :level=\"level + 1\"\n        @handle-selected=\"handleChildSelected\"\n        @see-more=\"emits('see-more', $event)\"\n      />\n    </li>\n    <li v-if=\"hasMoreChildren\">\n      <PvButton\n        class=\"pv-text-brand\"\n        variant=\"ghost\"\n        label=\"See more\"\n        :loading=\"isSeeMoreLoading\"\n        data-testid=\"pv-menu-item-see-more\"\n        @click=\"handleSeeMoreClick\"\n      />\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, inject, nextTick, provide, ref, shallowRef, useId, watch } from \"vue\";\nimport type { VNodeChild } from \"vue\";\nimport { autoUpdate, flip, offset, shift, useFloating } from \"@floating-ui/vue\";\nimport { onClickOutside } from \"@vueuse/core\";\n\nimport { MenuOption, MenuOptionSelectedEvent, SeeMoreEvent } from \"@/types\";\nimport PvMenuItem from \"@/components/base/PvMenu/items/PvMenuItem.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvPopover from \"@/components/base/PvPopover/PvPopover.vue\";\nimport { PvMenuProps } from \"./types\";\nimport { collectLeafOptions, hasCascadeChildren, mergeLeafOptions } from \"./cascadeUtils\";\nimport {\n  SelectedItemsKey,\n  EnableCascadeSelectionKey,\n  MenuInteractionModeKey,\n  MenuAncestorIdsKey,\n  OriginalOptionsMapKey,\n  ParentSelectsAllChildrenKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n} from \"./symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nconst props = withDefaults(defineProps<PvMenuProps>(), {\n  childrenDisplay: \"inline\",\n  highlightParentItems: true,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n}>();\n\ndefineSlots<{\n  popover?(props: { option: MenuOption; popoverId: string; close: () => void }): VNodeChild;\n}>();\n\nconst selectedItems = defineModel<MenuOption[]>(\"selectedItems\", { default: () => [] });\nconst expandedOptionId = defineModel<string | undefined>(\"expandedOptionId\");\n\nconst nestedMenuId = useId();\nconst rootMenuRef = ref<HTMLElement | null>(null);\nconst nestedMenuRef = ref<HTMLElement | null>(null);\nconst nestedMenuPopoverRef = ref<HTMLElement | null>(null);\nconst nestedMenuTriggerRef = ref<HTMLElement | null>(null);\n\nconst { floatingStyles, update: updateNestedMenuPosition } = useFloating(nestedMenuTriggerRef, nestedMenuPopoverRef, {\n  middleware: [offset(4), flip(), shift({ padding: 8 })],\n  placement: \"right-start\",\n  strategy: \"fixed\",\n  whileElementsMounted: autoUpdate,\n});\n\nconst closeNestedMenu = () => {\n  if (expandedOptionId.value !== undefined) expandedOptionId.value = undefined;\n};\n\nconst closeNestedMenuAndRestoreFocus = () => {\n  const parentId = expandedOptionId.value;\n  closeNestedMenu();\n  if (parentId) nextTick(() => focusParentOption(parentId));\n};\n\nconst ancestorMenuIds = inject(MenuAncestorIdsKey, []);\nconst menuHierarchyIds = [...ancestorMenuIds, nestedMenuId];\nprovide(MenuAncestorIdsKey, menuHierarchyIds);\n\nonClickOutside(\n  rootMenuRef,\n  (event) => {\n    const ancestorIds =\n      event.target instanceof Element\n        ? event.target.closest<HTMLElement>(\"[data-pv-menu-ancestors]\")?.dataset.pvMenuAncestors?.split(\" \")\n        : undefined;\n    if (!ancestorIds?.includes(nestedMenuId)) closeNestedMenu();\n  },\n  { ignore: [nestedMenuPopoverRef] },\n);\n\n// Vue 3.5 defineModel doesn't update local value synchronously when the prop\n// is passed by a parent (it only emits and waits for the parent to re-render).\n// This local ref is updated immediately so consecutive selections read correct state.\nconst localSelectedItems = shallowRef<MenuOption[]>(selectedItems.value);\n\nwatch(selectedItems, (newVal) => {\n  localSelectedItems.value = newVal;\n});\n\n// The last value this component itself pushed into the model. The sync-back watcher below must\n// skip own writes: because defineModel doesn't reflect a set until the parent re-renders,\n// comparing newVal against selectedItems.value alone mistakes every own write for a descendant\n// mutation and pushes it again — emitting update:selectedItems twice per selection (and, through\n// PvSelectButton, a doubled update:modelValue).\nlet lastModelWrite: MenuOption[] | undefined;\nconst writeSelectedItems = (value: MenuOption[]) => {\n  lastModelWrite = value;\n  selectedItems.value = value;\n};\n\n// Sync back to the model when descendants mutate localSelectedItems directly\n// (e.g. auto-selecting lazy-loaded children in PvMenuItem.handleSeeMoreClick).\nwatch(localSelectedItems, (newVal) => {\n  if (newVal !== lastModelWrite && newVal !== selectedItems.value) {\n    writeSelectedItems(newVal);\n  }\n});\n\nprovide(SelectedItemsKey, localSelectedItems);\nprovide(\n  MenuInteractionModeKey,\n  computed(() => props.childrenDisplay === \"popover\"),\n);\nconst cascadeSelectionEnabled = computed(() => props.childrenDisplay === \"inline\" && !!props.enableCascadeSelection);\nprovide(EnableCascadeSelectionKey, cascadeSelectionEnabled);\n\nconst originalOptionsMap = inject(OriginalOptionsMapKey, undefined);\nconst parentSelectsAllChildren = inject(ParentSelectsAllChildrenKey, ref(false));\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst cascadeDeselectedChildIds = inject(CascadeDeselectedChildIdsKey, undefined);\n\nconst isSingleSelect = computed(() => props.singleSelect || props.config?.variant === \"radio\");\nconst expandedOption = computed(() =>\n  props.options.find((option) => option.id === expandedOptionId.value && option.children?.length),\n);\n\nconst openNestedMenu = (option: MenuOption, target: HTMLElement, focusFirstItem = false, toggle = true) => {\n  const shouldOpen = !toggle || expandedOptionId.value !== option.id;\n  expandedOptionId.value = shouldOpen ? option.id : undefined;\n  if (!shouldOpen) return;\n\n  nestedMenuTriggerRef.value = target;\n  nextTick(() => {\n    updateNestedMenuPosition();\n    if (focusFirstItem) {\n      focusMenuItem(nestedMenuRef.value ?? document.getElementById(nestedMenuId), 0);\n    }\n  });\n};\n\nconst handleItemSelected = (event: MenuOptionSelectedEvent, nested = false) => {\n  if (props.readOnly) return;\n  const option =\n    (!nested && props.childrenDisplay === \"popover\"\n      ? props.options.find((candidate) => candidate.id === event.option.id)\n      : undefined) ?? event.option;\n  if (props.childrenDisplay === \"popover\" && !nested && option.children?.length) {\n    const target = (event.event.currentTarget as HTMLElement | null)?.closest<HTMLElement>(\"li\");\n    if (target) openNestedMenu(option, target);\n    return;\n  }\n  let newSelection: MenuOption[];\n\n  if (cascadeSelectionEnabled.value && hasCascadeChildren(option)) {\n    // Only leaf options are added to the selection — the parent itself is never\n    // included because it is purely an organisational node, not a selectable value.\n    // When parentSelectsAllChildren is true, use the original (unfiltered)\n    // children so clicking a parent selects all children regardless of search query.\n    let leafOptions: MenuOption[];\n    if (parentSelectsAllChildren.value && originalOptionsMap?.value) {\n      const originalOption = originalOptionsMap.value.get(option.id);\n      const originalLeaves = originalOption?.children ? collectLeafOptions(originalOption.children) : [];\n      const currentLeaves = option.children ? collectLeafOptions(option.children) : [];\n      leafOptions = mergeLeafOptions(originalLeaves, currentLeaves);\n    } else {\n      leafOptions = option.children ? collectLeafOptions(option.children) : [];\n    }\n    const leafIds = leafOptions.map((o) => o.id);\n    const current = localSelectedItems.value;\n    const parentSelected = cascadeSelectedParentIds?.value?.has(option.id) ?? false;\n    const anySelected = parentSelected || leafIds.some((id) => current.some((item) => item.id === id));\n    newSelection = anySelected ? current.filter((item) => !leafIds.includes(item.id)) : [...current, ...leafOptions];\n\n    // Track whether this parent was explicitly clicked for cascade selection\n    if (cascadeSelectedParentIds?.value) {\n      const next = new Set(cascadeSelectedParentIds.value);\n      if (anySelected) {\n        next.delete(option.id);\n      } else {\n        next.add(option.id);\n      }\n      cascadeSelectedParentIds.value = next;\n    }\n    // Clear deselected children tracking when parent is explicitly toggled\n    if (cascadeDeselectedChildIds?.value?.has(option.id)) {\n      const next = new Map(cascadeDeselectedChildIds.value);\n      next.delete(option.id);\n      cascadeDeselectedChildIds.value = next;\n    }\n  } else if (isSingleSelect.value) {\n    if (localSelectedItems.value.length === 1 && localSelectedItems.value[0].id === option.id) {\n      newSelection = props.disableDeselect ? localSelectedItems.value : [];\n    } else {\n      newSelection = [option];\n    }\n  } else {\n    const index = localSelectedItems.value.findIndex((item) => item.id === option.id);\n    if (index > -1) {\n      newSelection = [...localSelectedItems.value.slice(0, index), ...localSelectedItems.value.slice(index + 1)];\n    } else {\n      newSelection = [...localSelectedItems.value, option];\n    }\n\n    // Track individually deselected/re-selected children under selected parents\n    // so dynamically loaded children (see-more) can inherit the correct state.\n    if (cascadeSelectionEnabled.value && cascadeSelectedParentIds?.value && cascadeDeselectedChildIds?.value) {\n      const isDeselecting = index > -1;\n      for (const parentId of cascadeSelectedParentIds.value) {\n        // Find if this child belongs to this parent\n        const parentOption = originalOptionsMap?.value?.get(parentId);\n        const parentChildren = parentOption?.children ?? props.options.find((o) => o.id === parentId)?.children;\n        if (!parentChildren) continue;\n        const leaves = collectLeafOptions(parentChildren);\n        // Also check the option itself as it may have been dynamically loaded\n        const isChildOfParent =\n          leaves.some((l) => l.id === option.id) ||\n          props.options.find((o) => o.id === parentId)?.children?.some((c) => c.id === option.id);\n        if (!isChildOfParent) continue;\n\n        const next = new Map(cascadeDeselectedChildIds.value);\n        const deselected = new Set(next.get(parentId) ?? []);\n        if (isDeselecting) {\n          deselected.add(option.id);\n        } else {\n          deselected.delete(option.id);\n        }\n        if (deselected.size > 0) {\n          next.set(parentId, deselected);\n        } else {\n          next.delete(parentId);\n        }\n        cascadeDeselectedChildIds.value = next;\n        break;\n      }\n    }\n  }\n\n  localSelectedItems.value = newSelection;\n  writeSelectedItems(newSelection);\n\n  if (!nested && props.childrenDisplay === \"popover\") expandedOptionId.value = undefined;\n  emit(\"handle-selected\", props.childrenDisplay === \"popover\" ? { ...event, option } : event);\n};\n\nconst handleNestedItemSelected = (event: MenuOptionSelectedEvent) => {\n  const parentOption = expandedOption.value;\n  if (!parentOption) return;\n  const option = parentOption.children?.find((child) => child.id === event.option.id) ?? event.option;\n  handleItemSelected({ ...event, option }, true);\n  expandedOptionId.value = undefined;\n  nextTick(() => focusParentOption(parentOption.id));\n};\n\nconst selectedIds = computed(() => new Set(localSelectedItems.value.map((item) => item.id)));\n\nconst findSelectedDescendant = (children: MenuOption[]): MenuOption | undefined => {\n  for (const child of children) {\n    if (selectedIds.value.has(child.id)) return child;\n    const selectedChild = child.children?.length ? findSelectedDescendant(child.children) : undefined;\n    if (selectedChild) return selectedChild;\n  }\n  return undefined;\n};\n\nconst menuItemOption = (option: MenuOption): MenuOption => {\n  if (props.childrenDisplay !== \"popover\" || !option.children?.length) return option;\n  const selectedChild = findSelectedDescendant(option.children);\n  return {\n    ...option,\n    children: undefined,\n    classList: [...(option.classList ?? []), \"pv-menu-nested\"],\n    subText: selectedChild?.text ?? option.subText,\n    totalChildCount: undefined,\n  };\n};\n\nconst directChildMenuItemOption = (option: MenuOption): MenuOption => ({\n  ...option,\n  children: undefined,\n  totalChildCount: undefined,\n});\n\nconst menuItemConfig = (option: MenuOption) =>\n  props.childrenDisplay === \"popover\" ? (option.config ?? props.config) : props.config;\n\nconst isActive = (option: MenuOption): true | null => {\n  if (selectedIds.value.has(option.id)) {\n    return true;\n  }\n  if (cascadeSelectionEnabled.value && cascadeSelectedParentIds?.value?.has(option.id)) {\n    return true;\n  }\n  if (\n    (cascadeSelectionEnabled.value || props.childrenDisplay === \"popover\") &&\n    option.children?.length &&\n    findSelectedDescendant(option.children)\n  ) {\n    return true;\n  }\n  return null;\n};\n\nconst menuItemRole = (option: MenuOption): \"menuitem\" | \"menuitemcheckbox\" | \"menuitemradio\" => {\n  const variant = option.config?.variant ?? props.config?.variant;\n  if (isSingleSelect.value || variant === \"radio\") return \"menuitemradio\";\n  if (variant === \"checkbox\") return \"menuitemcheckbox\";\n  return \"menuitem\";\n};\n\nconst menuItemChecked = (option: MenuOption): boolean | undefined =>\n  menuItemRole(option) === \"menuitem\" ? undefined : !!isActive(option);\n\nconst itemDataActive = (option: MenuOption): true | null => {\n  if (option.children?.length && !props.highlightParentItems) return null;\n  return (menuItemRole(option) !== \"menuitemcheckbox\" && isActive(option)) || expandedOptionId.value === option.id\n    ? true\n    : null;\n};\n\nconst nestedItemDataActive = (option: MenuOption): true | null =>\n  menuItemRole(option) !== \"menuitemcheckbox\" && selectedIds.value.has(option.id) ? true : null;\n\nconst isVisible = (option: MenuOption, isLoading?: boolean): boolean => {\n  if (!isLoading) return true;\n  if (selectedIds.value.has(option.id)) return true;\n  if (cascadeSelectedParentIds?.value?.has(option.id)) return true;\n  if (option.children?.length && findSelectedDescendant(option.children)) return true;\n  return false;\n};\n\nconst SEE_MORE_OPTION_ID = \"__pv-menu-see-more__\";\nconst focusedTopLevelOptionId = ref<string>();\nconst focusedNestedOptionId = ref<string>();\n\nconst topLevelTabStopId = computed(() => {\n  const focusableOptionIds = props.options\n    .filter((option) => !props.readOnly && !option.disabled && isVisible(option, props.isLoading))\n    .map((option) => option.id);\n  if (props.hasMoreOptions && !props.isSeeMoreLoading) focusableOptionIds.push(SEE_MORE_OPTION_ID);\n  return focusedTopLevelOptionId.value && focusableOptionIds.includes(focusedTopLevelOptionId.value)\n    ? focusedTopLevelOptionId.value\n    : focusableOptionIds[0];\n});\n\nconst nestedTabStopId = computed(() => {\n  const focusableOptions =\n    expandedOption.value?.children?.filter((option) => !props.readOnly && !option.disabled) ?? [];\n  return focusableOptions.some((option) => option.id === focusedNestedOptionId.value)\n    ? focusedNestedOptionId.value\n    : focusableOptions[0]?.id;\n});\n\nconst menuItems = (menu: HTMLElement | null): HTMLElement[] => {\n  const roleItems = Array.from(\n    menu?.querySelectorAll<HTMLElement>(\"li[role='none'] > [role^='menuitem']:not([aria-disabled='true'])\") ?? [],\n  ).filter((item) => !item.hidden && item.style.display !== \"none\");\n  if (roleItems.length) return roleItems;\n\n  return Array.from(\n    menu?.querySelectorAll<HTMLElement>(\n      \"button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\",\n    ) ?? [],\n  ).filter((item) => !item.hidden && item.style.display !== \"none\");\n};\n\nconst focusMenuItem = (menu: HTMLElement | null, index: number) => {\n  const items = menuItems(menu);\n  if (!items.length) return;\n  items[(index + items.length) % items.length]?.focus();\n};\n\nconst focusRelativeMenuItem = (menu: HTMLElement | null, current: HTMLElement, offset: number) => {\n  const items = menuItems(menu);\n  const currentIndex = items.indexOf(current);\n  if (!items.length || currentIndex < 0) return;\n  items[(currentIndex + offset + items.length) % items.length]?.focus();\n};\n\nconst focusParentOption = (optionId: string) => {\n  menuItems(rootMenuRef.value)\n    .find((item) => item.dataset.optionId === optionId)\n    ?.focus();\n};\n\nwatch(\n  // Also re-sync when the row leaves and re-enters `options`, since its <li> is re-created.\n  [expandedOptionId, () => !!expandedOption.value],\n  ([optionId]) => {\n    focusedNestedOptionId.value = undefined;\n    if (!optionId) return;\n    nextTick(() => {\n      const target = Array.from(rootMenuRef.value?.children ?? []).find(\n        (item) => (item as HTMLElement).dataset.optionId === optionId,\n      ) as HTMLElement | undefined;\n      if (!target) return;\n      nestedMenuTriggerRef.value = target;\n      updateNestedMenuPosition();\n    });\n  },\n  { immediate: true },\n);\n\nconst handleMenuNavigation = (event: KeyboardEvent, menu: HTMLElement | null): boolean => {\n  switch (event.key) {\n    case \"ArrowDown\":\n      event.preventDefault();\n      focusRelativeMenuItem(menu, event.currentTarget as HTMLElement, 1);\n      return true;\n    case \"ArrowUp\":\n      event.preventDefault();\n      focusRelativeMenuItem(menu, event.currentTarget as HTMLElement, -1);\n      return true;\n    case \"Home\":\n      event.preventDefault();\n      focusMenuItem(menu, 0);\n      return true;\n    case \"End\":\n      event.preventDefault();\n      focusMenuItem(menu, -1);\n      return true;\n    default:\n      return false;\n  }\n};\n\nconst handleTopLevelKeydown = (event: KeyboardEvent, option: MenuOption) => {\n  if (event.target !== event.currentTarget || handleMenuNavigation(event, rootMenuRef.value)) return;\n  switch (event.key) {\n    case \"ArrowRight\":\n      if (!option.children?.length) break;\n      event.preventDefault();\n      openNestedMenu(option, event.currentTarget as HTMLElement, true, false);\n      break;\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      if (option.children?.length) {\n        openNestedMenu(option, event.currentTarget as HTMLElement, true, false);\n      } else {\n        handleItemSelected({ event, option });\n      }\n      break;\n    case \"Escape\":\n      if (!expandedOptionId.value) break;\n      event.preventDefault();\n      event.stopPropagation();\n      expandedOptionId.value = undefined;\n      break;\n    case \"Tab\":\n      expandedOptionId.value = undefined;\n      break;\n  }\n};\n\nconst handleSeeMoreKeydown = (event: KeyboardEvent) => {\n  if (handleMenuNavigation(event, rootMenuRef.value)) return;\n  switch (event.key) {\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      emit(\"see-more\", { parentId: undefined });\n      break;\n    case \"Escape\":\n    case \"Tab\":\n      closeNestedMenu();\n      break;\n  }\n};\n\nconst handleNestedKeydown = (event: KeyboardEvent, option: MenuOption) => {\n  if (event.target !== event.currentTarget || handleMenuNavigation(event, nestedMenuRef.value)) return;\n  switch (event.key) {\n    case \"ArrowLeft\":\n    case \"Escape\": {\n      event.preventDefault();\n      if (event.key === \"Escape\") event.stopPropagation();\n      const parentId = expandedOptionId.value;\n      expandedOptionId.value = undefined;\n      if (parentId) nextTick(() => focusParentOption(parentId));\n      break;\n    }\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      handleNestedItemSelected({ event, option });\n      break;\n    case \"Tab\":\n      expandedOptionId.value = undefined;\n      break;\n  }\n};\n</script>\n\n<template>\n  <ul ref=\"rootMenuRef\" :role=\"childrenDisplay === 'popover' ? 'menu' : 'list'\" class=\"pv-popover-list\" v-bind=\"$attrs\">\n    <li\n      v-for=\"option in options\"\n      v-show=\"isVisible(option, isLoading)\"\n      :key=\"option.id\"\n      :data-active=\"itemDataActive(option)\"\n      :data-option-id=\"option.id\"\n      :data-testid=\"itemTestId\"\n      :class=\"itemClass\"\n      :role=\"childrenDisplay === 'popover' ? 'none' : undefined\"\n    >\n      <PvMenuItem\n        v-bind=\"menuItemOption(option)\"\n        :aria-checked=\"childrenDisplay === 'popover' ? menuItemChecked(option) : undefined\"\n        :aria-controls=\"childrenDisplay === 'popover' && option.children?.length ? nestedMenuId : undefined\"\n        :aria-disabled=\"childrenDisplay === 'popover' && (props.readOnly || option.disabled) ? 'true' : undefined\"\n        :aria-expanded=\"\n          childrenDisplay === 'popover' && option.children?.length ? expandedOptionId === option.id : undefined\n        \"\n        :aria-haspopup=\"\n          childrenDisplay === 'popover' && option.children?.length ? (option.popoverRole ?? 'menu') : undefined\n        \"\n        :data-active=\"itemDataActive(option)\"\n        :data-dd-action-name=\"option.rumActionName\"\n        :data-option-id=\"option.id\"\n        :disabled=\"props.readOnly || option.disabled\"\n        :config=\"menuItemConfig(option)\"\n        :itemClass=\"itemClass\"\n        :queryText=\"queryText\"\n        :role=\"childrenDisplay === 'popover' ? menuItemRole(option) : undefined\"\n        :tabindex=\"childrenDisplay === 'popover' ? (topLevelTabStopId === option.id ? 0 : -1) : undefined\"\n        @focus=\"focusedTopLevelOptionId = option.id\"\n        @keydown=\"childrenDisplay === 'popover' ? handleTopLevelKeydown($event, option) : undefined\"\n        @handle-selected=\"handleItemSelected\"\n        @see-more=\"emit('see-more', $event)\"\n      />\n    </li>\n    <li v-if=\"hasMoreOptions\" :role=\"childrenDisplay === 'popover' ? 'none' : undefined\">\n      <PvButton\n        class=\"pv-text-brand\"\n        variant=\"ghost\"\n        label=\"See more\"\n        :loading=\"isSeeMoreLoading\"\n        :disabled=\"isSeeMoreLoading\"\n        :role=\"childrenDisplay === 'popover' ? 'menuitem' : undefined\"\n        :tabindex=\"childrenDisplay === 'popover' ? (topLevelTabStopId === SEE_MORE_OPTION_ID ? 0 : -1) : undefined\"\n        data-testid=\"pv-menu-see-more\"\n        @focus=\"focusedTopLevelOptionId = SEE_MORE_OPTION_ID\"\n        @keydown=\"childrenDisplay === 'popover' ? handleSeeMoreKeydown($event) : undefined\"\n        @click=\"emit('see-more', { parentId: undefined })\"\n      />\n    </li>\n  </ul>\n\n  <Teleport v-if=\"childrenDisplay === 'popover' && expandedOption\" to=\"body\">\n    <div\n      ref=\"nestedMenuPopoverRef\"\n      class=\"pv-menu-popover\"\n      :data-pv-menu-ancestors=\"menuHierarchyIds.join(' ')\"\n      :style=\"floatingStyles\"\n    >\n      <PvPopover\n        class=\"pv-scrollbar-visible\"\n        :css-custom-properties=\"{ position: 'static', width: 'max-content', maxWidth: 'calc(100vw - 16px)' }\"\n      >\n        <slot\n          name=\"popover\"\n          :option=\"expandedOption\"\n          :popover-id=\"nestedMenuId\"\n          :close=\"closeNestedMenuAndRestoreFocus\"\n        >\n          <ul\n            :id=\"nestedMenuId\"\n            ref=\"nestedMenuRef\"\n            :aria-label=\"`${expandedOption.text} options`\"\n            class=\"pv-popover-list\"\n            role=\"menu\"\n          >\n            <li\n              v-for=\"option in expandedOption.children\"\n              :key=\"option.id\"\n              :data-active=\"nestedItemDataActive(option)\"\n              :data-option-id=\"option.id\"\n              :class=\"itemClass\"\n              role=\"none\"\n            >\n              <PvMenuItem\n                v-bind=\"directChildMenuItemOption(option)\"\n                :aria-checked=\"menuItemChecked(option)\"\n                :aria-disabled=\"props.readOnly || option.disabled ? 'true' : undefined\"\n                :data-active=\"nestedItemDataActive(option)\"\n                :data-dd-action-name=\"option.rumActionName\"\n                :data-option-id=\"option.id\"\n                :disabled=\"props.readOnly || option.disabled\"\n                :config=\"menuItemConfig(option)\"\n                :itemClass=\"itemClass\"\n                :queryText=\"queryText\"\n                :role=\"menuItemRole(option)\"\n                :tabindex=\"nestedTabStopId === option.id ? 0 : -1\"\n                @focus=\"focusedNestedOptionId = option.id\"\n                @keydown=\"handleNestedKeydown($event, option)\"\n                @handle-selected=\"handleNestedItemSelected\"\n                @see-more=\"emit('see-more', $event)\"\n              />\n            </li>\n          </ul>\n        </slot>\n      </PvPopover>\n    </div>\n  </Teleport>\n</template>\n\n<style scoped>\n.pv-menu-popover {\n  z-index: 50;\n}\n\n.pv-popover-list > li:last-child > :deep(.pv-label) {\n  margin-block-end: 0;\n}\n\n:deep(.pv-menu-nested)::after {\n  content: \"\";\n  width: 0.4rem;\n  height: 0.4rem;\n  margin-right: 0.2rem;\n  margin-left: auto;\n  flex-shrink: 0;\n  border-top: 1.5px solid currentColor;\n  border-right: 1.5px solid currentColor;\n  transform: rotate(45deg);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, inject, nextTick, provide, ref, shallowRef, useId, watch } from \"vue\";\nimport type { VNodeChild } from \"vue\";\nimport { autoUpdate, flip, offset, shift, useFloating } from \"@floating-ui/vue\";\nimport { onClickOutside } from \"@vueuse/core\";\n\nimport { MenuOption, MenuOptionSelectedEvent, SeeMoreEvent } from \"@/types\";\nimport PvMenuItem from \"@/components/base/PvMenu/items/PvMenuItem.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvPopover from \"@/components/base/PvPopover/PvPopover.vue\";\nimport { PvMenuProps } from \"./types\";\nimport { collectLeafOptions, hasCascadeChildren, mergeLeafOptions } from \"./cascadeUtils\";\nimport {\n  SelectedItemsKey,\n  EnableCascadeSelectionKey,\n  MenuInteractionModeKey,\n  MenuAncestorIdsKey,\n  OriginalOptionsMapKey,\n  ParentSelectsAllChildrenKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n} from \"./symbols\";\n\ndefineOptions({\n  inheritAttrs: false,\n});\n\nconst props = withDefaults(defineProps<PvMenuProps>(), {\n  childrenDisplay: \"inline\",\n  highlightParentItems: true,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: MenuOptionSelectedEvent): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n}>();\n\ndefineSlots<{\n  popover?(props: { option: MenuOption; popoverId: string; close: () => void }): VNodeChild;\n}>();\n\nconst selectedItems = defineModel<MenuOption[]>(\"selectedItems\", { default: () => [] });\nconst expandedOptionId = defineModel<string | undefined>(\"expandedOptionId\");\n\nconst nestedMenuId = useId();\nconst rootMenuRef = ref<HTMLElement | null>(null);\nconst nestedMenuRef = ref<HTMLElement | null>(null);\nconst nestedMenuPopoverRef = ref<HTMLElement | null>(null);\nconst nestedMenuTriggerRef = ref<HTMLElement | null>(null);\n\nconst { floatingStyles, update: updateNestedMenuPosition } = useFloating(nestedMenuTriggerRef, nestedMenuPopoverRef, {\n  middleware: [offset(4), flip(), shift({ padding: 8 })],\n  placement: \"right-start\",\n  strategy: \"fixed\",\n  whileElementsMounted: autoUpdate,\n});\n\nconst closeNestedMenu = () => {\n  if (expandedOptionId.value !== undefined) expandedOptionId.value = undefined;\n};\n\nconst closeNestedMenuAndRestoreFocus = () => {\n  const parentId = expandedOptionId.value;\n  closeNestedMenu();\n  if (parentId) nextTick(() => focusParentOption(parentId));\n};\n\nconst ancestorMenuIds = inject(MenuAncestorIdsKey, []);\nconst menuHierarchyIds = [...ancestorMenuIds, nestedMenuId];\nprovide(MenuAncestorIdsKey, menuHierarchyIds);\n\nonClickOutside(\n  rootMenuRef,\n  (event) => {\n    const ancestorIds =\n      event.target instanceof Element\n        ? event.target.closest<HTMLElement>(\"[data-pv-menu-ancestors]\")?.dataset.pvMenuAncestors?.split(\" \")\n        : undefined;\n    if (!ancestorIds?.includes(nestedMenuId)) closeNestedMenu();\n  },\n  { ignore: [nestedMenuPopoverRef] },\n);\n\n// Vue 3.5 defineModel doesn't update local value synchronously when the prop\n// is passed by a parent (it only emits and waits for the parent to re-render).\n// This local ref is updated immediately so consecutive selections read correct state.\nconst localSelectedItems = shallowRef<MenuOption[]>(selectedItems.value);\n\nwatch(selectedItems, (newVal) => {\n  localSelectedItems.value = newVal;\n});\n\n// The last value this component itself pushed into the model. The sync-back watcher below must\n// skip own writes: because defineModel doesn't reflect a set until the parent re-renders,\n// comparing newVal against selectedItems.value alone mistakes every own write for a descendant\n// mutation and pushes it again — emitting update:selectedItems twice per selection (and, through\n// PvSelectButton, a doubled update:modelValue).\nlet lastModelWrite: MenuOption[] | undefined;\nconst writeSelectedItems = (value: MenuOption[]) => {\n  lastModelWrite = value;\n  selectedItems.value = value;\n};\n\n// Sync back to the model when descendants mutate localSelectedItems directly\n// (e.g. auto-selecting lazy-loaded children in PvMenuItem.handleSeeMoreClick).\nwatch(localSelectedItems, (newVal) => {\n  if (newVal !== lastModelWrite && newVal !== selectedItems.value) {\n    writeSelectedItems(newVal);\n  }\n});\n\nprovide(SelectedItemsKey, localSelectedItems);\nprovide(\n  MenuInteractionModeKey,\n  computed(() => props.childrenDisplay === \"popover\"),\n);\nconst cascadeSelectionEnabled = computed(() => props.childrenDisplay === \"inline\" && !!props.enableCascadeSelection);\nprovide(EnableCascadeSelectionKey, cascadeSelectionEnabled);\n\nconst originalOptionsMap = inject(OriginalOptionsMapKey, undefined);\nconst parentSelectsAllChildren = inject(ParentSelectsAllChildrenKey, ref(false));\nconst cascadeSelectedParentIds = inject(CascadeSelectedParentIdsKey, undefined);\nconst cascadeDeselectedChildIds = inject(CascadeDeselectedChildIdsKey, undefined);\n\nconst isSingleSelect = computed(() => props.singleSelect || props.config?.variant === \"radio\");\nconst expandedOption = computed(() =>\n  props.options.find((option) => option.id === expandedOptionId.value && option.children?.length),\n);\n\nconst openNestedMenu = (option: MenuOption, target: HTMLElement, focusFirstItem = false, toggle = true) => {\n  const shouldOpen = !toggle || expandedOptionId.value !== option.id;\n  expandedOptionId.value = shouldOpen ? option.id : undefined;\n  if (!shouldOpen) return;\n\n  nestedMenuTriggerRef.value = target;\n  nextTick(() => {\n    updateNestedMenuPosition();\n    if (focusFirstItem) {\n      focusMenuItem(nestedMenuRef.value ?? document.getElementById(nestedMenuId), 0);\n    }\n  });\n};\n\nconst handleItemSelected = (event: MenuOptionSelectedEvent, nested = false) => {\n  if (props.readOnly) return;\n  const option =\n    (!nested && props.childrenDisplay === \"popover\"\n      ? props.options.find((candidate) => candidate.id === event.option.id)\n      : undefined) ?? event.option;\n  if (props.childrenDisplay === \"popover\" && !nested && option.children?.length) {\n    const target = (event.event.currentTarget as HTMLElement | null)?.closest<HTMLElement>(\"li\");\n    if (target) openNestedMenu(option, target);\n    return;\n  }\n  let newSelection: MenuOption[];\n\n  if (cascadeSelectionEnabled.value && hasCascadeChildren(option)) {\n    // Only leaf options are added to the selection — the parent itself is never\n    // included because it is purely an organisational node, not a selectable value.\n    // When parentSelectsAllChildren is true, use the original (unfiltered)\n    // children so clicking a parent selects all children regardless of search query.\n    let leafOptions: MenuOption[];\n    if (parentSelectsAllChildren.value && originalOptionsMap?.value) {\n      const originalOption = originalOptionsMap.value.get(option.id);\n      const originalLeaves = originalOption?.children ? collectLeafOptions(originalOption.children) : [];\n      const currentLeaves = option.children ? collectLeafOptions(option.children) : [];\n      leafOptions = mergeLeafOptions(originalLeaves, currentLeaves);\n    } else {\n      leafOptions = option.children ? collectLeafOptions(option.children) : [];\n    }\n    const leafIds = leafOptions.map((o) => o.id);\n    const current = localSelectedItems.value;\n    const parentSelected = cascadeSelectedParentIds?.value?.has(option.id) ?? false;\n    const anySelected = parentSelected || leafIds.some((id) => current.some((item) => item.id === id));\n    newSelection = anySelected ? current.filter((item) => !leafIds.includes(item.id)) : [...current, ...leafOptions];\n\n    // Track whether this parent was explicitly clicked for cascade selection\n    if (cascadeSelectedParentIds?.value) {\n      const next = new Set(cascadeSelectedParentIds.value);\n      if (anySelected) {\n        next.delete(option.id);\n      } else {\n        next.add(option.id);\n      }\n      cascadeSelectedParentIds.value = next;\n    }\n    // Clear deselected children tracking when parent is explicitly toggled\n    if (cascadeDeselectedChildIds?.value?.has(option.id)) {\n      const next = new Map(cascadeDeselectedChildIds.value);\n      next.delete(option.id);\n      cascadeDeselectedChildIds.value = next;\n    }\n  } else if (isSingleSelect.value) {\n    if (localSelectedItems.value.length === 1 && localSelectedItems.value[0].id === option.id) {\n      newSelection = props.disableDeselect ? localSelectedItems.value : [];\n    } else {\n      newSelection = [option];\n    }\n  } else {\n    const index = localSelectedItems.value.findIndex((item) => item.id === option.id);\n    if (index > -1) {\n      newSelection = [...localSelectedItems.value.slice(0, index), ...localSelectedItems.value.slice(index + 1)];\n    } else {\n      newSelection = [...localSelectedItems.value, option];\n    }\n\n    // Track individually deselected/re-selected children under selected parents\n    // so dynamically loaded children (see-more) can inherit the correct state.\n    if (cascadeSelectionEnabled.value && cascadeSelectedParentIds?.value && cascadeDeselectedChildIds?.value) {\n      const isDeselecting = index > -1;\n      for (const parentId of cascadeSelectedParentIds.value) {\n        // Find if this child belongs to this parent\n        const parentOption = originalOptionsMap?.value?.get(parentId);\n        const parentChildren = parentOption?.children ?? props.options.find((o) => o.id === parentId)?.children;\n        if (!parentChildren) continue;\n        const leaves = collectLeafOptions(parentChildren);\n        // Also check the option itself as it may have been dynamically loaded\n        const isChildOfParent =\n          leaves.some((l) => l.id === option.id) ||\n          props.options.find((o) => o.id === parentId)?.children?.some((c) => c.id === option.id);\n        if (!isChildOfParent) continue;\n\n        const next = new Map(cascadeDeselectedChildIds.value);\n        const deselected = new Set(next.get(parentId) ?? []);\n        if (isDeselecting) {\n          deselected.add(option.id);\n        } else {\n          deselected.delete(option.id);\n        }\n        if (deselected.size > 0) {\n          next.set(parentId, deselected);\n        } else {\n          next.delete(parentId);\n        }\n        cascadeDeselectedChildIds.value = next;\n        break;\n      }\n    }\n  }\n\n  localSelectedItems.value = newSelection;\n  writeSelectedItems(newSelection);\n\n  if (!nested && props.childrenDisplay === \"popover\") expandedOptionId.value = undefined;\n  emit(\"handle-selected\", props.childrenDisplay === \"popover\" ? { ...event, option } : event);\n};\n\nconst handleNestedItemSelected = (event: MenuOptionSelectedEvent) => {\n  const parentOption = expandedOption.value;\n  if (!parentOption) return;\n  const option = parentOption.children?.find((child) => child.id === event.option.id) ?? event.option;\n  handleItemSelected({ ...event, option }, true);\n  expandedOptionId.value = undefined;\n  nextTick(() => focusParentOption(parentOption.id));\n};\n\nconst selectedIds = computed(() => new Set(localSelectedItems.value.map((item) => item.id)));\n\nconst findSelectedDescendant = (children: MenuOption[]): MenuOption | undefined => {\n  for (const child of children) {\n    if (selectedIds.value.has(child.id)) return child;\n    const selectedChild = child.children?.length ? findSelectedDescendant(child.children) : undefined;\n    if (selectedChild) return selectedChild;\n  }\n  return undefined;\n};\n\nconst menuItemOption = (option: MenuOption): MenuOption => {\n  if (props.childrenDisplay !== \"popover\" || !option.children?.length) return option;\n  const selectedChild = findSelectedDescendant(option.children);\n  return {\n    ...option,\n    children: undefined,\n    classList: [...(option.classList ?? []), \"pv-menu-nested\"],\n    subText: selectedChild?.text ?? option.subText,\n    totalChildCount: undefined,\n  };\n};\n\nconst directChildMenuItemOption = (option: MenuOption): MenuOption => ({\n  ...option,\n  children: undefined,\n  totalChildCount: undefined,\n});\n\nconst menuItemConfig = (option: MenuOption) =>\n  props.childrenDisplay === \"popover\" ? (option.config ?? props.config) : props.config;\n\nconst isActive = (option: MenuOption): true | null => {\n  if (selectedIds.value.has(option.id)) {\n    return true;\n  }\n  if (cascadeSelectionEnabled.value && cascadeSelectedParentIds?.value?.has(option.id)) {\n    return true;\n  }\n  if (\n    (cascadeSelectionEnabled.value || props.childrenDisplay === \"popover\") &&\n    option.children?.length &&\n    findSelectedDescendant(option.children)\n  ) {\n    return true;\n  }\n  return null;\n};\n\nconst menuItemRole = (option: MenuOption): \"menuitem\" | \"menuitemcheckbox\" | \"menuitemradio\" => {\n  const variant = option.config?.variant ?? props.config?.variant;\n  if (isSingleSelect.value || variant === \"radio\") return \"menuitemradio\";\n  if (variant === \"checkbox\") return \"menuitemcheckbox\";\n  return \"menuitem\";\n};\n\nconst menuItemChecked = (option: MenuOption): boolean | undefined =>\n  menuItemRole(option) === \"menuitem\" ? undefined : !!isActive(option);\n\nconst itemDataActive = (option: MenuOption): true | null => {\n  if (option.children?.length && !props.highlightParentItems) return null;\n  return (menuItemRole(option) !== \"menuitemcheckbox\" && isActive(option)) || expandedOptionId.value === option.id\n    ? true\n    : null;\n};\n\nconst nestedItemDataActive = (option: MenuOption): true | null =>\n  menuItemRole(option) !== \"menuitemcheckbox\" && selectedIds.value.has(option.id) ? true : null;\n\nconst isVisible = (option: MenuOption, isLoading?: boolean): boolean => {\n  if (!isLoading) return true;\n  if (selectedIds.value.has(option.id)) return true;\n  if (cascadeSelectedParentIds?.value?.has(option.id)) return true;\n  if (option.children?.length && findSelectedDescendant(option.children)) return true;\n  return false;\n};\n\nconst SEE_MORE_OPTION_ID = \"__pv-menu-see-more__\";\nconst focusedTopLevelOptionId = ref<string>();\nconst focusedNestedOptionId = ref<string>();\n\nconst topLevelTabStopId = computed(() => {\n  const focusableOptionIds = props.options\n    .filter((option) => !props.readOnly && !option.disabled && isVisible(option, props.isLoading))\n    .map((option) => option.id);\n  if (props.hasMoreOptions && !props.isSeeMoreLoading) focusableOptionIds.push(SEE_MORE_OPTION_ID);\n  return focusedTopLevelOptionId.value && focusableOptionIds.includes(focusedTopLevelOptionId.value)\n    ? focusedTopLevelOptionId.value\n    : focusableOptionIds[0];\n});\n\nconst nestedTabStopId = computed(() => {\n  const focusableOptions =\n    expandedOption.value?.children?.filter((option) => !props.readOnly && !option.disabled) ?? [];\n  return focusableOptions.some((option) => option.id === focusedNestedOptionId.value)\n    ? focusedNestedOptionId.value\n    : focusableOptions[0]?.id;\n});\n\nconst menuItems = (menu: HTMLElement | null): HTMLElement[] => {\n  const roleItems = Array.from(\n    menu?.querySelectorAll<HTMLElement>(\"li[role='none'] > [role^='menuitem']:not([aria-disabled='true'])\") ?? [],\n  ).filter((item) => !item.hidden && item.style.display !== \"none\");\n  if (roleItems.length) return roleItems;\n\n  return Array.from(\n    menu?.querySelectorAll<HTMLElement>(\n      \"button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\",\n    ) ?? [],\n  ).filter((item) => !item.hidden && item.style.display !== \"none\");\n};\n\nconst focusMenuItem = (menu: HTMLElement | null, index: number) => {\n  const items = menuItems(menu);\n  if (!items.length) return;\n  items[(index + items.length) % items.length]?.focus();\n};\n\nconst focusRelativeMenuItem = (menu: HTMLElement | null, current: HTMLElement, offset: number) => {\n  const items = menuItems(menu);\n  const currentIndex = items.indexOf(current);\n  if (!items.length || currentIndex < 0) return;\n  items[(currentIndex + offset + items.length) % items.length]?.focus();\n};\n\nconst focusParentOption = (optionId: string) => {\n  menuItems(rootMenuRef.value)\n    .find((item) => item.dataset.optionId === optionId)\n    ?.focus();\n};\n\nwatch(\n  // Also re-sync when the row leaves and re-enters `options`, since its <li> is re-created.\n  [expandedOptionId, () => !!expandedOption.value],\n  ([optionId]) => {\n    focusedNestedOptionId.value = undefined;\n    if (!optionId) return;\n    nextTick(() => {\n      const target = Array.from(rootMenuRef.value?.children ?? []).find(\n        (item) => (item as HTMLElement).dataset.optionId === optionId,\n      ) as HTMLElement | undefined;\n      if (!target) return;\n      nestedMenuTriggerRef.value = target;\n      updateNestedMenuPosition();\n    });\n  },\n  { immediate: true },\n);\n\nconst handleMenuNavigation = (event: KeyboardEvent, menu: HTMLElement | null): boolean => {\n  switch (event.key) {\n    case \"ArrowDown\":\n      event.preventDefault();\n      focusRelativeMenuItem(menu, event.currentTarget as HTMLElement, 1);\n      return true;\n    case \"ArrowUp\":\n      event.preventDefault();\n      focusRelativeMenuItem(menu, event.currentTarget as HTMLElement, -1);\n      return true;\n    case \"Home\":\n      event.preventDefault();\n      focusMenuItem(menu, 0);\n      return true;\n    case \"End\":\n      event.preventDefault();\n      focusMenuItem(menu, -1);\n      return true;\n    default:\n      return false;\n  }\n};\n\nconst handleTopLevelKeydown = (event: KeyboardEvent, option: MenuOption) => {\n  if (event.target !== event.currentTarget || handleMenuNavigation(event, rootMenuRef.value)) return;\n  switch (event.key) {\n    case \"ArrowRight\":\n      if (!option.children?.length) break;\n      event.preventDefault();\n      openNestedMenu(option, event.currentTarget as HTMLElement, true, false);\n      break;\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      if (option.children?.length) {\n        openNestedMenu(option, event.currentTarget as HTMLElement, true, false);\n      } else {\n        handleItemSelected({ event, option });\n      }\n      break;\n    case \"Escape\":\n      if (!expandedOptionId.value) break;\n      event.preventDefault();\n      event.stopPropagation();\n      expandedOptionId.value = undefined;\n      break;\n    case \"Tab\":\n      expandedOptionId.value = undefined;\n      break;\n  }\n};\n\nconst handleSeeMoreKeydown = (event: KeyboardEvent) => {\n  if (handleMenuNavigation(event, rootMenuRef.value)) return;\n  switch (event.key) {\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      emit(\"see-more\", { parentId: undefined });\n      break;\n    case \"Escape\":\n    case \"Tab\":\n      closeNestedMenu();\n      break;\n  }\n};\n\nconst handleNestedKeydown = (event: KeyboardEvent, option: MenuOption) => {\n  if (event.target !== event.currentTarget || handleMenuNavigation(event, nestedMenuRef.value)) return;\n  switch (event.key) {\n    case \"ArrowLeft\":\n    case \"Escape\": {\n      event.preventDefault();\n      if (event.key === \"Escape\") event.stopPropagation();\n      const parentId = expandedOptionId.value;\n      expandedOptionId.value = undefined;\n      if (parentId) nextTick(() => focusParentOption(parentId));\n      break;\n    }\n    case \"Enter\":\n    case \" \":\n      event.preventDefault();\n      handleNestedItemSelected({ event, option });\n      break;\n    case \"Tab\":\n      expandedOptionId.value = undefined;\n      break;\n  }\n};\n</script>\n\n<template>\n  <ul ref=\"rootMenuRef\" :role=\"childrenDisplay === 'popover' ? 'menu' : 'list'\" class=\"pv-popover-list\" v-bind=\"$attrs\">\n    <li\n      v-for=\"option in options\"\n      v-show=\"isVisible(option, isLoading)\"\n      :key=\"option.id\"\n      :data-active=\"itemDataActive(option)\"\n      :data-option-id=\"option.id\"\n      :data-testid=\"itemTestId\"\n      :class=\"itemClass\"\n      :role=\"childrenDisplay === 'popover' ? 'none' : undefined\"\n    >\n      <PvMenuItem\n        v-bind=\"menuItemOption(option)\"\n        :aria-checked=\"childrenDisplay === 'popover' ? menuItemChecked(option) : undefined\"\n        :aria-controls=\"childrenDisplay === 'popover' && option.children?.length ? nestedMenuId : undefined\"\n        :aria-disabled=\"childrenDisplay === 'popover' && (props.readOnly || option.disabled) ? 'true' : undefined\"\n        :aria-expanded=\"\n          childrenDisplay === 'popover' && option.children?.length ? expandedOptionId === option.id : undefined\n        \"\n        :aria-haspopup=\"\n          childrenDisplay === 'popover' && option.children?.length ? (option.popoverRole ?? 'menu') : undefined\n        \"\n        :data-active=\"itemDataActive(option)\"\n        :data-dd-action-name=\"option.rumActionName\"\n        :data-option-id=\"option.id\"\n        :disabled=\"props.readOnly || option.disabled\"\n        :config=\"menuItemConfig(option)\"\n        :itemClass=\"itemClass\"\n        :queryText=\"queryText\"\n        :role=\"childrenDisplay === 'popover' ? menuItemRole(option) : undefined\"\n        :tabindex=\"childrenDisplay === 'popover' ? (topLevelTabStopId === option.id ? 0 : -1) : undefined\"\n        @focus=\"focusedTopLevelOptionId = option.id\"\n        @keydown=\"childrenDisplay === 'popover' ? handleTopLevelKeydown($event, option) : undefined\"\n        @handle-selected=\"handleItemSelected\"\n        @see-more=\"emit('see-more', $event)\"\n      />\n    </li>\n    <li v-if=\"hasMoreOptions\" :role=\"childrenDisplay === 'popover' ? 'none' : undefined\">\n      <PvButton\n        class=\"pv-text-brand\"\n        variant=\"ghost\"\n        label=\"See more\"\n        :loading=\"isSeeMoreLoading\"\n        :disabled=\"isSeeMoreLoading\"\n        :role=\"childrenDisplay === 'popover' ? 'menuitem' : undefined\"\n        :tabindex=\"childrenDisplay === 'popover' ? (topLevelTabStopId === SEE_MORE_OPTION_ID ? 0 : -1) : undefined\"\n        data-testid=\"pv-menu-see-more\"\n        @focus=\"focusedTopLevelOptionId = SEE_MORE_OPTION_ID\"\n        @keydown=\"childrenDisplay === 'popover' ? handleSeeMoreKeydown($event) : undefined\"\n        @click=\"emit('see-more', { parentId: undefined })\"\n      />\n    </li>\n  </ul>\n\n  <Teleport v-if=\"childrenDisplay === 'popover' && expandedOption\" to=\"body\">\n    <div\n      ref=\"nestedMenuPopoverRef\"\n      class=\"pv-menu-popover\"\n      :data-pv-menu-ancestors=\"menuHierarchyIds.join(' ')\"\n      :style=\"floatingStyles\"\n    >\n      <PvPopover\n        class=\"pv-scrollbar-visible\"\n        :css-custom-properties=\"{ position: 'static', width: 'max-content', maxWidth: 'calc(100vw - 16px)' }\"\n      >\n        <slot\n          name=\"popover\"\n          :option=\"expandedOption\"\n          :popover-id=\"nestedMenuId\"\n          :close=\"closeNestedMenuAndRestoreFocus\"\n        >\n          <ul\n            :id=\"nestedMenuId\"\n            ref=\"nestedMenuRef\"\n            :aria-label=\"`${expandedOption.text} options`\"\n            class=\"pv-popover-list\"\n            role=\"menu\"\n          >\n            <li\n              v-for=\"option in expandedOption.children\"\n              :key=\"option.id\"\n              :data-active=\"nestedItemDataActive(option)\"\n              :data-option-id=\"option.id\"\n              :class=\"itemClass\"\n              role=\"none\"\n            >\n              <PvMenuItem\n                v-bind=\"directChildMenuItemOption(option)\"\n                :aria-checked=\"menuItemChecked(option)\"\n                :aria-disabled=\"props.readOnly || option.disabled ? 'true' : undefined\"\n                :data-active=\"nestedItemDataActive(option)\"\n                :data-dd-action-name=\"option.rumActionName\"\n                :data-option-id=\"option.id\"\n                :disabled=\"props.readOnly || option.disabled\"\n                :config=\"menuItemConfig(option)\"\n                :itemClass=\"itemClass\"\n                :queryText=\"queryText\"\n                :role=\"menuItemRole(option)\"\n                :tabindex=\"nestedTabStopId === option.id ? 0 : -1\"\n                @focus=\"focusedNestedOptionId = option.id\"\n                @keydown=\"handleNestedKeydown($event, option)\"\n                @handle-selected=\"handleNestedItemSelected\"\n                @see-more=\"emit('see-more', $event)\"\n              />\n            </li>\n          </ul>\n        </slot>\n      </PvPopover>\n    </div>\n  </Teleport>\n</template>\n\n<style scoped>\n.pv-menu-popover {\n  z-index: 50;\n}\n\n.pv-popover-list > li:last-child > :deep(.pv-label) {\n  margin-block-end: 0;\n}\n\n:deep(.pv-menu-nested)::after {\n  content: \"\";\n  width: 0.4rem;\n  height: 0.4rem;\n  margin-right: 0.2rem;\n  margin-left: auto;\n  flex-shrink: 0;\n  border-top: 1.5px solid currentColor;\n  border-right: 1.5px solid currentColor;\n  transform: rotate(45deg);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"T\">\nimport { watch, useTemplateRef, computed, nextTick, shallowRef, provide } from \"vue\";\nimport { useToggle, onKeyStroke } from \"@vueuse/core\";\n\nimport { PvSearchInputExposed } from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSelectControlPanel from \"../PvMenu/PvMenuControlPanel.vue\";\nimport PvSearchInput from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvSelectButtonTrigger from \"@/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue\";\nimport PvMenuEmptyState from \"../PvMenu/PvMenuEmptyState.vue\";\nimport PvMenu from \"../PvMenu/PvMenu.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\n\nimport { PvMultiSelectButtonProps } from \"./types\";\nimport { MenuOption, MenuOptionConfig, MultiSelectState, SelectionNode, SeeMoreEvent } from \"@/types\";\nimport {\n  collectLeafOptions,\n  countFromSelectionState,\n  countWithCollapsedParents,\n  filterOptionsRecursive,\n  hasCascadeChildren,\n} from \"../PvMenu/cascadeUtils\";\nimport {\n  OriginalOptionsMapKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n  ParentSelectsAllChildrenKey,\n  EnableChildExpansionKey,\n} from \"../PvMenu/symbols\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\n\nconst props = withDefaults(defineProps<PvMultiSelectButtonProps<T>>(), {\n  counterPosition: \"left\",\n  variant: \"secondary\",\n  size: \"lg\",\n  label: \"Select\",\n  disableDropdownIcon: false,\n  disableClearIcon: false,\n  disableSearchInput: false,\n  disabled: false,\n  optionsVariant: \"checkbox\",\n  options: () => [] as MenuOption<T>[],\n  menuActionsVariant: \"select-clear\",\n  footerPosition: \"above-actions\",\n  singleSelect: false,\n  highlightSearchText: false,\n  enableCascadeSelection: false,\n  counterStyle: \"primary\",\n});\n\nconst optionConfig = computed(() => {\n  const config: MenuOptionConfig = {\n    renderer: props.optionsRenderer,\n    action: props.optionsAction,\n    variant: props.optionsVariant,\n    counterBadgeVariant: props.counterBadgeVariant,\n    size: props.size,\n  };\n  return config;\n});\n\n// Build a map from option id → original (unfiltered) option so that descendants\n// can look up the full children list when parentSelectsAllChildren is true.\nconst originalOptionsMap = computed(() => {\n  const map = new Map<string, MenuOption<T>>();\n  const buildMap = (options: MenuOption<T>[]) => {\n    for (const option of options) {\n      map.set(option.id, option);\n      if (option.children?.length) buildMap(option.children);\n    }\n  };\n  buildMap(props.options);\n  return map;\n});\n\nconst cascadeSelectedParentIds = shallowRef<Set<string>>(new Set());\nconst cascadeDeselectedChildIds = shallowRef<Map<string, Set<string>>>(new Map());\n\nprovide(OriginalOptionsMapKey, originalOptionsMap);\nprovide(CascadeSelectedParentIdsKey, cascadeSelectedParentIds);\nprovide(CascadeDeselectedChildIdsKey, cascadeDeselectedChildIds);\nprovide(\n  ParentSelectsAllChildrenKey,\n  computed(() => props.parentSelectsAllChildren),\n);\nprovide(\n  EnableChildExpansionKey,\n  computed(() => !!props.enableChildExpansion),\n);\n\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n  (e: \"select-all\", valueCount: number): void;\n  (e: \"clear-all\", valueCount: number): void;\n}>();\n\n/** Pre-computed mapping of parent option ID → its leaf descendant options. */\nconst parentLeafMap = computed(() => {\n  const map = new Map<string, MenuOption<T>[]>();\n  for (const [id, option] of originalOptionsMap.value) {\n    if (hasCascadeChildren(option)) {\n      map.set(id, option.children ? collectLeafOptions(option.children) : []);\n    }\n  }\n  return map;\n});\n\nconst getSelectionState = (): MultiSelectState => {\n  const parentLeafIds = new Set<string>();\n  if (cascadeSelectedParentIds.value.size > 0) {\n    for (const parentId of cascadeSelectedParentIds.value) {\n      const leaves = parentLeafMap.value.get(parentId);\n      if (leaves) {\n        for (const leaf of leaves) parentLeafIds.add(leaf.id);\n      }\n    }\n  }\n\n  const nodes: SelectionNode[] = [];\n\n  for (const parentId of cascadeSelectedParentIds.value) {\n    const deselected = cascadeDeselectedChildIds.value.get(parentId);\n    const node: SelectionNode = { id: parentId, state: \"selected\" };\n    if (deselected?.size) {\n      node.children = [...deselected].map((childId) => ({\n        id: childId,\n        state: \"deselected\" as const,\n      }));\n    }\n    nodes.push(node);\n  }\n\n  for (const item of selectedItems.value) {\n    if (!parentLeafIds.has(item.id)) {\n      nodes.push({ id: item.id, state: \"selected\" });\n    }\n  }\n\n  return nodes;\n};\n\nconst hasMoreOptions = computed(() => {\n  if (props.hasMoreOptions != null) return props.hasMoreOptions;\n  if (props.totalOptionCount == null) return false;\n  return props.totalOptionCount > props.options.length;\n});\n\nconst counterValue = computed(() => {\n  const additional = props.additionalCounter ?? 0;\n  if (props.enableCascadeSelection && props.countSelectedParents && modelSelectionState.value?.length) {\n    return countFromSelectionState(modelSelectionState.value) + additional;\n  }\n  if (!props.countSelectedParents || !props.enableCascadeSelection) {\n    return selectedItems.value.length + additional;\n  }\n  const selectedIds = new Set(selectedItems.value.map((item) => item.id));\n  return countWithCollapsedParents(props.options, selectedIds) + additional;\n});\n\nconst hasSelection = computed(() => {\n  if (selectedItems.value.length > 0) return true;\n  if (props.enableCascadeSelection && modelSelectionState.value?.length) {\n    return modelSelectionState.value.some((node) => node.state === \"selected\");\n  }\n  return false;\n});\n\nconst handleSeeMore = (payload?: SeeMoreEvent) => {\n  emits(\"see-more\", payload ?? {});\n};\n\nconst searchInputComponentRef = useTemplateRef<PvSearchInputExposed | null>(\"searchInputRef\");\n\nconst [open, handleOpen] = useToggle<boolean>(props.defaultOpen);\nconst modelSelectedItems = defineModel<MenuOption<T>[]>({\n  required: false,\n  default: () => [],\n});\nconst modelSelectionState = defineModel<MultiSelectState>(\"selectionState\");\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n  default: \"\",\n});\n\nconst suppressChangesUntilConfirmed = computed(() => {\n  return props.menuActionsVariant === \"cancel-confirm\";\n});\n\nconst storeSelectedItems = (newSelection: MenuOption<T>[]) => {\n  selectedItems.value = newSelection;\n  if (!suppressChangesUntilConfirmed.value) {\n    modelSelectedItems.value = newSelection;\n    modelSelectionState.value = getSelectionState();\n  }\n};\n\nconst applyPendingSelection = () => {\n  if (suppressChangesUntilConfirmed.value) {\n    modelSelectedItems.value = selectedItems.value;\n    modelSelectionState.value = getSelectionState();\n  }\n};\n\nconst resetPendingSelection = () => {\n  if (suppressChangesUntilConfirmed.value) {\n    selectedItems.value = modelSelectedItems.value;\n  }\n};\n\n// with cancel-confirm, we hold changes until confirmed\nconst selectedItems = shallowRef<MenuOption<T>[]>(modelSelectedItems.value);\n\nconst findOptionById = (id: string): MenuOption<T> | undefined => originalOptionsMap.value.get(id);\n\nconst syncFromSelectionState = (state: MultiSelectState | undefined) => {\n  if (!props.enableCascadeSelection || !state) return;\n\n  const nextSelectedParents = new Set<string>();\n  const nextDeselectedChildren = new Map<string, Set<string>>();\n  const nextSelectedItems: MenuOption<T>[] = [];\n  const selectedIds = new Set<string>();\n\n  const addSelectedItem = (option: MenuOption<T> | undefined, id: string) => {\n    if (selectedIds.has(id)) return;\n    selectedIds.add(id);\n    // Placeholder for unresolved nodes — the trigger badge prefers `…` over the\n    // raw scoped token (e.g. `__provider_id__PV_1004__health_system__Kaiser`)\n    // until the props.options watcher re-runs this sync with metadata loaded.\n    nextSelectedItems.push(option ?? ({ id, text: \"…\" } as MenuOption<T>));\n  };\n\n  for (const node of state) {\n    if (node.state !== \"selected\") continue;\n\n    const deselectedIds = new Set(\n      (node.children || []).filter((child) => child.state === \"deselected\").map((child) => child.id),\n    );\n    const leafOptions = parentLeafMap.value.get(node.id);\n\n    if (leafOptions) {\n      nextSelectedParents.add(node.id);\n      if (deselectedIds.size > 0) {\n        nextDeselectedChildren.set(node.id, deselectedIds);\n      }\n      for (const leaf of leafOptions) {\n        if (!deselectedIds.has(leaf.id)) {\n          addSelectedItem(leaf, leaf.id);\n        }\n      }\n      continue;\n    }\n\n    addSelectedItem(findOptionById(node.id), node.id);\n  }\n\n  cascadeSelectedParentIds.value = nextSelectedParents;\n  cascadeDeselectedChildIds.value = nextDeselectedChildren;\n  selectedItems.value = nextSelectedItems;\n};\n\nconst menuSelectedItems = computed({\n  get: () => selectedItems.value,\n  set: (newValue: MenuOption<T>[]) => {\n    storeSelectedItems(newValue);\n  },\n});\n\nconst closeDropdown = () => {\n  searchInput.value = \"\";\n  open.value = false;\n};\n\nconst popoverOffset = computed(() => {\n  // get width of trigger element to offset popover correctly when overlay trigger is enabled\n  const size = props.size === \"lg\" ? 24 : 30;\n  return props.overlayTrigger ? -size : undefined;\n});\n\n// sync when parent updates modelSelectedItems directly\nwatch(\n  () => modelSelectedItems.value,\n  (newValue) => {\n    if (props.enableCascadeSelection && modelSelectionState.value?.length && newValue.length === 0) {\n      syncFromSelectionState(modelSelectionState.value);\n      return;\n    }\n    selectedItems.value = newValue;\n  },\n);\n\nwatch(\n  () => [modelSelectionState.value, props.options] as const,\n  () => {\n    syncFromSelectionState(modelSelectionState.value);\n  },\n  { deep: true, immediate: true },\n);\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    resetPendingSelection();\n    nextTick(() => {\n      // if overlay trigger is enabled and search input exists, auto-target the search input\n      if (props.overlayTrigger && !props.disableSearchInput) {\n        searchInputComponentRef.value?.input?.focus();\n      }\n      emits(\"dropdown-open\");\n    });\n  } else {\n    // on close, discard pending changes\n    resetPendingSelection();\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst filteredOptions = computed(() => {\n  if (searchInput.value === \"\") return props.options;\n  const searchValue = searchInput.value.toLocaleLowerCase();\n\n  if (props.enableCascadeSelection) {\n    return filterOptionsRecursive(props.options, searchValue, !props.hideParentOnChildQueryMatch);\n  }\n\n  return props.options.filter(\n    (option) =>\n      option.text.toLocaleLowerCase().includes(searchValue) ||\n      option.searchText?.toLocaleLowerCase().includes(searchValue),\n  );\n});\n\nconst handleSelectAll = () => {\n  // Mark all parents as cascade-selected (select-all intent) before\n  // storing so the selection state snapshot is accurate.\n  if (props.enableCascadeSelection) {\n    const parentIds = new Set<string>();\n    const collectParentIds = (options: MenuOption<T>[]) => {\n      for (const option of options) {\n        if (hasCascadeChildren(option)) {\n          parentIds.add(option.id);\n          if (option.children?.length) collectParentIds(option.children);\n        }\n      }\n    };\n    collectParentIds(filteredOptions.value as MenuOption<T>[]);\n    cascadeSelectedParentIds.value = parentIds;\n    cascadeDeselectedChildIds.value = new Map();\n  }\n\n  // select all visible item values (excluded ones filtered out by search)\n  const toSelect = props.enableCascadeSelection\n    ? collectLeafOptions(filteredOptions.value as MenuOption<T>[])\n    : filteredOptions.value;\n  emits(\"select-all\", toSelect.length);\n  storeSelectedItems(toSelect);\n};\n\nconst handleClearAll = () => {\n  emits(\"clear-all\", selectedItems.value.length);\n  cascadeSelectedParentIds.value = new Set();\n  cascadeDeselectedChildIds.value = new Map();\n  storeSelectedItems([]);\n};\n\nconst handleCancelSelection = () => {\n  resetPendingSelection();\n  closeDropdown();\n};\n\nconst handleConfirmSelection = () => {\n  applyPendingSelection();\n  closeDropdown();\n};\n\nconst groupingOptions = computed(() => {\n  if (!props.groupings) return;\n\n  const groupingMap = new Map<string, MenuOption[]>();\n\n  props.groupings.forEach((group) => {\n    groupingMap.set(group, []);\n  });\n\n  groupingMap.set(\"other\", []);\n\n  for (const option of props.options) {\n    const groupKey = option.groupingLabel;\n    const targetGroup = groupKey && groupingMap.has(groupKey) ? groupKey : \"other\";\n    groupingMap.get(targetGroup)!.push(option);\n  }\n\n  for (const [key, options] of groupingMap) {\n    if (options.length === 0) {\n      groupingMap.delete(key);\n    }\n  }\n\n  return Array.from(groupingMap.entries());\n});\n\nconst showGroupings = computed(() => {\n  return props.groupings && searchInput.value === \"\";\n});\n\nconst allSlotProps = computed(() => ({\n  ...props,\n  selectedItems: modelSelectedItems.value,\n  searchInput: searchInput.value,\n  slotContext: props.slotContext,\n  isOpen: open.value,\n  isLoading: props.isLoading,\n  filteredOptionCount: filteredOptions.value.length,\n}));\n\n// Derive a distinct name for this RUM action. Leave undefined to suppress.\nconst rumTriggerActionName = computed(() => {\n  if (props.rumActionName) return props.rumActionName;\n  return props.rumFilterName ? `Open ${props.rumFilterName} filter` : undefined;\n});\nconst rumSearchActionName = computed(() => (props.rumFilterName ? `Search ${props.rumFilterName} options` : undefined));\n\nconst popoverContentRef = useTemplateRef<HTMLElement | null>(\"popoverContentRef\");\nconst slotHost = computed(() => {\n  const rootNode = popoverContentRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\nconst { present: hasHeaderSlot } = useSlotPresence(\"header\", { host: slotHost });\nconst { present: hasNoResultsSlot } = useSlotPresence(\"no-results\", { host: slotHost });\nconst { present: hasFooterSlot } = useSlotPresence(\"footer\", { host: slotHost });\n\nonKeyStroke(\"Escape\", () => {\n  if (!open.value) return;\n\n  closeDropdown();\n});\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"open\" v-bind=\"popoverProperties\" :offset=\"popoverOffset\">\n    <template #trigger>\n      <PvSelectButtonTrigger\n        ref=\"select-button-trigger-ref\"\n        :variant=\"variant\"\n        :size=\"size\"\n        :disabled=\"disabled\"\n        :counterPosition=\"counterPosition\"\n        :prefixLabel=\"prefixLabel\"\n        :label=\"label\"\n        :icon=\"icon\"\n        :companyLogo=\"companyLogo\"\n        :showClear=\"!disableClearIcon && hasSelection && !disabled\"\n        :showDropdown=\"!disableDropdownIcon && (disabled || !(hasSelection && !disableClearIcon))\"\n        :open=\"open\"\n        :counter-value=\"counterValue\"\n        :counter-style=\"counterStyle\"\n        :selected-items=\"selectedItems\"\n        :data-dd-action-name=\"rumTriggerActionName\"\n        @handle-clear=\"handleClearAll\"\n        @handle-toggle-dropdown=\"handleOpen()\"\n      />\n    </template>\n    <template #content>\n      <div\n        ref=\"popoverContentRef\"\n        class=\"pv-popover\"\n        data-test-id=\"pv-popover\"\n        :style=\"{ '--position': 'unset', ...popoverCssProperties }\"\n      >\n        <template v-if=\"!disableSearchInput\">\n          <div class=\"pv-inset-square-8 pv-border-bottom\" :data-dd-action-name=\"rumSearchActionName\">\n            <PvSearchInput\n              ref=\"searchInputRef\"\n              v-model:model-value=\"searchInput\"\n              class=\"pv-stack-4\"\n              :placeholder=\"searchPlaceholder\"\n            />\n          </div>\n        </template>\n        <div v-if=\"$slots.header || hasHeaderSlot\" class=\"pv-inset-square-8\">\n          <slot name=\"header\" v-bind=\"allSlotProps\" />\n        </div>\n        <template v-if=\"filteredOptions.length > 0\">\n          <template v-if=\"showGroupings\">\n            <div v-for=\"([label, options], index) in groupingOptions\" :key=\"label\">\n              <slot v-if=\"$slots[label]\" :name=\"label\" />\n              <span\n                class=\"pv-text-body-sm pv-inset-inline\"\n                style=\"color: var(--color-text-quaternary, #89989b); --inset-size: 8px\"\n                v-else-if=\"label !== 'other'\"\n                >{{ label }}</span\n              >\n              <PvMenu\n                v-model:selectedItems=\"menuSelectedItems\"\n                :options=\"options\"\n                :config=\"optionConfig\"\n                :singleSelect=\"singleSelect\"\n                :queryText=\"highlightSearchText ? searchInput : null\"\n                :itemTestId=\"`pv-multiselect-${label}-item`\"\n                itemClass=\"pv-stack-4\"\n                :isLoading=\"isLoading\"\n                :isSeeMoreLoading=\"isSeeMoreLoading\"\n                :enableCascadeSelection=\"enableCascadeSelection\"\n                :hasMoreOptions=\"index === groupingOptions!.length - 1 && hasMoreOptions && !isLoading\"\n                @see-more=\"handleSeeMore\"\n              />\n              <div\n                v-if=\"groupingOptions && index !== groupingOptions.length - 1\"\n                class=\"pv-border-top\"\n                style=\"margin: 8px 0\"\n              />\n            </div>\n          </template>\n          <template v-else>\n            <PvMenu\n              v-model:selectedItems=\"menuSelectedItems\"\n              :options=\"filteredOptions\"\n              :config=\"optionConfig\"\n              :singleSelect=\"singleSelect\"\n              :queryText=\"highlightSearchText ? searchInput : null\"\n              :itemTestId=\"`pv-multiselect-${label}-item`\"\n              itemClass=\"pv-stack-4\"\n              :enableCascadeSelection=\"enableCascadeSelection\"\n              :isSeeMoreLoading=\"isSeeMoreLoading\"\n              :hasMoreOptions=\"hasMoreOptions && !isLoading\"\n              @see-more=\"handleSeeMore\"\n            />\n          </template>\n        </template>\n        <div\n          v-if=\"isLoading\"\n          class=\"pv-flex pv-inset-square-8 pv-text-body-sm pv-text-subdued\"\n          style=\"justify-content: center\"\n        >\n          <PvSpinner variant=\"dark\" />\n          <span v-if=\"loadingText\">{{ loadingText }}</span>\n        </div>\n        <template v-else-if=\"filteredOptions.length === 0\">\n          <slot v-if=\"hasNoResultsSlot\" name=\"no-results\" v-bind=\"allSlotProps\" />\n          <PvMenuEmptyState v-else />\n        </template>\n        <!-- Only when there is something to put in it, or a bordered empty bar is left behind. -->\n        <div\n          v-if=\"hasFooterSlot || menuActionsVariant\"\n          class=\"pv-sticky pv-surface pv-border-top pv-inset-square-8\"\n          :class=\"{ 'pv-flow-8': footerPosition === 'below-actions' }\"\n          style=\"--flex-justify: space-between; --bottom: 0\"\n        >\n          <slot v-if=\"hasFooterSlot && footerPosition === 'above-actions'\" name=\"footer\" v-bind=\"allSlotProps\" />\n          <PvSelectControlPanel\n            v-if=\"menuActionsVariant\"\n            :variant=\"menuActionsVariant\"\n            :disabled=\"isLoading\"\n            :rumFilterName=\"rumFilterName\"\n            @handle-clear-all=\"handleClearAll\"\n            @handle-select-all=\"handleSelectAll\"\n            @handle-cancel=\"handleCancelSelection\"\n            @handle-confirm=\"handleConfirmSelection\"\n          />\n          <slot v-if=\"hasFooterSlot && footerPosition === 'below-actions'\" name=\"footer\" v-bind=\"allSlotProps\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","<script setup lang=\"ts\" generic=\"T\">\nimport { watch, useTemplateRef, computed, nextTick, shallowRef, provide } from \"vue\";\nimport { useToggle, onKeyStroke } from \"@vueuse/core\";\n\nimport { PvSearchInputExposed } from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSelectControlPanel from \"../PvMenu/PvMenuControlPanel.vue\";\nimport PvSearchInput from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvSelectButtonTrigger from \"@/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue\";\nimport PvMenuEmptyState from \"../PvMenu/PvMenuEmptyState.vue\";\nimport PvMenu from \"../PvMenu/PvMenu.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\n\nimport { PvMultiSelectButtonProps } from \"./types\";\nimport { MenuOption, MenuOptionConfig, MultiSelectState, SelectionNode, SeeMoreEvent } from \"@/types\";\nimport {\n  collectLeafOptions,\n  countFromSelectionState,\n  countWithCollapsedParents,\n  filterOptionsRecursive,\n  hasCascadeChildren,\n} from \"../PvMenu/cascadeUtils\";\nimport {\n  OriginalOptionsMapKey,\n  CascadeSelectedParentIdsKey,\n  CascadeDeselectedChildIdsKey,\n  ParentSelectsAllChildrenKey,\n  EnableChildExpansionKey,\n} from \"../PvMenu/symbols\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\n\nconst props = withDefaults(defineProps<PvMultiSelectButtonProps<T>>(), {\n  counterPosition: \"left\",\n  variant: \"secondary\",\n  size: \"lg\",\n  label: \"Select\",\n  disableDropdownIcon: false,\n  disableClearIcon: false,\n  disableSearchInput: false,\n  disabled: false,\n  optionsVariant: \"checkbox\",\n  options: () => [] as MenuOption<T>[],\n  menuActionsVariant: \"select-clear\",\n  footerPosition: \"above-actions\",\n  singleSelect: false,\n  highlightSearchText: false,\n  enableCascadeSelection: false,\n  counterStyle: \"primary\",\n});\n\nconst optionConfig = computed(() => {\n  const config: MenuOptionConfig = {\n    renderer: props.optionsRenderer,\n    action: props.optionsAction,\n    variant: props.optionsVariant,\n    counterBadgeVariant: props.counterBadgeVariant,\n    size: props.size,\n  };\n  return config;\n});\n\n// Build a map from option id → original (unfiltered) option so that descendants\n// can look up the full children list when parentSelectsAllChildren is true.\nconst originalOptionsMap = computed(() => {\n  const map = new Map<string, MenuOption<T>>();\n  const buildMap = (options: MenuOption<T>[]) => {\n    for (const option of options) {\n      map.set(option.id, option);\n      if (option.children?.length) buildMap(option.children);\n    }\n  };\n  buildMap(props.options);\n  return map;\n});\n\nconst cascadeSelectedParentIds = shallowRef<Set<string>>(new Set());\nconst cascadeDeselectedChildIds = shallowRef<Map<string, Set<string>>>(new Map());\n\nprovide(OriginalOptionsMapKey, originalOptionsMap);\nprovide(CascadeSelectedParentIdsKey, cascadeSelectedParentIds);\nprovide(CascadeDeselectedChildIdsKey, cascadeDeselectedChildIds);\nprovide(\n  ParentSelectsAllChildrenKey,\n  computed(() => props.parentSelectsAllChildren),\n);\nprovide(\n  EnableChildExpansionKey,\n  computed(() => !!props.enableChildExpansion),\n);\n\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n  (e: \"see-more\", payload: SeeMoreEvent): void;\n  (e: \"select-all\", valueCount: number): void;\n  (e: \"clear-all\", valueCount: number): void;\n}>();\n\n/** Pre-computed mapping of parent option ID → its leaf descendant options. */\nconst parentLeafMap = computed(() => {\n  const map = new Map<string, MenuOption<T>[]>();\n  for (const [id, option] of originalOptionsMap.value) {\n    if (hasCascadeChildren(option)) {\n      map.set(id, option.children ? collectLeafOptions(option.children) : []);\n    }\n  }\n  return map;\n});\n\nconst getSelectionState = (): MultiSelectState => {\n  const parentLeafIds = new Set<string>();\n  if (cascadeSelectedParentIds.value.size > 0) {\n    for (const parentId of cascadeSelectedParentIds.value) {\n      const leaves = parentLeafMap.value.get(parentId);\n      if (leaves) {\n        for (const leaf of leaves) parentLeafIds.add(leaf.id);\n      }\n    }\n  }\n\n  const nodes: SelectionNode[] = [];\n\n  for (const parentId of cascadeSelectedParentIds.value) {\n    const deselected = cascadeDeselectedChildIds.value.get(parentId);\n    const node: SelectionNode = { id: parentId, state: \"selected\" };\n    if (deselected?.size) {\n      node.children = [...deselected].map((childId) => ({\n        id: childId,\n        state: \"deselected\" as const,\n      }));\n    }\n    nodes.push(node);\n  }\n\n  for (const item of selectedItems.value) {\n    if (!parentLeafIds.has(item.id)) {\n      nodes.push({ id: item.id, state: \"selected\" });\n    }\n  }\n\n  return nodes;\n};\n\nconst hasMoreOptions = computed(() => {\n  if (props.hasMoreOptions != null) return props.hasMoreOptions;\n  if (props.totalOptionCount == null) return false;\n  return props.totalOptionCount > props.options.length;\n});\n\nconst counterValue = computed(() => {\n  const additional = props.additionalCounter ?? 0;\n  if (props.enableCascadeSelection && props.countSelectedParents && modelSelectionState.value?.length) {\n    return countFromSelectionState(modelSelectionState.value) + additional;\n  }\n  if (!props.countSelectedParents || !props.enableCascadeSelection) {\n    return selectedItems.value.length + additional;\n  }\n  const selectedIds = new Set(selectedItems.value.map((item) => item.id));\n  return countWithCollapsedParents(props.options, selectedIds) + additional;\n});\n\nconst hasSelection = computed(() => {\n  if (selectedItems.value.length > 0) return true;\n  if (props.enableCascadeSelection && modelSelectionState.value?.length) {\n    return modelSelectionState.value.some((node) => node.state === \"selected\");\n  }\n  return false;\n});\n\nconst handleSeeMore = (payload?: SeeMoreEvent) => {\n  emits(\"see-more\", payload ?? {});\n};\n\nconst searchInputComponentRef = useTemplateRef<PvSearchInputExposed | null>(\"searchInputRef\");\n\nconst [open, handleOpen] = useToggle<boolean>(props.defaultOpen);\nconst modelSelectedItems = defineModel<MenuOption<T>[]>({\n  required: false,\n  default: () => [],\n});\nconst modelSelectionState = defineModel<MultiSelectState>(\"selectionState\");\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n  default: \"\",\n});\n\nconst suppressChangesUntilConfirmed = computed(() => {\n  return props.menuActionsVariant === \"cancel-confirm\";\n});\n\nconst storeSelectedItems = (newSelection: MenuOption<T>[]) => {\n  selectedItems.value = newSelection;\n  if (!suppressChangesUntilConfirmed.value) {\n    modelSelectedItems.value = newSelection;\n    modelSelectionState.value = getSelectionState();\n  }\n};\n\nconst applyPendingSelection = () => {\n  if (suppressChangesUntilConfirmed.value) {\n    modelSelectedItems.value = selectedItems.value;\n    modelSelectionState.value = getSelectionState();\n  }\n};\n\nconst resetPendingSelection = () => {\n  if (suppressChangesUntilConfirmed.value) {\n    selectedItems.value = modelSelectedItems.value;\n  }\n};\n\n// with cancel-confirm, we hold changes until confirmed\nconst selectedItems = shallowRef<MenuOption<T>[]>(modelSelectedItems.value);\n\nconst findOptionById = (id: string): MenuOption<T> | undefined => originalOptionsMap.value.get(id);\n\nconst syncFromSelectionState = (state: MultiSelectState | undefined) => {\n  if (!props.enableCascadeSelection || !state) return;\n\n  const nextSelectedParents = new Set<string>();\n  const nextDeselectedChildren = new Map<string, Set<string>>();\n  const nextSelectedItems: MenuOption<T>[] = [];\n  const selectedIds = new Set<string>();\n\n  const addSelectedItem = (option: MenuOption<T> | undefined, id: string) => {\n    if (selectedIds.has(id)) return;\n    selectedIds.add(id);\n    // Placeholder for unresolved nodes — the trigger badge prefers `…` over the\n    // raw scoped token (e.g. `__provider_id__PV_1004__health_system__Kaiser`)\n    // until the props.options watcher re-runs this sync with metadata loaded.\n    nextSelectedItems.push(option ?? ({ id, text: \"…\" } as MenuOption<T>));\n  };\n\n  for (const node of state) {\n    if (node.state !== \"selected\") continue;\n\n    const deselectedIds = new Set(\n      (node.children || []).filter((child) => child.state === \"deselected\").map((child) => child.id),\n    );\n    const leafOptions = parentLeafMap.value.get(node.id);\n\n    if (leafOptions) {\n      nextSelectedParents.add(node.id);\n      if (deselectedIds.size > 0) {\n        nextDeselectedChildren.set(node.id, deselectedIds);\n      }\n      for (const leaf of leafOptions) {\n        if (!deselectedIds.has(leaf.id)) {\n          addSelectedItem(leaf, leaf.id);\n        }\n      }\n      continue;\n    }\n\n    addSelectedItem(findOptionById(node.id), node.id);\n  }\n\n  cascadeSelectedParentIds.value = nextSelectedParents;\n  cascadeDeselectedChildIds.value = nextDeselectedChildren;\n  selectedItems.value = nextSelectedItems;\n};\n\nconst menuSelectedItems = computed({\n  get: () => selectedItems.value,\n  set: (newValue: MenuOption<T>[]) => {\n    storeSelectedItems(newValue);\n  },\n});\n\nconst closeDropdown = () => {\n  searchInput.value = \"\";\n  open.value = false;\n};\n\nconst popoverOffset = computed(() => {\n  // get width of trigger element to offset popover correctly when overlay trigger is enabled\n  const size = props.size === \"lg\" ? 24 : 30;\n  return props.overlayTrigger ? -size : undefined;\n});\n\n// sync when parent updates modelSelectedItems directly\nwatch(\n  () => modelSelectedItems.value,\n  (newValue) => {\n    if (props.enableCascadeSelection && modelSelectionState.value?.length && newValue.length === 0) {\n      syncFromSelectionState(modelSelectionState.value);\n      return;\n    }\n    selectedItems.value = newValue;\n  },\n);\n\nwatch(\n  () => [modelSelectionState.value, props.options] as const,\n  () => {\n    syncFromSelectionState(modelSelectionState.value);\n  },\n  { deep: true, immediate: true },\n);\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    resetPendingSelection();\n    nextTick(() => {\n      // if overlay trigger is enabled and search input exists, auto-target the search input\n      if (props.overlayTrigger && !props.disableSearchInput) {\n        searchInputComponentRef.value?.input?.focus();\n      }\n      emits(\"dropdown-open\");\n    });\n  } else {\n    // on close, discard pending changes\n    resetPendingSelection();\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst filteredOptions = computed(() => {\n  if (searchInput.value === \"\") return props.options;\n  const searchValue = searchInput.value.toLocaleLowerCase();\n\n  if (props.enableCascadeSelection) {\n    return filterOptionsRecursive(props.options, searchValue, !props.hideParentOnChildQueryMatch);\n  }\n\n  return props.options.filter(\n    (option) =>\n      option.text.toLocaleLowerCase().includes(searchValue) ||\n      option.searchText?.toLocaleLowerCase().includes(searchValue),\n  );\n});\n\nconst handleSelectAll = () => {\n  // Mark all parents as cascade-selected (select-all intent) before\n  // storing so the selection state snapshot is accurate.\n  if (props.enableCascadeSelection) {\n    const parentIds = new Set<string>();\n    const collectParentIds = (options: MenuOption<T>[]) => {\n      for (const option of options) {\n        if (hasCascadeChildren(option)) {\n          parentIds.add(option.id);\n          if (option.children?.length) collectParentIds(option.children);\n        }\n      }\n    };\n    collectParentIds(filteredOptions.value as MenuOption<T>[]);\n    cascadeSelectedParentIds.value = parentIds;\n    cascadeDeselectedChildIds.value = new Map();\n  }\n\n  // select all visible item values (excluded ones filtered out by search)\n  const toSelect = props.enableCascadeSelection\n    ? collectLeafOptions(filteredOptions.value as MenuOption<T>[])\n    : filteredOptions.value;\n  emits(\"select-all\", toSelect.length);\n  storeSelectedItems(toSelect);\n};\n\nconst handleClearAll = () => {\n  emits(\"clear-all\", selectedItems.value.length);\n  cascadeSelectedParentIds.value = new Set();\n  cascadeDeselectedChildIds.value = new Map();\n  storeSelectedItems([]);\n};\n\nconst handleCancelSelection = () => {\n  resetPendingSelection();\n  closeDropdown();\n};\n\nconst handleConfirmSelection = () => {\n  applyPendingSelection();\n  closeDropdown();\n};\n\nconst groupingOptions = computed(() => {\n  if (!props.groupings) return;\n\n  const groupingMap = new Map<string, MenuOption[]>();\n\n  props.groupings.forEach((group) => {\n    groupingMap.set(group, []);\n  });\n\n  groupingMap.set(\"other\", []);\n\n  for (const option of props.options) {\n    const groupKey = option.groupingLabel;\n    const targetGroup = groupKey && groupingMap.has(groupKey) ? groupKey : \"other\";\n    groupingMap.get(targetGroup)!.push(option);\n  }\n\n  for (const [key, options] of groupingMap) {\n    if (options.length === 0) {\n      groupingMap.delete(key);\n    }\n  }\n\n  return Array.from(groupingMap.entries());\n});\n\nconst showGroupings = computed(() => {\n  return props.groupings && searchInput.value === \"\";\n});\n\nconst allSlotProps = computed(() => ({\n  ...props,\n  selectedItems: modelSelectedItems.value,\n  searchInput: searchInput.value,\n  slotContext: props.slotContext,\n  isOpen: open.value,\n  isLoading: props.isLoading,\n  filteredOptionCount: filteredOptions.value.length,\n}));\n\n// Derive a distinct name for this RUM action. Leave undefined to suppress.\nconst rumTriggerActionName = computed(() => {\n  if (props.rumActionName) return props.rumActionName;\n  return props.rumFilterName ? `Open ${props.rumFilterName} filter` : undefined;\n});\nconst rumSearchActionName = computed(() => (props.rumFilterName ? `Search ${props.rumFilterName} options` : undefined));\n\nconst popoverContentRef = useTemplateRef<HTMLElement | null>(\"popoverContentRef\");\nconst slotHost = computed(() => {\n  const rootNode = popoverContentRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\nconst { present: hasHeaderSlot } = useSlotPresence(\"header\", { host: slotHost });\nconst { present: hasNoResultsSlot } = useSlotPresence(\"no-results\", { host: slotHost });\nconst { present: hasFooterSlot } = useSlotPresence(\"footer\", { host: slotHost });\n\nonKeyStroke(\"Escape\", () => {\n  if (!open.value) return;\n\n  closeDropdown();\n});\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"open\" v-bind=\"popoverProperties\" :offset=\"popoverOffset\">\n    <template #trigger>\n      <PvSelectButtonTrigger\n        ref=\"select-button-trigger-ref\"\n        :variant=\"variant\"\n        :size=\"size\"\n        :disabled=\"disabled\"\n        :counterPosition=\"counterPosition\"\n        :prefixLabel=\"prefixLabel\"\n        :label=\"label\"\n        :icon=\"icon\"\n        :companyLogo=\"companyLogo\"\n        :showClear=\"!disableClearIcon && hasSelection && !disabled\"\n        :showDropdown=\"!disableDropdownIcon && (disabled || !(hasSelection && !disableClearIcon))\"\n        :open=\"open\"\n        :counter-value=\"counterValue\"\n        :counter-style=\"counterStyle\"\n        :selected-items=\"selectedItems\"\n        :data-dd-action-name=\"rumTriggerActionName\"\n        @handle-clear=\"handleClearAll\"\n        @handle-toggle-dropdown=\"handleOpen()\"\n      />\n    </template>\n    <template #content>\n      <div\n        ref=\"popoverContentRef\"\n        class=\"pv-popover\"\n        data-test-id=\"pv-popover\"\n        :style=\"{ '--position': 'unset', ...popoverCssProperties }\"\n      >\n        <template v-if=\"!disableSearchInput\">\n          <div class=\"pv-inset-square-8 pv-border-bottom\" :data-dd-action-name=\"rumSearchActionName\">\n            <PvSearchInput\n              ref=\"searchInputRef\"\n              v-model:model-value=\"searchInput\"\n              class=\"pv-stack-4\"\n              :placeholder=\"searchPlaceholder\"\n            />\n          </div>\n        </template>\n        <div v-if=\"$slots.header || hasHeaderSlot\" class=\"pv-inset-square-8\">\n          <slot name=\"header\" v-bind=\"allSlotProps\" />\n        </div>\n        <template v-if=\"filteredOptions.length > 0\">\n          <template v-if=\"showGroupings\">\n            <div v-for=\"([label, options], index) in groupingOptions\" :key=\"label\">\n              <slot v-if=\"$slots[label]\" :name=\"label\" />\n              <span\n                class=\"pv-text-body-sm pv-inset-inline\"\n                style=\"color: var(--color-text-quaternary, #89989b); --inset-size: 8px\"\n                v-else-if=\"label !== 'other'\"\n                >{{ label }}</span\n              >\n              <PvMenu\n                v-model:selectedItems=\"menuSelectedItems\"\n                :options=\"options\"\n                :config=\"optionConfig\"\n                :singleSelect=\"singleSelect\"\n                :queryText=\"highlightSearchText ? searchInput : null\"\n                :itemTestId=\"`pv-multiselect-${label}-item`\"\n                itemClass=\"pv-stack-4\"\n                :isLoading=\"isLoading\"\n                :isSeeMoreLoading=\"isSeeMoreLoading\"\n                :enableCascadeSelection=\"enableCascadeSelection\"\n                :hasMoreOptions=\"index === groupingOptions!.length - 1 && hasMoreOptions && !isLoading\"\n                @see-more=\"handleSeeMore\"\n              />\n              <div\n                v-if=\"groupingOptions && index !== groupingOptions.length - 1\"\n                class=\"pv-border-top\"\n                style=\"margin: 8px 0\"\n              />\n            </div>\n          </template>\n          <template v-else>\n            <PvMenu\n              v-model:selectedItems=\"menuSelectedItems\"\n              :options=\"filteredOptions\"\n              :config=\"optionConfig\"\n              :singleSelect=\"singleSelect\"\n              :queryText=\"highlightSearchText ? searchInput : null\"\n              :itemTestId=\"`pv-multiselect-${label}-item`\"\n              itemClass=\"pv-stack-4\"\n              :enableCascadeSelection=\"enableCascadeSelection\"\n              :isSeeMoreLoading=\"isSeeMoreLoading\"\n              :hasMoreOptions=\"hasMoreOptions && !isLoading\"\n              @see-more=\"handleSeeMore\"\n            />\n          </template>\n        </template>\n        <div\n          v-if=\"isLoading\"\n          class=\"pv-flex pv-inset-square-8 pv-text-body-sm pv-text-subdued\"\n          style=\"justify-content: center\"\n        >\n          <PvSpinner variant=\"dark\" />\n          <span v-if=\"loadingText\">{{ loadingText }}</span>\n        </div>\n        <template v-else-if=\"filteredOptions.length === 0\">\n          <slot v-if=\"hasNoResultsSlot\" name=\"no-results\" v-bind=\"allSlotProps\" />\n          <PvMenuEmptyState v-else />\n        </template>\n        <!-- Only when there is something to put in it, or a bordered empty bar is left behind. -->\n        <div\n          v-if=\"hasFooterSlot || menuActionsVariant\"\n          class=\"pv-sticky pv-surface pv-border-top pv-inset-square-8\"\n          :class=\"{ 'pv-flow-8': footerPosition === 'below-actions' }\"\n          style=\"--flex-justify: space-between; --bottom: 0\"\n        >\n          <slot v-if=\"hasFooterSlot && footerPosition === 'above-actions'\" name=\"footer\" v-bind=\"allSlotProps\" />\n          <PvSelectControlPanel\n            v-if=\"menuActionsVariant\"\n            :variant=\"menuActionsVariant\"\n            :disabled=\"isLoading\"\n            :rumFilterName=\"rumFilterName\"\n            @handle-clear-all=\"handleClearAll\"\n            @handle-select-all=\"handleSelectAll\"\n            @handle-cancel=\"handleCancelSelection\"\n            @handle-confirm=\"handleConfirmSelection\"\n          />\n          <slot v-if=\"hasFooterSlot && footerPosition === 'below-actions'\" name=\"footer\" v-bind=\"allSlotProps\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","<script setup lang=\"ts\" generic=\"T\">\nimport { watch, computed } from \"vue\";\nimport type { CSSProperties, Component } from \"vue\";\n\nimport { useToggle, onKeyStroke } from \"@vueuse/core\";\n\nimport PvSearchInput from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvSelectButtonTrigger from \"@/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue\";\nimport PvMenuEmptyState from \"../PvMenu/PvMenuEmptyState.vue\";\n\nimport type { PvSelectButtonSize, PvSelectButtonVariant } from \"./types\";\nimport type { MenuAction, MenuOption, MenuOptionConfig, MenuOptionsVariant } from \"@/types\";\nimport type { PvCounterBadgeVariant } from \"../PvCounterBadge/types\";\nimport type { PvPopoverV2Props } from \"@/components/base/PvPopoverV2/types.ts\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvMenu from \"@/components/base/PvMenu/PvMenu.vue\";\nimport type { PvMenuChildrenDisplay } from \"@/components/base/PvMenu/types\";\n\nexport interface PvSelectButtonProps<T = unknown> {\n  /** Whether the dropdown is open on initial render */\n  defaultOpen?: boolean;\n  /** Prevent the button from being clicked */\n  disabled?: boolean;\n  /** Show a loading state on the trigger button */\n  isLoading?: boolean;\n  /** Visual style of the trigger button */\n  variant?: PvSelectButtonVariant;\n  /** Inverse button colors for dark backgrounds */\n  inverse?: boolean;\n  /** Size of the trigger button */\n  size?: PvSelectButtonSize;\n  /** Configuration passed to the underlying PvPopoverV2 */\n  popoverProperties?: PvPopoverV2Props;\n  /** Custom CSS properties applied to the popover container */\n  popoverCssProperties?: CSSProperties;\n  /** Static text shown before the label on the trigger button */\n  prefixLabel?: string;\n  /** Text label on the trigger button; updates to the selected option's text when an item is chosen */\n  label?: string;\n  /** Icon shown before the trigger label when the selected option does not provide one */\n  icon?: string;\n  /**\n   * Keep the trigger showing `label` even after an option is selected, instead of\n   * swapping to the selected option's text. Use when the label is a fixed title\n   * (e.g. a column name) and the current selection is surfaced only inside the dropdown.\n   */\n  staticLabel?: boolean;\n  /** Hide the search input inside the dropdown */\n  disableSearchInput?: boolean;\n  /** Placeholder text for the search input */\n  searchPlaceholder?: string;\n  /** Visual style of menu options (simple, icon, company, avatar, radio) */\n  optionsVariant?: Exclude<MenuOptionsVariant, \"checkbox\">;\n  /** The list of selectable options */\n  options?: MenuOption<T>[];\n  /** Render nested options inline or in click-opened popovers. */\n  childrenDisplay?: PvMenuChildrenDisplay;\n  /** Custom Vue component used to render each option */\n  optionsRenderer?: Component;\n  /** Action configuration for per-option action buttons */\n  optionsAction?: MenuAction<T>;\n  /** Prevent deselecting the currently selected item */\n  disableDeselect?: boolean;\n  /** Where to place the counter badge on the trigger */\n  counterPosition?: \"left\" | \"right\";\n  /** Variant of the counter badge which appears on the button and menu items */\n  counterBadgeVariant?: PvCounterBadgeVariant;\n  /** Whether to highlight the search text in the options list */\n  highlightSearchText?: boolean;\n  /**\n   * `data-dd-action-name` attached to the trigger button so Datadog RUM\n   * resolves the click to a named action. Leave unset to skip.\n   */\n  rumActionName?: string;\n}\n\nconst props = withDefaults(defineProps<PvSelectButtonProps<T>>(), {\n  variant: \"secondary\",\n  size: \"lg\",\n  label: \"Select an option\",\n  disableDeselect: false,\n  disableSearchInput: false,\n  optionsVariant: \"simple\",\n  options: () => [] as MenuOption<T>[],\n  highlightSearchText: false,\n});\n\nconst resolvedPopoverProperties = computed<PvPopoverV2Props | undefined>(() => {\n  if (props.childrenDisplay !== \"popover\") return props.popoverProperties;\n  const ignoredClasses = props.popoverProperties?.ignoreClickOutsideClasses ?? [];\n  return {\n    ...props.popoverProperties,\n    ignoreClickOutsideClasses: ignoredClasses.includes(\"pv-menu-popover\")\n      ? ignoredClasses\n      : [...ignoredClasses, \"pv-menu-popover\"],\n  };\n});\n\nconst optionConfig = computed(() => {\n  const config: MenuOptionConfig = {\n    renderer: props.optionsRenderer,\n    action: props.optionsAction,\n    variant: props.optionsVariant,\n    counterBadgeVariant: props.counterBadgeVariant,\n    size: props.size,\n  };\n  return config;\n});\n\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n}>();\n\nconst [open] = useToggle<boolean>(props.defaultOpen);\nconst selectedItem = defineModel<MenuOption>({ required: false });\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n  default: \"\",\n});\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    emits(\"dropdown-open\");\n  } else {\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst buttonDisplayLabel = computed(() => {\n  if (!props.staticLabel && selectedItem.value && selectedItem.value.text) {\n    return selectedItem.value.text;\n  }\n  return props.label;\n});\n\nconst buttonIcon = computed(() => selectedItem.value?.icon || props.icon);\n\nconst buttonCompanyLogo = computed(() => {\n  if (selectedItem.value && selectedItem.value.companyName) {\n    return selectedItem.value.companyName;\n  }\n  return undefined;\n});\n\nconst buttonAvatar = computed(() => selectedItem.value?.avatar);\n\nconst filteredOptions = computed(() => {\n  const searchValue = searchInput.value.trim().toLowerCase();\n  if (!searchValue) return props.options;\n\n  const searchRecursive = (options: MenuOption[]): MenuOption[] => {\n    const result: MenuOption[] = [];\n\n    for (const option of options) {\n      const matches =\n        option.text.toLowerCase().includes(searchValue) || option.searchText?.toLowerCase().includes(searchValue);\n      const filteredChildren = searchRecursive(option.children || []);\n\n      if (matches) {\n        // Parent matches → keep parent, with filtered children\n        result.push({\n          ...option,\n          searchText: searchValue,\n          children: filteredChildren,\n        });\n      } else {\n        // Parent does NOT match:\n        result.push(...filteredChildren);\n      }\n    }\n\n    return result;\n  };\n\n  return searchRecursive(props.options);\n});\n\nconst menuSelectedItems = computed({\n  get: () => (selectedItem.value ? [selectedItem.value] : []),\n  set: (items: MenuOption[]) => {\n    if (props.optionsVariant === \"radio\" || props.disableDeselect) {\n      if (items.length > 0) {\n        selectedItem.value = items[0];\n      }\n    } else {\n      selectedItem.value = items.length > 0 ? items[0] : undefined;\n    }\n  },\n});\n\nconst handleSelectItem = () => {\n  closeDropdown();\n};\n\nconst handleClear = () => {\n  selectedItem.value = undefined;\n};\n\nconst closeDropdown = () => {\n  open.value = false;\n  searchInput.value = \"\";\n};\n\nonKeyStroke(\"Escape\", () => {\n  if (!open.value) return;\n\n  closeDropdown();\n});\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"open\" v-bind=\"resolvedPopoverProperties\">\n    <template #trigger>\n      <PvSelectButtonTrigger\n        class=\"pv-full-width\"\n        ref=\"select-button-trigger-ref\"\n        :variant=\"variant\"\n        :inverse=\"inverse\"\n        :size=\"size\"\n        :disabled=\"disabled\"\n        :prefixLabel=\"prefixLabel\"\n        :label=\"buttonDisplayLabel\"\n        :icon=\"buttonIcon\"\n        :companyLogo=\"buttonCompanyLogo\"\n        :avatar=\"buttonAvatar\"\n        :showClear=\"false\"\n        :showDropdown=\"true\"\n        :open=\"open\"\n        :data-dd-action-name=\"rumActionName\"\n        :counter-position=\"counterPosition\"\n        :counter-value=\"\n          selectedItem?.secondaryText && typeof selectedItem.secondaryText === 'number'\n            ? selectedItem.secondaryText\n            : undefined\n        \"\n        :counter-badge-variant=\"counterBadgeVariant\"\n        :isLoading=\"isLoading\"\n        :menuOptionConfig=\"optionConfig\"\n        :renderer=\"optionsRenderer\"\n        :selectedOption=\"selectedItem\"\n        @handle-clear=\"handleClear\"\n      />\n    </template>\n    <template #content>\n      <div\n        class=\"pv-popover pv-popover-scrollable\"\n        data-test-id=\"pv-popover\"\n        :style=\"popoverCssProperties\"\n        style=\"position: unset\"\n      >\n        <div class=\"pv-popover-scroll\">\n          <template v-if=\"!disableSearchInput\">\n            <div class=\"pv-inset-square-8 pv-border-bottom\">\n              <PvSearchInput v-model:model-value=\"searchInput\" class=\"pv-stack-4\" :placeholder=\"searchPlaceholder\" />\n            </div>\n          </template>\n          <template v-if=\"filteredOptions.length > 0\">\n            <PvMenu\n              v-model:selectedItems=\"menuSelectedItems\"\n              :options=\"filteredOptions\"\n              :config=\"optionConfig\"\n              :queryText=\"highlightSearchText ? searchInput : null\"\n              :singleSelect=\"true\"\n              :disableDeselect=\"disableDeselect\"\n              :childrenDisplay=\"childrenDisplay\"\n              @handle-selected=\"handleSelectItem\"\n            />\n          </template>\n          <PvMenuEmptyState v-else />\n          <slot name=\"footer\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","<script setup lang=\"ts\" generic=\"T\">\nimport { watch, computed } from \"vue\";\nimport type { CSSProperties, Component } from \"vue\";\n\nimport { useToggle, onKeyStroke } from \"@vueuse/core\";\n\nimport PvSearchInput from \"../PvSearchInput/PvSearchInput.vue\";\nimport PvSelectButtonTrigger from \"@/components/base/PvSelectButton/PvSelectButtonTrigger/PvSelectButtonTrigger.vue\";\nimport PvMenuEmptyState from \"../PvMenu/PvMenuEmptyState.vue\";\n\nimport type { PvSelectButtonSize, PvSelectButtonVariant } from \"./types\";\nimport type { MenuAction, MenuOption, MenuOptionConfig, MenuOptionsVariant } from \"@/types\";\nimport type { PvCounterBadgeVariant } from \"../PvCounterBadge/types\";\nimport type { PvPopoverV2Props } from \"@/components/base/PvPopoverV2/types.ts\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvMenu from \"@/components/base/PvMenu/PvMenu.vue\";\nimport type { PvMenuChildrenDisplay } from \"@/components/base/PvMenu/types\";\n\nexport interface PvSelectButtonProps<T = unknown> {\n  /** Whether the dropdown is open on initial render */\n  defaultOpen?: boolean;\n  /** Prevent the button from being clicked */\n  disabled?: boolean;\n  /** Show a loading state on the trigger button */\n  isLoading?: boolean;\n  /** Visual style of the trigger button */\n  variant?: PvSelectButtonVariant;\n  /** Inverse button colors for dark backgrounds */\n  inverse?: boolean;\n  /** Size of the trigger button */\n  size?: PvSelectButtonSize;\n  /** Configuration passed to the underlying PvPopoverV2 */\n  popoverProperties?: PvPopoverV2Props;\n  /** Custom CSS properties applied to the popover container */\n  popoverCssProperties?: CSSProperties;\n  /** Static text shown before the label on the trigger button */\n  prefixLabel?: string;\n  /** Text label on the trigger button; updates to the selected option's text when an item is chosen */\n  label?: string;\n  /** Icon shown before the trigger label when the selected option does not provide one */\n  icon?: string;\n  /**\n   * Keep the trigger showing `label` even after an option is selected, instead of\n   * swapping to the selected option's text. Use when the label is a fixed title\n   * (e.g. a column name) and the current selection is surfaced only inside the dropdown.\n   */\n  staticLabel?: boolean;\n  /** Hide the search input inside the dropdown */\n  disableSearchInput?: boolean;\n  /** Placeholder text for the search input */\n  searchPlaceholder?: string;\n  /** Visual style of menu options (simple, icon, company, avatar, radio) */\n  optionsVariant?: Exclude<MenuOptionsVariant, \"checkbox\">;\n  /** The list of selectable options */\n  options?: MenuOption<T>[];\n  /** Render nested options inline or in click-opened popovers. */\n  childrenDisplay?: PvMenuChildrenDisplay;\n  /** Custom Vue component used to render each option */\n  optionsRenderer?: Component;\n  /** Action configuration for per-option action buttons */\n  optionsAction?: MenuAction<T>;\n  /** Prevent deselecting the currently selected item */\n  disableDeselect?: boolean;\n  /** Where to place the counter badge on the trigger */\n  counterPosition?: \"left\" | \"right\";\n  /** Variant of the counter badge which appears on the button and menu items */\n  counterBadgeVariant?: PvCounterBadgeVariant;\n  /** Whether to highlight the search text in the options list */\n  highlightSearchText?: boolean;\n  /**\n   * `data-dd-action-name` attached to the trigger button so Datadog RUM\n   * resolves the click to a named action. Leave unset to skip.\n   */\n  rumActionName?: string;\n}\n\nconst props = withDefaults(defineProps<PvSelectButtonProps<T>>(), {\n  variant: \"secondary\",\n  size: \"lg\",\n  label: \"Select an option\",\n  disableDeselect: false,\n  disableSearchInput: false,\n  optionsVariant: \"simple\",\n  options: () => [] as MenuOption<T>[],\n  highlightSearchText: false,\n});\n\nconst resolvedPopoverProperties = computed<PvPopoverV2Props | undefined>(() => {\n  if (props.childrenDisplay !== \"popover\") return props.popoverProperties;\n  const ignoredClasses = props.popoverProperties?.ignoreClickOutsideClasses ?? [];\n  return {\n    ...props.popoverProperties,\n    ignoreClickOutsideClasses: ignoredClasses.includes(\"pv-menu-popover\")\n      ? ignoredClasses\n      : [...ignoredClasses, \"pv-menu-popover\"],\n  };\n});\n\nconst optionConfig = computed(() => {\n  const config: MenuOptionConfig = {\n    renderer: props.optionsRenderer,\n    action: props.optionsAction,\n    variant: props.optionsVariant,\n    counterBadgeVariant: props.counterBadgeVariant,\n    size: props.size,\n  };\n  return config;\n});\n\nconst emits = defineEmits<{\n  (e: \"dropdown-open\"): void;\n  (e: \"dropdown-closed\"): void;\n}>();\n\nconst [open] = useToggle<boolean>(props.defaultOpen);\nconst selectedItem = defineModel<MenuOption>({ required: false });\nconst searchInput = defineModel<string>(\"searchInput\", {\n  required: false,\n  default: \"\",\n});\n\nwatch(open, (newValue) => {\n  if (newValue) {\n    emits(\"dropdown-open\");\n  } else {\n    emits(\"dropdown-closed\");\n  }\n});\n\nconst buttonDisplayLabel = computed(() => {\n  if (!props.staticLabel && selectedItem.value && selectedItem.value.text) {\n    return selectedItem.value.text;\n  }\n  return props.label;\n});\n\nconst buttonIcon = computed(() => selectedItem.value?.icon || props.icon);\n\nconst buttonCompanyLogo = computed(() => {\n  if (selectedItem.value && selectedItem.value.companyName) {\n    return selectedItem.value.companyName;\n  }\n  return undefined;\n});\n\nconst buttonAvatar = computed(() => selectedItem.value?.avatar);\n\nconst filteredOptions = computed(() => {\n  const searchValue = searchInput.value.trim().toLowerCase();\n  if (!searchValue) return props.options;\n\n  const searchRecursive = (options: MenuOption[]): MenuOption[] => {\n    const result: MenuOption[] = [];\n\n    for (const option of options) {\n      const matches =\n        option.text.toLowerCase().includes(searchValue) || option.searchText?.toLowerCase().includes(searchValue);\n      const filteredChildren = searchRecursive(option.children || []);\n\n      if (matches) {\n        // Parent matches → keep parent, with filtered children\n        result.push({\n          ...option,\n          searchText: searchValue,\n          children: filteredChildren,\n        });\n      } else {\n        // Parent does NOT match:\n        result.push(...filteredChildren);\n      }\n    }\n\n    return result;\n  };\n\n  return searchRecursive(props.options);\n});\n\nconst menuSelectedItems = computed({\n  get: () => (selectedItem.value ? [selectedItem.value] : []),\n  set: (items: MenuOption[]) => {\n    if (props.optionsVariant === \"radio\" || props.disableDeselect) {\n      if (items.length > 0) {\n        selectedItem.value = items[0];\n      }\n    } else {\n      selectedItem.value = items.length > 0 ? items[0] : undefined;\n    }\n  },\n});\n\nconst handleSelectItem = () => {\n  closeDropdown();\n};\n\nconst handleClear = () => {\n  selectedItem.value = undefined;\n};\n\nconst closeDropdown = () => {\n  open.value = false;\n  searchInput.value = \"\";\n};\n\nonKeyStroke(\"Escape\", () => {\n  if (!open.value) return;\n\n  closeDropdown();\n});\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"open\" v-bind=\"resolvedPopoverProperties\">\n    <template #trigger>\n      <PvSelectButtonTrigger\n        class=\"pv-full-width\"\n        ref=\"select-button-trigger-ref\"\n        :variant=\"variant\"\n        :inverse=\"inverse\"\n        :size=\"size\"\n        :disabled=\"disabled\"\n        :prefixLabel=\"prefixLabel\"\n        :label=\"buttonDisplayLabel\"\n        :icon=\"buttonIcon\"\n        :companyLogo=\"buttonCompanyLogo\"\n        :avatar=\"buttonAvatar\"\n        :showClear=\"false\"\n        :showDropdown=\"true\"\n        :open=\"open\"\n        :data-dd-action-name=\"rumActionName\"\n        :counter-position=\"counterPosition\"\n        :counter-value=\"\n          selectedItem?.secondaryText && typeof selectedItem.secondaryText === 'number'\n            ? selectedItem.secondaryText\n            : undefined\n        \"\n        :counter-badge-variant=\"counterBadgeVariant\"\n        :isLoading=\"isLoading\"\n        :menuOptionConfig=\"optionConfig\"\n        :renderer=\"optionsRenderer\"\n        :selectedOption=\"selectedItem\"\n        @handle-clear=\"handleClear\"\n      />\n    </template>\n    <template #content>\n      <div\n        class=\"pv-popover pv-popover-scrollable\"\n        data-test-id=\"pv-popover\"\n        :style=\"popoverCssProperties\"\n        style=\"position: unset\"\n      >\n        <div class=\"pv-popover-scroll\">\n          <template v-if=\"!disableSearchInput\">\n            <div class=\"pv-inset-square-8 pv-border-bottom\">\n              <PvSearchInput v-model:model-value=\"searchInput\" class=\"pv-stack-4\" :placeholder=\"searchPlaceholder\" />\n            </div>\n          </template>\n          <template v-if=\"filteredOptions.length > 0\">\n            <PvMenu\n              v-model:selectedItems=\"menuSelectedItems\"\n              :options=\"filteredOptions\"\n              :config=\"optionConfig\"\n              :queryText=\"highlightSearchText ? searchInput : null\"\n              :singleSelect=\"true\"\n              :disableDeselect=\"disableDeselect\"\n              :childrenDisplay=\"childrenDisplay\"\n              @handle-selected=\"handleSelectItem\"\n            />\n          </template>\n          <PvMenuEmptyState v-else />\n          <slot name=\"footer\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n","import type { AgChartTheme, AgChartThemeParams, AgThemeOverrides, CssColor } from \"ag-charts-enterprise\";\n\nconst monochromeFills: CssColor[] = [\n  \"#49EADE\",\n  \"#33DED1\",\n  \"#36C5BA\",\n  \"#2CA8A1\",\n  \"#218C88\",\n  \"#176F6F\",\n  \"#0D5256\",\n  \"#02363D\",\n  \"#01262B\",\n];\n\nexport const multicolorFills: CssColor[] = [\n  \"#009999CC\",\n  \"#16696D\",\n  \"#FF7A4E\",\n  \"#C97AEB\",\n  \"#F2AD0D\",\n  \"#7C8AF4\",\n  \"#95C54C\",\n  \"#E34F8C\",\n  \"#2FB85A\",\n  \"#FB9C0D\",\n  \"#4D9FF2\",\n  \"#9C5CF2\",\n  \"#78DDE6\",\n  \"#E85E33\",\n  \"#3E83E4\",\n];\n\nexport const SCATTER_MARKER_STROKE = \"#7C8AF4\";\nconst SCATTER_MARKER_FILL = \"#FFFFFF\";\nconst SCATTER_MARKER_SIZE = 12;\nconst SCATTER_MARKER_STROKE_WIDTH = 4;\n\n// Scatter markers are white with a colored outline; hovering fills the marker with that color.\n// Without a color, each series is outlined in its own palette color and keeps AG's hover style.\nfunction createScatterOverrides(color?: string): AgThemeOverrides[\"scatter\"] {\n  return {\n    series: {\n      size: SCATTER_MARKER_SIZE,\n      fill: SCATTER_MARKER_FILL,\n      strokeWidth: SCATTER_MARKER_STROKE_WIDTH,\n      ...(color && {\n        stroke: color,\n        highlightStyle: {\n          item: {\n            fill: color,\n            stroke: color,\n            strokeWidth: SCATTER_MARKER_STROKE_WIDTH,\n          },\n        },\n      }),\n    },\n  };\n}\n\nconst baseOverrides: AgThemeOverrides = {\n  common: {\n    title: {\n      enabled: false,\n    },\n    zoom: {\n      enabled: false,\n    },\n    seriesArea: {\n      padding: {\n        bottom: 10,\n      },\n    },\n    axes: {\n      number: {\n        crosshair: {\n          enabled: true,\n        },\n        label: {\n          enabled: true,\n        },\n      },\n      category: {\n        crosshair: {\n          enabled: false,\n        },\n        label: {\n          autoRotate: true,\n        },\n      },\n    },\n    legend: {\n      toggleSeries: false,\n      preventHidingAll: true,\n    },\n  },\n  bar: {\n    series: {\n      cornerRadius: 6,\n      highlight: {\n        highlightedItem: {\n          fillOpacity: 1,\n        },\n        unhighlightedSeries: {\n          opacity: 0.2,\n        },\n      },\n    },\n  },\n  scatter: createScatterOverrides(SCATTER_MARKER_STROKE),\n};\n\nconst baseParams: AgChartThemeParams = {\n  fontFamily: \"Inter, sans-serif\",\n  chromeFontFamily: \"Inter, sans-serif\",\n};\n\nexport const PitViperAGChartsMonochromeThemeName = \"pv-ag-chart-monochrome\";\nexport const PitViperAGChartsMonochromeTheme: AgChartTheme = {\n  palette: {\n    fills: monochromeFills,\n  },\n  overrides: baseOverrides,\n  params: baseParams,\n};\n\nexport const PitViperAGChartsMulticolorThemeName = \"pv-ag-chart-multicolor\";\nexport const PitViperAGChartsMulticolorTheme: AgChartTheme = {\n  palette: {\n    fills: multicolorFills,\n  },\n  overrides: baseOverrides,\n  params: baseParams,\n};\n\n/**\n * Build a Pit Viper AG Charts theme that uses the given series fills and keeps the rest of the\n * Pit Viper chart styling. Each scatter series is outlined in its own palette color.\n * An empty list gives `PitViperAGChartsMulticolorTheme`.\n */\nexport const createPitViperAGChartsTheme = (fills: string[]): AgChartTheme => {\n  if (!fills.length) return PitViperAGChartsMulticolorTheme;\n  return {\n    // Without strokes, AG outlines series (e.g. scatter markers) in its own default colors.\n    palette: { fills, strokes: fills },\n    overrides: { ...baseOverrides, scatter: createScatterOverrides() },\n    params: baseParams,\n  };\n};\n","/**\n * Builds a 15-color chart palette from 1-4 picked colors.\n *\n * Works in OKLab/OKLCH so distances match what people see.\n * One pick gives a monochrome ramp; 2-4 picks are adjusted for readability on a\n * white chart, then the palette is filled by farthest-point selection from\n * hue families derived from the picks. Every adjustment adds a plain-language note.\n */\n\ntype Lab = [number, number, number];\ninterface Lch {\n  l: number;\n  c: number;\n  h: number;\n}\n\ninterface AdjustedPick {\n  lch: Lch;\n  neutral: boolean;\n  /** Original hex, kept when the pick needed no adjustment. */\n  keep?: string;\n}\n\nexport interface GeneratedColorPalette {\n  colors: string[];\n  /** Plain-language notes describing each adjustment, in order. */\n  notes: string[];\n  /**\n   * The same notes grouped by the picked color they are about: `pickNotes[0]` is about the first\n   * pick. Notes about the whole palette (e.g. all picks are gray) appear only in `notes`.\n   */\n  pickNotes: string[][];\n}\n\ntype AddNote = (message: string, pick?: number) => void;\n\nconst createNotes = (pickCount: number) => {\n  const notes: string[] = [];\n  const pickNotes: string[][] = Array.from({ length: pickCount }, () => []);\n  const add: AddNote = (message, pick) => {\n    notes.push(message);\n    if (pick !== undefined) pickNotes[pick].push(message);\n  };\n  return { notes, pickNotes, add };\n};\n\nexport const TURQUOISE_PRIMARY = \"#36C5BA\";\nexport const DEFAULT_PALETTE_SIZE = 15;\nexport const MAX_SOURCE_COLORS = 4;\nexport const MAX_PALETTE_SIZE = 64;\n\n/** Palette size as a whole number in 0-64. Non-numbers give the default size. */\nconst toPaletteSize = (count: number) =>\n  Number.isFinite(count) ? Math.min(Math.max(Math.floor(count), 0), MAX_PALETTE_SIZE) : DEFAULT_PALETTE_SIZE;\n\nconst MAX_LIGHTNESS = 0.8;\nconst MIN_CHROMA = 0.07;\nconst MAX_CHROMA = 0.2;\nconst NEUTRAL_CHROMA = 0.03;\nconst MIN_DISTANCE_PAIR = 0.16;\nconst MIN_DISTANCE_MULTI = 0.1;\nconst MIN_DISTANCE_BEFORE_HUE_ROTATE_MULTI = 0.06;\n// Hue families used when every pick is gray: teal, orange, purple, green.\nconst GRAY_FALLBACK_HUES = [195, 30, 280, 130];\n\nconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));\n\n/** Normalizes `#abc`, `abc`, `#aabbcc` to uppercase `#AABBCC`. Returns null when invalid. */\nexport const normalizeHex = (value: string): string | null => {\n  let hex = value.trim().replace(/^#/, \"\");\n  if (/^[0-9a-fA-F]{3}$/.test(hex)) {\n    hex = hex\n      .split(\"\")\n      .map((char) => char + char)\n      .join(\"\");\n  }\n  return /^[0-9a-fA-F]{6}$/.test(hex) ? `#${hex.toUpperCase()}` : null;\n};\n\nconst srgbToLinear = (value: number) => (value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4);\nconst linearToSrgb = (value: number) => (value <= 0.0031308 ? 12.92 * value : 1.055 * value ** (1 / 2.4) - 0.055);\n\nconst hexToOklab = (hex: string): Lab => {\n  const value = parseInt(hex.slice(1), 16);\n  const r = srgbToLinear(((value >> 16) & 255) / 255);\n  const g = srgbToLinear(((value >> 8) & 255) / 255);\n  const b = srgbToLinear((value & 255) / 255);\n  const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n  const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n  const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n  return [\n    0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,\n    1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,\n    0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,\n  ];\n};\n\nconst oklabToOklch = ([l, a, b]: Lab): Lch => ({\n  l,\n  c: Math.hypot(a, b),\n  h: ((Math.atan2(b, a) * 180) / Math.PI + 360) % 360,\n});\n\nconst oklchToOklab = ({ l, c, h }: Lch): Lab => [\n  l,\n  c * Math.cos((h * Math.PI) / 180),\n  c * Math.sin((h * Math.PI) / 180),\n];\n\nconst oklabToLinearRgb = ([l, a, b]: Lab): Lab => {\n  const l3 = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;\n  const m3 = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;\n  const s3 = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;\n  return [\n    4.0767416621 * l3 - 3.3077115913 * m3 + 0.2309699292 * s3,\n    -1.2684380046 * l3 + 2.6097574011 * m3 - 0.3413193965 * s3,\n    -0.0041960863 * l3 - 0.7034186147 * m3 + 1.707614701 * s3,\n  ];\n};\n\nconst inGamut = (rgb: Lab) => rgb.every((channel) => channel >= -5e-4 && channel <= 1.0005);\n\n// Lowers chroma until the color fits in sRGB.\nconst clampChroma = (lch: Lch): Lch => {\n  let { c } = lch;\n  while (c > 0 && !inGamut(oklabToLinearRgb(oklchToOklab({ ...lch, c })))) {\n    c -= 0.004;\n  }\n  return { ...lch, c: Math.max(0, c) };\n};\n\nconst oklchToHex = (lch: Lch): string =>\n  \"#\" +\n  oklabToLinearRgb(oklchToOklab(clampChroma(lch)))\n    .map((channel) => Math.round(clamp(linearToSrgb(clamp(channel, 0, 1)), 0, 1) * 255))\n    .map((channel) => channel.toString(16).padStart(2, \"0\"))\n    .join(\"\")\n    .toUpperCase();\n\nconst labDistance = (a: Lab, b: Lab) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);\n\n/** Perceptual (OKLab) distance between two `#RRGGBB` colors. About 0.02 is a just-noticeable difference. */\nexport const colorDistance = (a: string, b: string): number => labDistance(hexToOklab(a), hexToOklab(b));\n\nconst hueDistance = (a: number, b: number) => {\n  const distance = Math.abs(a - b) % 360;\n  return distance > 180 ? 360 - distance : distance;\n};\n\nconst wrapHue = (hue: number) => ((hue % 360) + 360) % 360;\n\n// Yellows and greens need more lightness to read as their hue.\nconst minLightness = (hue: number) => (hue >= 75 && hue <= 125 ? 0.68 : 0.42);\n\nconst adjustPick = (hex: string, name: string, addNote: (message: string) => void): AdjustedPick => {\n  const original = oklabToOklch(hexToOklab(hex));\n  const neutral = original.c < NEUTRAL_CHROMA;\n  const lch = { ...original };\n  const reasons: string[] = [];\n  const lightnessFloor = neutral ? 0.38 : minLightness(original.h);\n\n  if (original.l < lightnessFloor) {\n    lch.l = lightnessFloor;\n    reasons.push(\"too dark to read on a white chart\");\n  } else if (original.l > MAX_LIGHTNESS) {\n    lch.l = MAX_LIGHTNESS;\n    reasons.push(\"too light to read on a white chart\");\n  }\n\n  if (!neutral) {\n    if (original.c < MIN_CHROMA) {\n      lch.c = MIN_CHROMA;\n      reasons.push(\"too dull next to the other colors\");\n    } else if (original.c > MAX_CHROMA) {\n      lch.c = MAX_CHROMA;\n      reasons.push(\"too intense\");\n    }\n  }\n\n  if (reasons.length) {\n    addNote(`${name} (${hex}) was ${reasons.join(\" and \")}, so we adjusted it.`);\n  }\n  return { lch, neutral, keep: reasons.length ? undefined : hex };\n};\n\n// Hue families the fill colors are drawn from: the picks plus in-between and complementary hues.\nconst buildHueFamilies = (hues: number[]): number[] => {\n  const families = [...hues];\n  const addFamily = (hue: number, minGap = 22) => {\n    if (!families.some((family) => hueDistance(family, hue) < minGap)) {\n      families.push(hue);\n    }\n  };\n\n  if (hues.length === 2) {\n    const [first, second] = hues;\n    const gap = hueDistance(first, second);\n    const direction = wrapHue(second - first) <= 180 ? 1 : -1;\n    const along = (t: number) => wrapHue(first + direction * gap * t);\n    if (gap >= 50) {\n      addFamily(along(1 / 3));\n      addFamily(along(2 / 3));\n      if (gap > 150) addFamily(wrapHue(first + 90 * -direction));\n    } else {\n      addFamily(wrapHue(first + 35));\n      addFamily(wrapHue(first - 35));\n      addFamily(wrapHue(first + 180), 30);\n    }\n    return families;\n  }\n\n  const sorted = [...hues].sort((a, b) => a - b);\n  let largestGap = 0;\n  sorted.forEach((hue, index) => {\n    const next = sorted[(index + 1) % sorted.length];\n    const gap = wrapHue(next - hue) || 360;\n    largestGap = Math.max(largestGap, gap);\n    if (gap >= 60 && gap < 360) addFamily(wrapHue(hue + gap / 2));\n  });\n\n  if (largestGap >= 310) {\n    const first = hues[0];\n    addFamily(wrapHue(first + 35));\n    addFamily(wrapHue(first - 35));\n    addFamily(wrapHue(first + 180), 30);\n  }\n  return families;\n};\n\n/**\n * Builds a monochrome ramp around one color, ordered so neighbors in the palette differ most.\n * @param name Display name for the color used in notes. Defaults to \"Your color\".\n */\nexport function generateMonochromePalette(\n  hex: string = TURQUOISE_PRIMARY,\n  count = DEFAULT_PALETTE_SIZE,\n  name = \"Your color\",\n): GeneratedColorPalette {\n  count = toPaletteSize(count);\n  if (!count) return { colors: [], notes: [], pickNotes: [] };\n  const { notes, pickNotes, add } = createNotes(1);\n  const pick = adjustPick(normalizeHex(hex) ?? TURQUOISE_PRIMARY, name, (message) => add(message, 0));\n  const { h: hue, l: lightness } = pick.lch;\n  const chroma = pick.neutral ? pick.lch.c : Math.max(pick.lch.c, 0.06);\n  const minL = hue >= 75 && hue <= 125 ? 0.56 : 0.28;\n  const maxL = 0.88;\n  const steps = Array.from({ length: count }, (_, index) => minL + ((maxL - minL) * index) / Math.max(count - 1, 1));\n\n  let anchor = 0;\n  steps.forEach((step, index) => {\n    if (Math.abs(step - lightness) < Math.abs(steps[anchor] - lightness)) anchor = index;\n  });\n  steps[anchor] = lightness;\n\n  const shades = steps.map((step, index) => {\n    if (index === anchor) return pick.keep ?? oklchToHex(pick.lch);\n    const distance = Math.abs(step - lightness) / Math.max(lightness - minL, maxL - lightness);\n    const c = pick.neutral ? chroma : chroma * (1 - 0.5 * distance ** 1.5);\n    return oklchToHex({ l: step, c, h: wrapHue(hue + (step - lightness) * -14) });\n  });\n\n  const order = [anchor];\n  while (order.length < count) {\n    let bestIndex = -1;\n    let bestGap = -1;\n    steps.forEach((step, index) => {\n      if (order.includes(index)) return;\n      const gap = Math.min(...order.map((ordered) => Math.abs(step - steps[ordered])));\n      if (gap > bestGap + 1e-9) {\n        bestGap = gap;\n        bestIndex = index;\n      }\n    });\n    order.push(bestIndex);\n  }\n\n  return { colors: order.map((index) => shades[index]), notes, pickNotes };\n}\n\n/**\n * Builds a chart palette from picked colors.\n * Series N gets color N, so the picks come first (adjusted when needed), then fill colors.\n * @param hexes 0-4 picked colors. None or one gives a monochrome palette.\n * @param count Palette size, a whole number in 0-64. Picks past the size are dropped.\n * @param names Display names for the picks used in notes. Defaults to \"Color 1\", \"Color 2\", ...\n *\n * Custom theme ids store only the picks, so this output is persisted behavior: changing it\n * restyles every saved custom theme. The \"palette output is stable\" tests pin it.\n */\nexport function generateColorPalette(\n  hexes: string[],\n  count = DEFAULT_PALETTE_SIZE,\n  names?: string[],\n): GeneratedColorPalette {\n  count = toPaletteSize(count);\n  hexes = hexes.slice(0, Math.min(MAX_SOURCE_COLORS, count));\n  if (!count) return { colors: [], notes: [], pickNotes: [] };\n  if (hexes.length < 2) return generateMonochromePalette(hexes[0] ?? TURQUOISE_PRIMARY, count, names?.[0]);\n\n  const { notes, pickNotes, add } = createNotes(hexes.length);\n  const nameOf = (index: number) => names?.[index] ?? `Color ${index + 1}`;\n  const picks = hexes.map((hex, index) =>\n    adjustPick(normalizeHex(hex) ?? TURQUOISE_PRIMARY, nameOf(index), (message) => add(message, index)),\n  );\n\n  const chromatic = picks.find((pick) => !pick.neutral);\n  if (chromatic) {\n    for (const pick of picks) {\n      if (pick.neutral) pick.lch.h = chromatic.lch.h;\n    }\n  } else {\n    picks.forEach((pick, index) => (pick.lch.h = GRAY_FALLBACK_HUES[index % GRAY_FALLBACK_HUES.length]));\n    add(\n      `${picks.length === 2 ? \"Both colors are\" : \"All colors are\"} gray, so the other series use a teal and orange family.`,\n    );\n  }\n\n  const nearestEarlierPick = (index: number) => {\n    let nearest = { index: -1, distance: Infinity };\n    for (let other = 0; other < index; other++) {\n      const distance = labDistance(oklchToOklab(picks[other].lch), oklchToOklab(picks[index].lch));\n      if (distance < nearest.distance) nearest = { index: other, distance };\n    }\n    return nearest;\n  };\n\n  const multi = picks.length >= 3;\n  const minDistance = multi ? MIN_DISTANCE_MULTI : MIN_DISTANCE_PAIR;\n  const hueRotateDistance = multi ? MIN_DISTANCE_BEFORE_HUE_ROTATE_MULTI : MIN_DISTANCE_PAIR;\n\n  // Push picks that are too close to an earlier pick apart: first by lightness, then by hue.\n  for (let index = 1; index < picks.length; index++) {\n    const pick = picks[index];\n    const nearest = nearestEarlierPick(index);\n    if (nearest.distance >= minDistance) continue;\n\n    const nearestLightness = picks[nearest.index].lch.l;\n    for (const step of [0.14, 0.2, 0.26]) {\n      pick.lch.l = clamp(pick.lch.l + (nearestLightness > 0.6 ? -step : step), minLightness(pick.lch.h), MAX_LIGHTNESS);\n      if (nearestEarlierPick(index).distance >= minDistance) break;\n    }\n    for (let attempt = 0; attempt < 5 && nearestEarlierPick(index).distance < hueRotateDistance; attempt++) {\n      pick.lch.h = wrapHue(pick.lch.h + 60);\n      pick.lch.c = Math.max(pick.lch.c, 0.12);\n    }\n    if (nearestEarlierPick(index).distance !== nearest.distance) {\n      pick.keep = undefined;\n      add(\n        `${nameOf(index)} was too similar to ${nameOf(nearest.index).toLowerCase()} to tell apart, so we changed ${nameOf(index).toLowerCase()}.`,\n        index,\n      );\n    }\n  }\n\n  const pickHues = picks.map((pick) => pick.lch.h);\n  const candidates: { hex: string; lab: Lab; hue: number }[] = [];\n  for (const family of buildHueFamilies(pickHues)) {\n    for (const offset of [-14, 0, 14]) {\n      const hue = wrapHue(family + offset);\n      for (const l of [0.46, 0.56, 0.66, 0.76]) {\n        if (l < minLightness(hue) || l > MAX_LIGHTNESS) continue;\n        for (const c of [0.1, 0.14, 0.18]) {\n          const hex = oklchToHex({ l, c, h: hue });\n          candidates.push({ hex, lab: hexToOklab(hex), hue });\n        }\n      }\n    }\n  }\n\n  const chosen = picks.map((pick) => {\n    const hex = pick.keep ?? oklchToHex(pick.lch);\n    return { hex, lab: hexToOklab(hex) };\n  });\n\n  // Farthest-point fill, favoring hues near the picks and lightly penalizing very saturated colors.\n  while (chosen.length < count) {\n    let best: (typeof candidates)[number] | undefined;\n    let bestScore = -1;\n    for (const candidate of candidates) {\n      let distance = Infinity;\n      for (const color of chosen) distance = Math.min(distance, labDistance(candidate.lab, color.lab));\n      const saturationPenalty = 1 - 0.25 * Math.max(0, candidate.lab[1] ** 2 + candidate.lab[2] ** 2 - 0.0144) ** 0.5;\n      const score = distance * saturationPenalty;\n      const offFamilyWeight = multi && chosen.length < 9 ? 0.2 : 0.45;\n      const weight = pickHues.some((hue) => hueDistance(hue, candidate.hue) <= 40) ? 1 : offFamilyWeight;\n      if (score * weight > bestScore) {\n        bestScore = score * weight;\n        best = candidate;\n      }\n    }\n    if (!best) break;\n    chosen.push(best);\n  }\n\n  return { colors: chosen.map((color) => color.hex), notes, pickNotes };\n}\n","import type { AgChartTheme } from \"ag-charts-enterprise\";\nimport { createPitViperAGChartsTheme, multicolorFills, PitViperAGChartsMulticolorTheme } from \"@charts/themes\";\nimport { DEFAULT_PALETTE_SIZE, generateColorPalette, MAX_SOURCE_COLORS, normalizeHex } from \"@/functions/colorPalette\";\n\n/** Ids of the built-in color themes. */\nexport type PvPresetColorThemeId = \"default\" | \"ocean\" | \"sunset\" | \"forest\";\n/** A custom theme id. Encodes its 1-4 key colors, e.g. `custom:04D7C6-EC5A62`. */\nexport type PvCustomColorThemeId = `custom:${string}`;\n/**\n * A color theme. This string is the whole theme: components take it and emit it, and it can be\n * stored as-is. Use `resolveColorTheme` or `useColorTheme` to get its colors.\n */\nexport type PvColorThemeId = PvPresetColorThemeId | PvCustomColorThemeId;\n\n/** A color theme resolved from its id. */\nexport interface PvColorTheme {\n  id: PvColorThemeId;\n  /** Display name, e.g. \"Ocean\". */\n  label: string;\n  /** The 1-4 key colors. PvColorPalette shows these; a custom theme is generated from them. */\n  colors: string[];\n  /** Full chart fills in series order. Series N uses `palette[N % palette.length]`. */\n  palette: string[];\n}\n\nexport const PV_DEFAULT_COLOR_THEME_ID = \"default\" satisfies PvColorThemeId;\nconst CUSTOM_PREFIX = \"custom:\";\nconst CUSTOM_LABEL = \"Custom theme\";\n\nconst preset = (id: PvPresetColorThemeId, label: string, palette: string[]): PvColorTheme => ({\n  id,\n  label,\n  colors: palette.slice(0, MAX_SOURCE_COLORS),\n  palette,\n});\n\nexport const PvDefaultColorTheme = preset(\"default\", \"Default\", [...multicolorFills]);\n\nexport const PvOceanColorTheme = preset(\"ocean\", \"Ocean\", [\n  \"#0B3C5D\",\n  \"#1CA7C7\",\n  \"#328CC1\",\n  \"#0F7A8A\",\n  \"#7FD1E0\",\n  \"#1D5C96\",\n  \"#2EC4B6\",\n  \"#3A5A8C\",\n  \"#5BC0EB\",\n  \"#14505C\",\n  \"#66A3C2\",\n  \"#1B998B\",\n  \"#09284A\",\n  \"#9AD9D0\",\n  \"#4A7FA7\",\n]);\n\nexport const PvSunsetColorTheme = preset(\"sunset\", \"Sunset\", [\n  \"#E4572E\",\n  \"#F3A712\",\n  \"#8C2F39\",\n  \"#FF8C61\",\n  \"#5E2750\",\n  \"#FFD166\",\n  \"#C0392B\",\n  \"#F7B267\",\n  \"#A63D72\",\n  \"#FFB4A2\",\n  \"#7A3E1D\",\n  \"#E5989B\",\n  \"#D9822B\",\n  \"#6D2E46\",\n  \"#FFE0A3\",\n]);\n\nexport const PvForestColorTheme = preset(\"forest\", \"Forest\", [\n  \"#2D6A4F\",\n  \"#BC6C25\",\n  \"#606C38\",\n  \"#DDA15E\",\n  \"#40916C\",\n  \"#6B4423\",\n  \"#95D5B2\",\n  \"#8A9A5B\",\n  \"#283618\",\n  \"#A98467\",\n  \"#B7B77A\",\n  \"#4F772D\",\n  \"#CB997E\",\n  \"#3E5C48\",\n  \"#E9D8A6\",\n]);\n\n/** Built-in themes, default first. */\nexport const PV_DEFAULT_COLOR_THEMES: PvColorTheme[] = [\n  PvDefaultColorTheme,\n  PvOceanColorTheme,\n  PvSunsetColorTheme,\n  PvForestColorTheme,\n];\n\n/** True for a custom theme id (`custom:...`). */\nexport const isCustomColorThemeId = (id?: string | null): id is PvCustomColorThemeId => !!id?.startsWith(CUSTOM_PREFIX);\n\nconst toValidColors = (colors: string[]) =>\n  colors\n    .map((color) => normalizeHex(color))\n    .filter((color): color is string => !!color)\n    .slice(0, MAX_SOURCE_COLORS);\n\n/**\n * Builds the custom theme id for 1-4 key colors, e.g. `[\"#04d7c6\", \"#EC5A62\"]` gives\n * `custom:04D7C6-EC5A62`. Invalid colors are dropped. Returns `undefined` when none are valid.\n */\nexport function toCustomColorThemeId(colors: string[]): PvCustomColorThemeId | undefined {\n  const valid = toValidColors(colors);\n  if (!valid.length) return undefined;\n  return `${CUSTOM_PREFIX}${valid.map((color) => color.slice(1)).join(\"-\")}`;\n}\n\n// `custom:` plus 1-4 six-digit hex colors joined by \"-\". Ids are often read from storage, so\n// anything else (bad or extra colors, other text) is rejected rather than partly read.\nconst CUSTOM_ID_PATTERN = new RegExp(`^${CUSTOM_PREFIX}[0-9a-f]{6}(?:-[0-9a-f]{6}){0,${MAX_SOURCE_COLORS - 1}}$`, \"i\");\n\n/** The key colors encoded in a custom theme id. Empty for presets and malformed ids. */\nexport function getCustomColorThemeColors(id?: string | null): string[] {\n  if (!isCustomColorThemeId(id) || !CUSTOM_ID_PATTERN.test(id)) return [];\n  return toValidColors(id.slice(CUSTOM_PREFIX.length).split(\"-\"));\n}\n\nexport interface CreateCustomColorThemeOptions {\n  /** Palette size. Defaults to 15. */\n  count?: number;\n  /** Names for the picks used in notes. Defaults to \"Color 1\", \"Color 2\", ... */\n  names?: string[];\n}\n\n/**\n * Generates a custom theme from 1-4 key colors.\n * Invalid hex values are dropped and colors past the fourth are ignored.\n * Returns the theme (or `undefined` when no color is valid) plus notes on any adjusted picks.\n * `pickNotes[i]` is about `theme.colors[i]`, so its indexes skip dropped colors.\n */\nexport function createCustomColorTheme(\n  colors: string[],\n  options: CreateCustomColorThemeOptions = {},\n): { theme: PvColorTheme | undefined; notes: string[]; pickNotes: string[][] } {\n  const id = toCustomColorThemeId(colors);\n  if (!id) return { theme: undefined, notes: [], pickNotes: [] };\n  const validColors = toValidColors(colors);\n  const {\n    colors: palette,\n    notes,\n    pickNotes,\n  } = generateColorPalette(validColors, options.count ?? DEFAULT_PALETTE_SIZE, options.names);\n  return { theme: { id, label: CUSTOM_LABEL, colors: validColors, palette }, notes, pickNotes };\n}\n\n/**\n * Resolves a theme id to its label and colors.\n * Presets resolve by id, so stored ids pick up preset updates. Custom ids rebuild their palette\n * from the encoded colors. Missing, unknown, or malformed ids fall back to Default.\n */\nexport function resolveColorTheme(id?: string | null): PvColorTheme {\n  if (isCustomColorThemeId(id)) {\n    return createCustomColorTheme(getCustomColorThemeColors(id)).theme ?? PvDefaultColorTheme;\n  }\n  return PV_DEFAULT_COLOR_THEMES.find((theme) => theme.id === id) ?? PvDefaultColorTheme;\n}\n\n/** The full chart fills for a theme id, in series order. */\nexport const getColorThemePalette = (id?: string | null): string[] => resolveColorTheme(id).palette;\n\n/**\n * The AG Charts theme for a theme id: its palette plus the rest of the Pit Viper chart styling.\n * Default (and any id that falls back to it) gives `PitViperAGChartsMulticolorTheme`.\n */\nexport function getColorThemeAGChartsTheme(id?: string | null): AgChartTheme {\n  const theme = resolveColorTheme(id);\n  return theme.id === PV_DEFAULT_COLOR_THEME_ID\n    ? PitViperAGChartsMulticolorTheme\n    : createPitViperAGChartsTheme(theme.palette);\n}\n","<script setup lang=\"ts\">\nimport { computed, watchEffect } from \"vue\";\nimport { isCustomColorThemeId, resolveColorTheme } from \"@/functions/colorThemes\";\nimport type { PvColorPaletteProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvColorPaletteProps>(), { maxColors: 4 });\n\nconst resolved = computed(() => resolveColorTheme(props.theme));\nconst swatches = computed(() => resolved.value.palette.slice(0, Math.max(0, Math.floor(props.maxColors))));\n\nwatchEffect(() => {\n  if (\n    resolved.value.id !== props.theme &&\n    !(isCustomColorThemeId(props.theme) && isCustomColorThemeId(resolved.value.id))\n  ) {\n    console.warn(`[PvColorPalette] Unknown color theme \"${props.theme}\"; showing Default.`);\n  }\n});\n</script>\n\n<template>\n  <span\n    class=\"pv-color-palette\"\n    role=\"img\"\n    :aria-label=\"`${resolved.label} color palette`\"\n    data-testid=\"pv-color-palette\"\n  >\n    <span\n      v-for=\"(color, index) in swatches\"\n      :key=\"`${index}-${color}`\"\n      class=\"pv-color-palette-swatch\"\n      :style=\"{ backgroundColor: color }\"\n      data-testid=\"pv-color-palette-swatch\"\n    />\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watchEffect } from \"vue\";\nimport { isCustomColorThemeId, resolveColorTheme } from \"@/functions/colorThemes\";\nimport type { PvColorPaletteProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvColorPaletteProps>(), { maxColors: 4 });\n\nconst resolved = computed(() => resolveColorTheme(props.theme));\nconst swatches = computed(() => resolved.value.palette.slice(0, Math.max(0, Math.floor(props.maxColors))));\n\nwatchEffect(() => {\n  if (\n    resolved.value.id !== props.theme &&\n    !(isCustomColorThemeId(props.theme) && isCustomColorThemeId(resolved.value.id))\n  ) {\n    console.warn(`[PvColorPalette] Unknown color theme \"${props.theme}\"; showing Default.`);\n  }\n});\n</script>\n\n<template>\n  <span\n    class=\"pv-color-palette\"\n    role=\"img\"\n    :aria-label=\"`${resolved.label} color palette`\"\n    data-testid=\"pv-color-palette\"\n  >\n    <span\n      v-for=\"(color, index) in swatches\"\n      :key=\"`${index}-${color}`\"\n      class=\"pv-color-palette-swatch\"\n      :style=\"{ backgroundColor: color }\"\n      data-testid=\"pv-color-palette-swatch\"\n    />\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvInputType, PvInputVariant } from \"./types\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\ninterface PvInputProps {\n  /** When true, upper label is visible */\n  showLabel?: boolean;\n  /** When true, applies invalid/error styling to the input and lower label. */\n  error?: boolean;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Placeholder text shown when the input is empty. */\n  placeholder?: string;\n  /**\n   * The HTML input type.\n   */\n  type?: PvInputType;\n  /** HTML id for the input element. Auto-generated when omitted. */\n  id?: string;\n  /** Helper or validation text displayed below the input. Turns red when error is true. */\n  lowerLabel?: string;\n  /**\n   * Background color variant of the input field.\n   */\n  variant?: PvInputVariant;\n  /** The step attribute for number inputs (e.g. '0.01' for currency). */\n  step?: string;\n  /** Static text shown before the Input */\n  prefixLabel?: string;\n  /** Optional Icon on the left of the Input */\n  inputIcon?: string;\n}\n\nconst props = withDefaults(defineProps<PvInputProps>(), {\n  id: Math.random().toString(),\n  type: \"text\",\n  variant: \"white\",\n});\n\nconst value = defineModel<string>();\n\nconst inputPadding = computed(() => {\n  if (props.inputIcon) {\n    return {\n      \"--inset-size\": \"8px 12px 6px 36px\",\n    };\n  }\n\n  return {};\n});\n</script>\n\n<template>\n  <label v-if=\"$slots.label || showLabel\" data-testid=\"pv-input-label\" class=\"pv-label pv-stack-8\" :for=\"id\">\n    <slot name=\"label\" />\n  </label>\n  <div\n    class=\"pv-flex pv-flex-item\"\n    :class=\"{\n      'pv-stack-8': lowerLabel,\n    }\"\n  >\n    <div\n      v-if=\"prefixLabel\"\n      class=\"pv-surface-accent pv-inset-square pv-text-body-md pv-radius pv-bordered\"\n      style=\"--inset-size: 6px 10px\"\n    >\n      {{ prefixLabel }}\n    </div>\n    <div class=\"pv-relative pv-flex-item\">\n      <PvIcon class=\"pv-absolute input-icon-position\" v-if=\"inputIcon\" :name=\"inputIcon\" />\n      <input\n        v-bind=\"$attrs\"\n        v-model=\"value\"\n        data-testid=\"pv-input\"\n        :class=\"[\n          'pv-input-text',\n          {\n            'pv-inset-square': inputIcon,\n            'pv-surface-accent': variant === 'grey',\n          },\n        ]\"\n        :style=\"[inputPadding, { width: '100%' }]\"\n        :disabled=\"disabled\"\n        :type=\"type\"\n        :placeholder=\"placeholder\"\n        :id=\"id\"\n        :data-invalid=\"error ? true : undefined\"\n        :step=\"step\"\n      />\n    </div>\n  </div>\n  <p\n    v-if=\"lowerLabel\"\n    data-testid=\"pv-input-lower-label\"\n    style=\"margin-left: 12px\"\n    :class=\"[\n      'pv-text-body-xs',\n      {\n        'pv-text-red': error,\n        'pv-text-subdued': !error,\n      },\n    ]\"\n  >\n    {{ lowerLabel }}\n  </p>\n</template>\n\n<style>\n.input-icon-position {\n  position: absolute;\n  left: 12px;\n  top: 8px;\n  pointer-events: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvInputType, PvInputVariant } from \"./types\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\ninterface PvInputProps {\n  /** When true, upper label is visible */\n  showLabel?: boolean;\n  /** When true, applies invalid/error styling to the input and lower label. */\n  error?: boolean;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Placeholder text shown when the input is empty. */\n  placeholder?: string;\n  /**\n   * The HTML input type.\n   */\n  type?: PvInputType;\n  /** HTML id for the input element. Auto-generated when omitted. */\n  id?: string;\n  /** Helper or validation text displayed below the input. Turns red when error is true. */\n  lowerLabel?: string;\n  /**\n   * Background color variant of the input field.\n   */\n  variant?: PvInputVariant;\n  /** The step attribute for number inputs (e.g. '0.01' for currency). */\n  step?: string;\n  /** Static text shown before the Input */\n  prefixLabel?: string;\n  /** Optional Icon on the left of the Input */\n  inputIcon?: string;\n}\n\nconst props = withDefaults(defineProps<PvInputProps>(), {\n  id: Math.random().toString(),\n  type: \"text\",\n  variant: \"white\",\n});\n\nconst value = defineModel<string>();\n\nconst inputPadding = computed(() => {\n  if (props.inputIcon) {\n    return {\n      \"--inset-size\": \"8px 12px 6px 36px\",\n    };\n  }\n\n  return {};\n});\n</script>\n\n<template>\n  <label v-if=\"$slots.label || showLabel\" data-testid=\"pv-input-label\" class=\"pv-label pv-stack-8\" :for=\"id\">\n    <slot name=\"label\" />\n  </label>\n  <div\n    class=\"pv-flex pv-flex-item\"\n    :class=\"{\n      'pv-stack-8': lowerLabel,\n    }\"\n  >\n    <div\n      v-if=\"prefixLabel\"\n      class=\"pv-surface-accent pv-inset-square pv-text-body-md pv-radius pv-bordered\"\n      style=\"--inset-size: 6px 10px\"\n    >\n      {{ prefixLabel }}\n    </div>\n    <div class=\"pv-relative pv-flex-item\">\n      <PvIcon class=\"pv-absolute input-icon-position\" v-if=\"inputIcon\" :name=\"inputIcon\" />\n      <input\n        v-bind=\"$attrs\"\n        v-model=\"value\"\n        data-testid=\"pv-input\"\n        :class=\"[\n          'pv-input-text',\n          {\n            'pv-inset-square': inputIcon,\n            'pv-surface-accent': variant === 'grey',\n          },\n        ]\"\n        :style=\"[inputPadding, { width: '100%' }]\"\n        :disabled=\"disabled\"\n        :type=\"type\"\n        :placeholder=\"placeholder\"\n        :id=\"id\"\n        :data-invalid=\"error ? true : undefined\"\n        :step=\"step\"\n      />\n    </div>\n  </div>\n  <p\n    v-if=\"lowerLabel\"\n    data-testid=\"pv-input-lower-label\"\n    style=\"margin-left: 12px\"\n    :class=\"[\n      'pv-text-body-xs',\n      {\n        'pv-text-red': error,\n        'pv-text-subdued': !error,\n      },\n    ]\"\n  >\n    {{ lowerLabel }}\n  </p>\n</template>\n\n<style>\n.input-icon-position {\n  position: absolute;\n  left: 12px;\n  top: 8px;\n  pointer-events: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport { normalizeHex } from \"@/functions/colorPalette\";\n\n// Saturation/brightness area plus hue slider for picking one color. Private to PvColorPicker.\n\n/** The picked color as `#RRGGBB`. Other values leave the picker on its last color. */\nconst model = defineModel<string>();\n\ninterface Hsv {\n  h: number;\n  s: number;\n  v: number;\n}\n\nconst clamp = (value: number, min = 0, max = 1) => Math.min(max, Math.max(min, value));\n\nconst hexToHsv = (hex: string): Hsv => {\n  const value = parseInt(hex.slice(1), 16);\n  const [r, g, b] = [(value >> 16) & 255, (value >> 8) & 255, value & 255].map((channel) => channel / 255);\n  const max = Math.max(r, g, b);\n  const delta = max - Math.min(r, g, b);\n  let h = 0;\n  if (delta) {\n    if (max === r) h = ((g - b) / delta) % 6;\n    else if (max === g) h = (b - r) / delta + 2;\n    else h = (r - g) / delta + 4;\n  }\n  return { h: (h * 60 + 360) % 360, s: max ? delta / max : 0, v: max };\n};\n\nconst hsvToHex = ({ h, s, v }: Hsv): string => {\n  const channel = (n: number) => {\n    const k = (n + h / 60) % 6;\n    return v - v * s * clamp(Math.min(k, 4 - k));\n  };\n  return (\n    \"#\" +\n    [channel(5), channel(3), channel(1)]\n      .map((value) =>\n        Math.round(value * 255)\n          .toString(16)\n          .padStart(2, \"0\"),\n      )\n      .join(\"\")\n      .toUpperCase()\n  );\n};\n\nconst hsv = ref<Hsv>(hexToHsv(normalizeHex(model.value ?? \"\") ?? \"#36C5BA\"));\nconst hex = computed(() => hsvToHex(hsv.value));\n\n// Follow typed colors, but keep the current hue for grays, where hue is undefined.\nwatch(model, (next) => {\n  const valid = normalizeHex(next ?? \"\");\n  if (!valid || valid === hex.value) return;\n  const parsed = hexToHsv(valid);\n  hsv.value = parsed.s && parsed.v ? parsed : { ...parsed, h: hsv.value.h };\n});\n\nconst update = (next: Partial<Hsv>) => {\n  hsv.value = { ...hsv.value, ...next };\n  model.value = hex.value;\n};\n\nconst hueColor = computed(() => hsvToHex({ h: hsv.value.h, s: 1, v: 1 }));\n\nconst fromPointer = (event: PointerEvent) => {\n  const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n  return {\n    x: clamp((event.clientX - rect.left) / (rect.width || 1)),\n    y: clamp((event.clientY - rect.top) / (rect.height || 1)),\n  };\n};\n\nconst saturationSlider = ref<HTMLElement>();\nconst brightnessSlider = ref<HTMLElement>();\n\nconst startDrag = (event: PointerEvent, apply: (event: PointerEvent) => void, focusTarget?: HTMLElement) => {\n  const target = event.currentTarget as HTMLElement;\n  target.setPointerCapture?.(event.pointerId);\n  (focusTarget ?? target).focus();\n  event.preventDefault();\n  apply(event);\n};\n\nconst onAreaPointer = (event: PointerEvent) => {\n  const { x, y } = fromPointer(event);\n  update({ s: x, v: 1 - y });\n};\nconst onHuePointer = (event: PointerEvent) => {\n  update({ h: fromPointer(event).x * 359.99 });\n};\nconst whileDragging = (event: PointerEvent, apply: (event: PointerEvent) => void) => {\n  if ((event.currentTarget as HTMLElement).hasPointerCapture?.(event.pointerId)) apply(event);\n};\n\nconst STEP = 0.01;\nconst BIG_STEP = 0.1;\n\n// The area is two sliders: saturation (left/right) and brightness (up/down). Arrow keys move the\n// thumb in 2D from either one, focusing the slider for the axis that changed so it is announced.\nconst onAreaKeydown = (event: KeyboardEvent, axis: \"s\" | \"v\") => {\n  const step = event.shiftKey ? BIG_STEP : STEP;\n  const arrows: Record<string, [\"s\" | \"v\", number]> = {\n    ArrowLeft: [\"s\", -step],\n    ArrowRight: [\"s\", step],\n    ArrowDown: [\"v\", -step],\n    ArrowUp: [\"v\", step],\n  };\n  const keys: Record<string, [\"s\" | \"v\", number]> = {\n    ...arrows,\n    PageDown: [axis, -BIG_STEP],\n    PageUp: [axis, BIG_STEP],\n    Home: [axis, -1],\n    End: [axis, 1],\n  };\n  const move = keys[event.key];\n  if (!move) return;\n  event.preventDefault();\n  const [changed, delta] = move;\n  update({ [changed]: clamp(hsv.value[changed] + delta) });\n  if (changed !== axis) (changed === \"s\" ? saturationSlider : brightnessSlider).value?.focus();\n};\n\nconst onHueKeydown = (event: KeyboardEvent) => {\n  const step = event.shiftKey ? 10 : 1;\n  const moves: Record<string, number> = {\n    ArrowLeft: -step,\n    ArrowDown: -step,\n    ArrowRight: step,\n    ArrowUp: step,\n  };\n  if (event.key === \"Home\") update({ h: 0 });\n  else if (event.key === \"End\") update({ h: 359 });\n  else if (moves[event.key] !== undefined) update({ h: (hsv.value.h + moves[event.key] + 360) % 360 });\n  else return;\n  event.preventDefault();\n};\n\nconst percent = (value: number) => `${Math.round(value * 100)}%`;\n</script>\n\n<template>\n  <div class=\"pv-color-picker-panel\" data-testid=\"pv-color-picker-panel\">\n    <div\n      class=\"pv-color-picker-area\"\n      :style=\"{ backgroundColor: hueColor }\"\n      @pointerdown=\"startDrag($event, onAreaPointer, saturationSlider)\"\n      @pointermove=\"whileDragging($event, onAreaPointer)\"\n    >\n      <span\n        ref=\"saturationSlider\"\n        class=\"pv-color-picker-thumb pv-color-picker-area-thumb\"\n        role=\"slider\"\n        tabindex=\"0\"\n        aria-label=\"Saturation\"\n        aria-valuemin=\"0\"\n        aria-valuemax=\"100\"\n        :aria-valuenow=\"Math.round(hsv.s * 100)\"\n        :aria-valuetext=\"percent(hsv.s)\"\n        :style=\"{ left: percent(hsv.s), top: percent(1 - hsv.v), backgroundColor: hex }\"\n        @keydown=\"onAreaKeydown($event, 's')\"\n      />\n      <span\n        ref=\"brightnessSlider\"\n        class=\"pv-visually-hidden\"\n        role=\"slider\"\n        tabindex=\"0\"\n        aria-label=\"Brightness\"\n        aria-orientation=\"vertical\"\n        aria-valuemin=\"0\"\n        aria-valuemax=\"100\"\n        :aria-valuenow=\"Math.round(hsv.v * 100)\"\n        :aria-valuetext=\"percent(hsv.v)\"\n        @keydown=\"onAreaKeydown($event, 'v')\"\n      />\n    </div>\n    <div\n      class=\"pv-color-picker-hue\"\n      role=\"slider\"\n      tabindex=\"0\"\n      aria-label=\"Hue\"\n      aria-valuemin=\"0\"\n      aria-valuemax=\"360\"\n      :aria-valuenow=\"Math.round(hsv.h)\"\n      :aria-valuetext=\"`${Math.round(hsv.h)} degrees`\"\n      @pointerdown=\"startDrag($event, onHuePointer)\"\n      @pointermove=\"whileDragging($event, onHuePointer)\"\n      @keydown=\"onHueKeydown\"\n    >\n      <span class=\"pv-color-picker-thumb\" :style=\"{ left: percent(hsv.h / 360), backgroundColor: hueColor }\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport { normalizeHex } from \"@/functions/colorPalette\";\n\n// Saturation/brightness area plus hue slider for picking one color. Private to PvColorPicker.\n\n/** The picked color as `#RRGGBB`. Other values leave the picker on its last color. */\nconst model = defineModel<string>();\n\ninterface Hsv {\n  h: number;\n  s: number;\n  v: number;\n}\n\nconst clamp = (value: number, min = 0, max = 1) => Math.min(max, Math.max(min, value));\n\nconst hexToHsv = (hex: string): Hsv => {\n  const value = parseInt(hex.slice(1), 16);\n  const [r, g, b] = [(value >> 16) & 255, (value >> 8) & 255, value & 255].map((channel) => channel / 255);\n  const max = Math.max(r, g, b);\n  const delta = max - Math.min(r, g, b);\n  let h = 0;\n  if (delta) {\n    if (max === r) h = ((g - b) / delta) % 6;\n    else if (max === g) h = (b - r) / delta + 2;\n    else h = (r - g) / delta + 4;\n  }\n  return { h: (h * 60 + 360) % 360, s: max ? delta / max : 0, v: max };\n};\n\nconst hsvToHex = ({ h, s, v }: Hsv): string => {\n  const channel = (n: number) => {\n    const k = (n + h / 60) % 6;\n    return v - v * s * clamp(Math.min(k, 4 - k));\n  };\n  return (\n    \"#\" +\n    [channel(5), channel(3), channel(1)]\n      .map((value) =>\n        Math.round(value * 255)\n          .toString(16)\n          .padStart(2, \"0\"),\n      )\n      .join(\"\")\n      .toUpperCase()\n  );\n};\n\nconst hsv = ref<Hsv>(hexToHsv(normalizeHex(model.value ?? \"\") ?? \"#36C5BA\"));\nconst hex = computed(() => hsvToHex(hsv.value));\n\n// Follow typed colors, but keep the current hue for grays, where hue is undefined.\nwatch(model, (next) => {\n  const valid = normalizeHex(next ?? \"\");\n  if (!valid || valid === hex.value) return;\n  const parsed = hexToHsv(valid);\n  hsv.value = parsed.s && parsed.v ? parsed : { ...parsed, h: hsv.value.h };\n});\n\nconst update = (next: Partial<Hsv>) => {\n  hsv.value = { ...hsv.value, ...next };\n  model.value = hex.value;\n};\n\nconst hueColor = computed(() => hsvToHex({ h: hsv.value.h, s: 1, v: 1 }));\n\nconst fromPointer = (event: PointerEvent) => {\n  const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n  return {\n    x: clamp((event.clientX - rect.left) / (rect.width || 1)),\n    y: clamp((event.clientY - rect.top) / (rect.height || 1)),\n  };\n};\n\nconst saturationSlider = ref<HTMLElement>();\nconst brightnessSlider = ref<HTMLElement>();\n\nconst startDrag = (event: PointerEvent, apply: (event: PointerEvent) => void, focusTarget?: HTMLElement) => {\n  const target = event.currentTarget as HTMLElement;\n  target.setPointerCapture?.(event.pointerId);\n  (focusTarget ?? target).focus();\n  event.preventDefault();\n  apply(event);\n};\n\nconst onAreaPointer = (event: PointerEvent) => {\n  const { x, y } = fromPointer(event);\n  update({ s: x, v: 1 - y });\n};\nconst onHuePointer = (event: PointerEvent) => {\n  update({ h: fromPointer(event).x * 359.99 });\n};\nconst whileDragging = (event: PointerEvent, apply: (event: PointerEvent) => void) => {\n  if ((event.currentTarget as HTMLElement).hasPointerCapture?.(event.pointerId)) apply(event);\n};\n\nconst STEP = 0.01;\nconst BIG_STEP = 0.1;\n\n// The area is two sliders: saturation (left/right) and brightness (up/down). Arrow keys move the\n// thumb in 2D from either one, focusing the slider for the axis that changed so it is announced.\nconst onAreaKeydown = (event: KeyboardEvent, axis: \"s\" | \"v\") => {\n  const step = event.shiftKey ? BIG_STEP : STEP;\n  const arrows: Record<string, [\"s\" | \"v\", number]> = {\n    ArrowLeft: [\"s\", -step],\n    ArrowRight: [\"s\", step],\n    ArrowDown: [\"v\", -step],\n    ArrowUp: [\"v\", step],\n  };\n  const keys: Record<string, [\"s\" | \"v\", number]> = {\n    ...arrows,\n    PageDown: [axis, -BIG_STEP],\n    PageUp: [axis, BIG_STEP],\n    Home: [axis, -1],\n    End: [axis, 1],\n  };\n  const move = keys[event.key];\n  if (!move) return;\n  event.preventDefault();\n  const [changed, delta] = move;\n  update({ [changed]: clamp(hsv.value[changed] + delta) });\n  if (changed !== axis) (changed === \"s\" ? saturationSlider : brightnessSlider).value?.focus();\n};\n\nconst onHueKeydown = (event: KeyboardEvent) => {\n  const step = event.shiftKey ? 10 : 1;\n  const moves: Record<string, number> = {\n    ArrowLeft: -step,\n    ArrowDown: -step,\n    ArrowRight: step,\n    ArrowUp: step,\n  };\n  if (event.key === \"Home\") update({ h: 0 });\n  else if (event.key === \"End\") update({ h: 359 });\n  else if (moves[event.key] !== undefined) update({ h: (hsv.value.h + moves[event.key] + 360) % 360 });\n  else return;\n  event.preventDefault();\n};\n\nconst percent = (value: number) => `${Math.round(value * 100)}%`;\n</script>\n\n<template>\n  <div class=\"pv-color-picker-panel\" data-testid=\"pv-color-picker-panel\">\n    <div\n      class=\"pv-color-picker-area\"\n      :style=\"{ backgroundColor: hueColor }\"\n      @pointerdown=\"startDrag($event, onAreaPointer, saturationSlider)\"\n      @pointermove=\"whileDragging($event, onAreaPointer)\"\n    >\n      <span\n        ref=\"saturationSlider\"\n        class=\"pv-color-picker-thumb pv-color-picker-area-thumb\"\n        role=\"slider\"\n        tabindex=\"0\"\n        aria-label=\"Saturation\"\n        aria-valuemin=\"0\"\n        aria-valuemax=\"100\"\n        :aria-valuenow=\"Math.round(hsv.s * 100)\"\n        :aria-valuetext=\"percent(hsv.s)\"\n        :style=\"{ left: percent(hsv.s), top: percent(1 - hsv.v), backgroundColor: hex }\"\n        @keydown=\"onAreaKeydown($event, 's')\"\n      />\n      <span\n        ref=\"brightnessSlider\"\n        class=\"pv-visually-hidden\"\n        role=\"slider\"\n        tabindex=\"0\"\n        aria-label=\"Brightness\"\n        aria-orientation=\"vertical\"\n        aria-valuemin=\"0\"\n        aria-valuemax=\"100\"\n        :aria-valuenow=\"Math.round(hsv.v * 100)\"\n        :aria-valuetext=\"percent(hsv.v)\"\n        @keydown=\"onAreaKeydown($event, 'v')\"\n      />\n    </div>\n    <div\n      class=\"pv-color-picker-hue\"\n      role=\"slider\"\n      tabindex=\"0\"\n      aria-label=\"Hue\"\n      aria-valuemin=\"0\"\n      aria-valuemax=\"360\"\n      :aria-valuenow=\"Math.round(hsv.h)\"\n      :aria-valuetext=\"`${Math.round(hsv.h)} degrees`\"\n      @pointerdown=\"startDrag($event, onHuePointer)\"\n      @pointermove=\"whileDragging($event, onHuePointer)\"\n      @keydown=\"onHueKeydown\"\n    >\n      <span class=\"pv-color-picker-thumb\" :style=\"{ left: percent(hsv.h / 360), backgroundColor: hueColor }\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, ref } from \"vue\";\nimport PvInput from \"@/components/base/PvInput/PvInput.vue\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvColorPickerPanel from \"./PvColorPickerPanel.vue\";\nimport { normalizeHex } from \"@/functions/colorPalette\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\nimport type { PvColorPickerProps } from \"./types\";\n\n// A swatch plus a hex input. Focusing the input opens a saturation/brightness and hue picker.\n// Attributes (e.g. `aria-describedby` pointing at validation text) go to the input.\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<PvColorPickerProps>(), {\n  placeholder: \"Enter color\",\n  position: \"bottom-left\",\n  offset: 4,\n});\n\n/**\n * The color text. The picker writes `#RRGGBB`; typed text is kept as typed, so check it with\n * `normalizeHex` before use.\n */\nconst model = defineModel<string>({ default: \"\" });\n\n// As a web component, `warning` content is light DOM children of the host, which `useSlots()`\n// cannot see. The outlet stays mounted so that content can be projected and slotchange heard.\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot, hasNativeSlot } = useSlotPresence(\"warning\", { host: customElementHost });\nconst hasWarning = computed(() => (customElementHost ? hasNativeSlot.value : hasVueSlot.value));\n\nconst hex = computed(() => normalizeHex(model.value ?? \"\"));\nconst invalid = computed(() => (model.value ?? \"\").trim() !== \"\" && !hex.value);\n\nconst open = ref(false);\nconst setOpen = (next: boolean | undefined) => {\n  open.value = !!next && !props.disabled;\n};\n\n// Stay open while focus moves between the input and the panel.\nconst closeOnFocusLeave = (event: FocusEvent) => {\n  const root = event.currentTarget as HTMLElement;\n  if (!root.contains(event.relatedTarget as Node | null)) setOpen(false);\n};\n</script>\n\n<template>\n  <div class=\"pv-color-picker\" data-testid=\"pv-color-picker\">\n    <span\n      class=\"pv-color-picker-swatch\"\n      aria-hidden=\"true\"\n      data-testid=\"pv-color-picker-swatch\"\n      :data-color=\"hex ?? undefined\"\n      :style=\"{ backgroundColor: hex ?? undefined }\"\n    />\n    <PvPopoverV2\n      :modelValue=\"open\"\n      :position=\"position\"\n      :offset=\"offset\"\n      :disabled=\"disabled\"\n      :disableClickOutsideToClose=\"true\"\n      @update:modelValue=\"setOpen\"\n      @focusout=\"closeOnFocusLeave\"\n      @keydown.esc=\"setOpen(false)\"\n    >\n      <template #trigger>\n        <div class=\"pv-color-picker-input\" :data-warning=\"hasWarning ? true : undefined\" @click.stop=\"setOpen(true)\">\n          <PvInput\n            v-bind=\"$attrs\"\n            v-model=\"model\"\n            :placeholder=\"placeholder\"\n            :disabled=\"disabled\"\n            :error=\"error || invalid\"\n            :aria-label=\"ariaLabel\"\n            :aria-invalid=\"error || invalid ? 'true' : undefined\"\n            @focus=\"setOpen(true)\"\n          />\n          <span v-show=\"hasWarning\" class=\"pv-color-picker-warning\">\n            <slot name=\"warning\" />\n          </span>\n        </div>\n      </template>\n      <template #content>\n        <div class=\"pv-popover\" style=\"position: unset; --width: auto; --height: none\">\n          <PvColorPickerPanel :modelValue=\"hex ?? ''\" @update:modelValue=\"model = $event ?? ''\" />\n        </div>\n      </template>\n    </PvPopoverV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, ref } from \"vue\";\nimport PvInput from \"@/components/base/PvInput/PvInput.vue\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvColorPickerPanel from \"./PvColorPickerPanel.vue\";\nimport { normalizeHex } from \"@/functions/colorPalette\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\nimport type { PvColorPickerProps } from \"./types\";\n\n// A swatch plus a hex input. Focusing the input opens a saturation/brightness and hue picker.\n// Attributes (e.g. `aria-describedby` pointing at validation text) go to the input.\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<PvColorPickerProps>(), {\n  placeholder: \"Enter color\",\n  position: \"bottom-left\",\n  offset: 4,\n});\n\n/**\n * The color text. The picker writes `#RRGGBB`; typed text is kept as typed, so check it with\n * `normalizeHex` before use.\n */\nconst model = defineModel<string>({ default: \"\" });\n\n// As a web component, `warning` content is light DOM children of the host, which `useSlots()`\n// cannot see. The outlet stays mounted so that content can be projected and slotchange heard.\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { hasVueSlot, hasNativeSlot } = useSlotPresence(\"warning\", { host: customElementHost });\nconst hasWarning = computed(() => (customElementHost ? hasNativeSlot.value : hasVueSlot.value));\n\nconst hex = computed(() => normalizeHex(model.value ?? \"\"));\nconst invalid = computed(() => (model.value ?? \"\").trim() !== \"\" && !hex.value);\n\nconst open = ref(false);\nconst setOpen = (next: boolean | undefined) => {\n  open.value = !!next && !props.disabled;\n};\n\n// Stay open while focus moves between the input and the panel.\nconst closeOnFocusLeave = (event: FocusEvent) => {\n  const root = event.currentTarget as HTMLElement;\n  if (!root.contains(event.relatedTarget as Node | null)) setOpen(false);\n};\n</script>\n\n<template>\n  <div class=\"pv-color-picker\" data-testid=\"pv-color-picker\">\n    <span\n      class=\"pv-color-picker-swatch\"\n      aria-hidden=\"true\"\n      data-testid=\"pv-color-picker-swatch\"\n      :data-color=\"hex ?? undefined\"\n      :style=\"{ backgroundColor: hex ?? undefined }\"\n    />\n    <PvPopoverV2\n      :modelValue=\"open\"\n      :position=\"position\"\n      :offset=\"offset\"\n      :disabled=\"disabled\"\n      :disableClickOutsideToClose=\"true\"\n      @update:modelValue=\"setOpen\"\n      @focusout=\"closeOnFocusLeave\"\n      @keydown.esc=\"setOpen(false)\"\n    >\n      <template #trigger>\n        <div class=\"pv-color-picker-input\" :data-warning=\"hasWarning ? true : undefined\" @click.stop=\"setOpen(true)\">\n          <PvInput\n            v-bind=\"$attrs\"\n            v-model=\"model\"\n            :placeholder=\"placeholder\"\n            :disabled=\"disabled\"\n            :error=\"error || invalid\"\n            :aria-label=\"ariaLabel\"\n            :aria-invalid=\"error || invalid ? 'true' : undefined\"\n            @focus=\"setOpen(true)\"\n          />\n          <span v-show=\"hasWarning\" class=\"pv-color-picker-warning\">\n            <slot name=\"warning\" />\n          </span>\n        </div>\n      </template>\n      <template #content>\n        <div class=\"pv-popover\" style=\"position: unset; --width: auto; --height: none\">\n          <PvColorPickerPanel :modelValue=\"hex ?? ''\" @update:modelValue=\"model = $event ?? ''\" />\n        </div>\n      </template>\n    </PvPopoverV2>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties, useTemplateRef, onMounted, onUnmounted } from \"vue\";\nimport Sortable from \"sortablejs\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { MenuOption } from \"@/types\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { LockedOption } from \"./types\";\n\nconst DIVIDER_ID = \"--divider--\";\nconst PLACEHOLDER_ID = \"placeholder-\";\n\nexport type PvSortableMenuListProps = {\n  /** The full set of available options to choose from and reorder. */\n  options: MenuOption[];\n  /** Maximum number of options that can be active (above the divider) at once. */\n  activeOptionLimit?: number;\n  /**\n   * Text displayed inside empty placeholder drop zones.\n   */\n  placeholderText?: string;\n  /**\n   * Whether to render placeholder drop zones for unfilled active slots.\n   */\n  showPlaceholders?: boolean;\n  /**\n   * Options that cannot be removed or reordered: they render with a lock icon and grayed\n   * text, stay pinned at the top of the active list, and every mutation (click, drag,\n   * placeholder drop) re-asserts them. Ids must refer to options that are already active.\n   * An entry's optional `tooltip` explains WHY it is locked, rendered as an info icon\n   * (e.g. \"Select a single drug to unlock\").\n   */\n  lockedOptions?: LockedOption[];\n};\n\nconst props = withDefaults(defineProps<PvSortableMenuListProps>(), {\n  options: () => [],\n  placeholderText: \"Add option\",\n  showPlaceholders: true,\n  lockedOptions: () => [],\n});\n\nconst activeOptions = defineModel<MenuOption[]>({\n  required: false,\n  default: () => [],\n});\n\nconst isOptionLocked = (option: MenuOption) => props.lockedOptions.some((locked) => locked.id === option.id);\nconst lockedOptionTooltip = (option: MenuOption) =>\n  props.lockedOptions.find((locked) => locked.id === option.id)?.tooltip;\n\n// Re-assert the locked invariant on a proposed active list: every currently-active locked\n// option survives the mutation and sits first (in its existing relative order), then the\n// proposal's other options, capped at the limit. Locked options sit first, so the cap can\n// never slice them away.\nconst withLockedOptions = (proposed: MenuOption[]): MenuOption[] => {\n  if (props.lockedOptions.length === 0) {\n    return proposed;\n  }\n  const lockedActive = activeOptions.value.filter(isOptionLocked);\n  const rest = proposed.filter((option) => !isOptionLocked(option));\n  return [...lockedActive, ...rest].slice(0, props.activeOptionLimit || Infinity);\n};\n\nconst dividingLineOption: MenuOption = {\n  id: DIVIDER_ID,\n  text: \"\",\n  disabled: true,\n};\n\nconst placeholderCount = computed(() => {\n  return props.activeOptionLimit ? Math.max(0, props.activeOptionLimit - activeOptions.value.length) : 0;\n});\n\nconst placeholderOptions = computed(() => {\n  if (!props.showPlaceholders || placeholderCount.value === 0) return [];\n  return Array.from({ length: placeholderCount.value }, (_, index) => ({\n    id: `${PLACEHOLDER_ID}${index}`,\n    text: \"\",\n    disabled: true,\n    isPlaceholder: true,\n  }));\n});\n\nconst optionDisplayOrder = computed(() => {\n  // prioritize active options first, then placeholders, then divider, then the rest\n  const activeOptionIds = new Set(activeOptions.value.map((opt) => opt.id));\n  return [\n    ...activeOptions.value,\n    ...placeholderOptions.value,\n    dividingLineOption,\n    ...props.options.filter((option) => !activeOptionIds.has(option.id)),\n  ] as MenuOption[];\n});\n\nconst sortableListRef = useTemplateRef<HTMLElement>(\"sortableListRef\");\nconst containerRef = useTemplateRef<HTMLElement>(\"containerRef\");\n\nlet sortableInstance: Sortable | null = null;\nlet currentDraggedElement: HTMLElement | null = null;\nlet placeholderDropHandled = false;\n\nconst readActiveOptionsFromDOM = (): MenuOption[] => {\n  if (!sortableListRef.value) return activeOptions.value;\n\n  let newIds = Array.from(sortableListRef.value.children).map((child) => (child as HTMLElement).id);\n  // get all the options above the dividing line\n  const dividerIndex = newIds.findIndex((id) => id === DIVIDER_ID);\n  if (dividerIndex !== -1) {\n    newIds = newIds.slice(0, dividerIndex);\n  }\n  // filter out placeholder items\n  newIds = newIds.filter((id) => !id.startsWith(PLACEHOLDER_ID));\n\n  const newOptionOrder = newIds\n    .map((id) => {\n      return props.options.find((item) => item.id === id) || null;\n    })\n    .filter(Boolean) as MenuOption[];\n  // slice based on activeOptionLimit\n  return newOptionOrder.slice(0, props.activeOptionLimit || Infinity);\n};\n\nonMounted(() => {\n  if (sortableListRef.value) {\n    sortableInstance = new Sortable(sortableListRef.value, {\n      animation: 200,\n      filter: `#${DIVIDER_ID}, [id^=\"placeholder-\"], .pv-sortable-locked`,\n      dragoverBubble: true,\n      onStart: (evt) => {\n        currentDraggedElement = evt.item;\n        placeholderDropHandled = false;\n      },\n      onMove: (evt) => {\n        const relatedElement = evt.related;\n        // Placeholder zones handle their own native dragover/drop events\n        if (relatedElement?.id?.startsWith(PLACEHOLDER_ID)) {\n          return false;\n        }\n        const fromOption = props.options.find((opt) => opt.id === evt.dragged.id);\n        if (!fromOption) {\n          return false;\n        }\n        // Nothing may displace a locked option's pinned slot.\n        const relatedLocked = props.options.find((opt) => opt.id === relatedElement?.id && isOptionLocked(opt));\n        if (relatedLocked) {\n          return false;\n        }\n        // Active options move freely: reorder within the active zone or cross the\n        // divider into the inactive zone. The divider is a valid swap target so\n        // items can cross it even when the zone on the other side is empty.\n        if (isOptionActive(fromOption)) {\n          return true;\n        }\n        // Inactive options may only move toward the active zone, and only when\n        // there is room under the active limit\n        if (activeLimitReached.value) {\n          return false;\n        }\n        if (relatedElement?.id === DIVIDER_ID) {\n          return true;\n        }\n        const relatedOption = props.options.find((opt) => opt.id === relatedElement?.id);\n        return !!relatedOption && isOptionActive(relatedOption);\n      },\n      onEnd: (evt) => {\n        currentDraggedElement = null;\n        // A drop on a placeholder zone was already committed by handlePlaceholderDrop\n        if (placeholderDropHandled) {\n          placeholderDropHandled = false;\n          return;\n        }\n        const list = sortableListRef.value;\n        if (!list || !evt.item || !list.contains(evt.item)) return;\n\n        const newActiveOptions = withLockedOptions(readActiveOptionsFromDOM());\n\n        // Put the dragged element back where the last render left it, so the real\n        // DOM matches Vue's virtual DOM before the commit triggers a re-render.\n        // Otherwise Vue's keyed diff moves nodes based on stale positions and can\n        // strand items on the wrong side of the divider.\n        list.removeChild(evt.item);\n        list.insertBefore(evt.item, list.children[evt.oldIndex ?? list.children.length] ?? null);\n\n        const currentIds = activeOptions.value.map((opt) => opt.id);\n        const unchanged =\n          newActiveOptions.length === currentIds.length &&\n          newActiveOptions.every((opt, index) => opt.id === currentIds[index]);\n        if (!unchanged) {\n          activeOptions.value = newActiveOptions;\n        }\n      },\n    });\n  }\n});\n\nonUnmounted(() => {\n  if (sortableInstance) {\n    sortableInstance.destroy();\n    sortableInstance = null;\n  }\n});\n\n// Handle dragover events on placeholder zones\nconst handlePlaceholderDragOver = (evt: DragEvent) => {\n  evt.preventDefault();\n  if (currentDraggedElement) {\n    const placeholderZone = evt.currentTarget as HTMLElement;\n    placeholderZone.classList.add(\"pv-sortable-list-placeholder-drag-over\");\n  }\n};\n\nconst handlePlaceholderDragLeave = (evt: DragEvent) => {\n  const placeholderZone = evt.currentTarget as HTMLElement;\n  placeholderZone.classList.remove(\"pv-sortable-list-placeholder-drag-over\");\n};\n\nconst handlePlaceholderDrop = (evt: DragEvent, index: number) => {\n  evt.preventDefault();\n  const placeholderZone = evt.currentTarget as HTMLElement;\n  placeholderZone.classList.remove(\"pv-sortable-list-placeholder-drag-over\");\n\n  if (currentDraggedElement) {\n    const draggedId = currentDraggedElement.id;\n    const draggedOption = props.options.find((opt) => opt.id === draggedId);\n\n    if (draggedOption && !isOptionActive(draggedOption)) {\n      // Add this option to active options at the specified index\n      const newActiveOptions = [...activeOptions.value];\n      newActiveOptions.splice(index - 1, 0, draggedOption);\n      activeOptions.value = withLockedOptions(newActiveOptions);\n\n      // Remove the element from its current position in the DOM\n      if (currentDraggedElement.parentNode) {\n        currentDraggedElement.parentNode.removeChild(currentDraggedElement);\n      }\n      // Tell onEnd this drop is already committed\n      placeholderDropHandled = true;\n    }\n  }\n};\n\nconst isOptionActive = (option: MenuOption) => {\n  return activeOptions.value.some((activeOption) => activeOption.id === option.id);\n};\n\nconst activeLimitReached = computed(() => {\n  return props.activeOptionLimit ? activeOptions.value.length >= props.activeOptionLimit : false;\n});\n\nconst handleOptionClick = (option: MenuOption) => {\n  if (isOptionLocked(option)) {\n    return;\n  }\n  if (isOptionActive(option)) {\n    // remove option\n    activeOptions.value = activeOptions.value.filter((activeOption) => activeOption.id !== option.id);\n  } else {\n    // only add if we're below activeOptionLimit\n    if (props.activeOptionLimit && activeOptions.value.length >= props.activeOptionLimit) {\n      return;\n    }\n    activeOptions.value = activeOptions.value.concat([option]);\n  }\n};\n\nconst optionDisabled = (option: MenuOption) => {\n  // disable if the option is already active and we reached the limit\n  return (\n    (!isOptionActive(option) && props.activeOptionLimit && activeOptions.value.length >= props.activeOptionLimit) ||\n    option.disabled\n  );\n};\n\nconst sortableListOptionStyles = (option: MenuOption) => {\n  const styles: CSSProperties = {\n    padding: \"4px 8px\",\n  };\n  if (isOptionActive(option)) {\n    if (isOptionLocked(option)) {\n      // Locked entries stay active but read as fixed: neutral pill with the default border\n      // instead of the brand highlight.\n      styles.backgroundColor = \"var(--color-background-accent, #f7f8f8)\";\n    } else {\n      styles.backgroundColor = \"var(--color-background-highlight, #E4F8F6)\";\n      styles.borderColor = \"var(--color-border-brand, #16696D)\";\n    }\n  }\n  return styles;\n};\n\nconst sortableListButtonStyles = (option: MenuOption) => {\n  const styles: CSSProperties = {};\n\n  if (optionDisabled(option)) {\n    styles.backgroundColor = \"transparent\";\n  }\n  return styles;\n};\n\nconst sortableListButtonClasses = (option: MenuOption) => {\n  if (!isOptionActive(option) && !optionDisabled(option)) {\n    return \"pv-text-tertiary\";\n  } else {\n    return \"pv-text-brand\";\n  }\n};\n</script>\n\n<template>\n  <div ref=\"containerRef\">\n    <!-- Main sortable list -->\n    <ul ref=\"sortableListRef\" role=\"list\">\n      <li v-for=\"option in optionDisplayOrder\" :key=\"option.id\" :id=\"option.id\" class=\"pv-stack-4\">\n        <div v-if=\"option.id === DIVIDER_ID\" class=\"pv-sortable-list-divider-container\">\n          <div\n            class=\"pv-sortable-list-divider pv-text-default pv-text-body-xs pv-text-tertiary\"\n            :data-label=\"activeLimitReached ? `Maximum of ${props.activeOptionLimit}` : ''\"\n          ></div>\n        </div>\n        <div\n          v-else-if=\"option.id.includes(PLACEHOLDER_ID)\"\n          class=\"pv-sortable-list-placeholder-zone\"\n          @dragover=\"handlePlaceholderDragOver($event)\"\n          @dragleave=\"handlePlaceholderDragLeave($event)\"\n          @drop=\"handlePlaceholderDrop($event, parseInt(option.id.split('-')[1]) + 1)\"\n        >\n          <div\n            class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-sortable-list-placeholder-dropzone\"\n            style=\"--flex-justify: center\"\n          >\n            <span class=\"pv-text-body-sm pv-text-tertiary\">{{ props.placeholderText }}</span>\n          </div>\n        </div>\n        <div\n          v-else\n          class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-space-between\"\n          :class=\"[\n            !isOptionActive(option) && activeLimitReached ? 'pv-sortable-list-option-disabled' : '',\n            isOptionLocked(option) ? 'pv-sortable-locked' : '',\n          ]\"\n          :style=\"sortableListOptionStyles(option)\"\n        >\n          <div\n            class=\"pv-flex pv-full-width pv-sortable-list-option\"\n            :class=\"{ 'pv-sortable-list-option-locked': isOptionLocked(option) }\"\n          >\n            <!-- Locked entries gray their icons and text so they read as immovable at a\n                 glance; unlocked active entries keep the brand color. -->\n            <PvIcon class=\"pv-text-tertiary\" :name=\"isOptionLocked(option) ? 'lock' : 'reorder'\" />\n            <PvIcon v-if=\"option.icon\" class=\"pv-text-tertiary\" :name=\"option.icon\" />\n            <span class=\"pv-text-body-sm\" :class=\"{ 'pv-text-tertiary': isOptionLocked(option) }\">\n              {{ option.text }}\n            </span>\n            <!-- Teleported so the tooltip escapes the picker's scroll container; dark variant\n                 matches the panel's other info tips. -->\n            <PvTooltipV2\n              v-if=\"isOptionLocked(option) && lockedOptionTooltip(option)\"\n              variant=\"dark\"\n              size=\"sm\"\n              :useTeleport=\"true\"\n              :disableInteractive=\"true\"\n            >\n              <template #trigger>\n                <PvIcon class=\"pv-text-tertiary\" name=\"info-circle\" />\n              </template>\n              <template #content>\n                <div style=\"max-width: 220px\">{{ lockedOptionTooltip(option) }}</div>\n              </template>\n            </PvTooltipV2>\n          </div>\n          <PvButton\n            v-if=\"!optionDisabled(option) && !isOptionLocked(option)\"\n            :left-icon=\"isOptionActive(option) ? 'remove-circle' : 'add-circle'\"\n            :ariaLabel=\"isOptionActive(option) ? `Remove ${option.text}` : `Add ${option.text}`\"\n            variant=\"ghost\"\n            :style=\"sortableListButtonStyles(option)\"\n            :class=\"sortableListButtonClasses(option)\"\n            @click=\"handleOptionClick(option)\"\n          ></PvButton>\n          <div v-else class=\"pv-sortable-list-button-placeholder\"></div>\n        </div>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, CSSProperties, useTemplateRef, onMounted, onUnmounted } from \"vue\";\nimport Sortable from \"sortablejs\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { MenuOption } from \"@/types\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { LockedOption } from \"./types\";\n\nconst DIVIDER_ID = \"--divider--\";\nconst PLACEHOLDER_ID = \"placeholder-\";\n\nexport type PvSortableMenuListProps = {\n  /** The full set of available options to choose from and reorder. */\n  options: MenuOption[];\n  /** Maximum number of options that can be active (above the divider) at once. */\n  activeOptionLimit?: number;\n  /**\n   * Text displayed inside empty placeholder drop zones.\n   */\n  placeholderText?: string;\n  /**\n   * Whether to render placeholder drop zones for unfilled active slots.\n   */\n  showPlaceholders?: boolean;\n  /**\n   * Options that cannot be removed or reordered: they render with a lock icon and grayed\n   * text, stay pinned at the top of the active list, and every mutation (click, drag,\n   * placeholder drop) re-asserts them. Ids must refer to options that are already active.\n   * An entry's optional `tooltip` explains WHY it is locked, rendered as an info icon\n   * (e.g. \"Select a single drug to unlock\").\n   */\n  lockedOptions?: LockedOption[];\n};\n\nconst props = withDefaults(defineProps<PvSortableMenuListProps>(), {\n  options: () => [],\n  placeholderText: \"Add option\",\n  showPlaceholders: true,\n  lockedOptions: () => [],\n});\n\nconst activeOptions = defineModel<MenuOption[]>({\n  required: false,\n  default: () => [],\n});\n\nconst isOptionLocked = (option: MenuOption) => props.lockedOptions.some((locked) => locked.id === option.id);\nconst lockedOptionTooltip = (option: MenuOption) =>\n  props.lockedOptions.find((locked) => locked.id === option.id)?.tooltip;\n\n// Re-assert the locked invariant on a proposed active list: every currently-active locked\n// option survives the mutation and sits first (in its existing relative order), then the\n// proposal's other options, capped at the limit. Locked options sit first, so the cap can\n// never slice them away.\nconst withLockedOptions = (proposed: MenuOption[]): MenuOption[] => {\n  if (props.lockedOptions.length === 0) {\n    return proposed;\n  }\n  const lockedActive = activeOptions.value.filter(isOptionLocked);\n  const rest = proposed.filter((option) => !isOptionLocked(option));\n  return [...lockedActive, ...rest].slice(0, props.activeOptionLimit || Infinity);\n};\n\nconst dividingLineOption: MenuOption = {\n  id: DIVIDER_ID,\n  text: \"\",\n  disabled: true,\n};\n\nconst placeholderCount = computed(() => {\n  return props.activeOptionLimit ? Math.max(0, props.activeOptionLimit - activeOptions.value.length) : 0;\n});\n\nconst placeholderOptions = computed(() => {\n  if (!props.showPlaceholders || placeholderCount.value === 0) return [];\n  return Array.from({ length: placeholderCount.value }, (_, index) => ({\n    id: `${PLACEHOLDER_ID}${index}`,\n    text: \"\",\n    disabled: true,\n    isPlaceholder: true,\n  }));\n});\n\nconst optionDisplayOrder = computed(() => {\n  // prioritize active options first, then placeholders, then divider, then the rest\n  const activeOptionIds = new Set(activeOptions.value.map((opt) => opt.id));\n  return [\n    ...activeOptions.value,\n    ...placeholderOptions.value,\n    dividingLineOption,\n    ...props.options.filter((option) => !activeOptionIds.has(option.id)),\n  ] as MenuOption[];\n});\n\nconst sortableListRef = useTemplateRef<HTMLElement>(\"sortableListRef\");\nconst containerRef = useTemplateRef<HTMLElement>(\"containerRef\");\n\nlet sortableInstance: Sortable | null = null;\nlet currentDraggedElement: HTMLElement | null = null;\nlet placeholderDropHandled = false;\n\nconst readActiveOptionsFromDOM = (): MenuOption[] => {\n  if (!sortableListRef.value) return activeOptions.value;\n\n  let newIds = Array.from(sortableListRef.value.children).map((child) => (child as HTMLElement).id);\n  // get all the options above the dividing line\n  const dividerIndex = newIds.findIndex((id) => id === DIVIDER_ID);\n  if (dividerIndex !== -1) {\n    newIds = newIds.slice(0, dividerIndex);\n  }\n  // filter out placeholder items\n  newIds = newIds.filter((id) => !id.startsWith(PLACEHOLDER_ID));\n\n  const newOptionOrder = newIds\n    .map((id) => {\n      return props.options.find((item) => item.id === id) || null;\n    })\n    .filter(Boolean) as MenuOption[];\n  // slice based on activeOptionLimit\n  return newOptionOrder.slice(0, props.activeOptionLimit || Infinity);\n};\n\nonMounted(() => {\n  if (sortableListRef.value) {\n    sortableInstance = new Sortable(sortableListRef.value, {\n      animation: 200,\n      filter: `#${DIVIDER_ID}, [id^=\"placeholder-\"], .pv-sortable-locked`,\n      dragoverBubble: true,\n      onStart: (evt) => {\n        currentDraggedElement = evt.item;\n        placeholderDropHandled = false;\n      },\n      onMove: (evt) => {\n        const relatedElement = evt.related;\n        // Placeholder zones handle their own native dragover/drop events\n        if (relatedElement?.id?.startsWith(PLACEHOLDER_ID)) {\n          return false;\n        }\n        const fromOption = props.options.find((opt) => opt.id === evt.dragged.id);\n        if (!fromOption) {\n          return false;\n        }\n        // Nothing may displace a locked option's pinned slot.\n        const relatedLocked = props.options.find((opt) => opt.id === relatedElement?.id && isOptionLocked(opt));\n        if (relatedLocked) {\n          return false;\n        }\n        // Active options move freely: reorder within the active zone or cross the\n        // divider into the inactive zone. The divider is a valid swap target so\n        // items can cross it even when the zone on the other side is empty.\n        if (isOptionActive(fromOption)) {\n          return true;\n        }\n        // Inactive options may only move toward the active zone, and only when\n        // there is room under the active limit\n        if (activeLimitReached.value) {\n          return false;\n        }\n        if (relatedElement?.id === DIVIDER_ID) {\n          return true;\n        }\n        const relatedOption = props.options.find((opt) => opt.id === relatedElement?.id);\n        return !!relatedOption && isOptionActive(relatedOption);\n      },\n      onEnd: (evt) => {\n        currentDraggedElement = null;\n        // A drop on a placeholder zone was already committed by handlePlaceholderDrop\n        if (placeholderDropHandled) {\n          placeholderDropHandled = false;\n          return;\n        }\n        const list = sortableListRef.value;\n        if (!list || !evt.item || !list.contains(evt.item)) return;\n\n        const newActiveOptions = withLockedOptions(readActiveOptionsFromDOM());\n\n        // Put the dragged element back where the last render left it, so the real\n        // DOM matches Vue's virtual DOM before the commit triggers a re-render.\n        // Otherwise Vue's keyed diff moves nodes based on stale positions and can\n        // strand items on the wrong side of the divider.\n        list.removeChild(evt.item);\n        list.insertBefore(evt.item, list.children[evt.oldIndex ?? list.children.length] ?? null);\n\n        const currentIds = activeOptions.value.map((opt) => opt.id);\n        const unchanged =\n          newActiveOptions.length === currentIds.length &&\n          newActiveOptions.every((opt, index) => opt.id === currentIds[index]);\n        if (!unchanged) {\n          activeOptions.value = newActiveOptions;\n        }\n      },\n    });\n  }\n});\n\nonUnmounted(() => {\n  if (sortableInstance) {\n    sortableInstance.destroy();\n    sortableInstance = null;\n  }\n});\n\n// Handle dragover events on placeholder zones\nconst handlePlaceholderDragOver = (evt: DragEvent) => {\n  evt.preventDefault();\n  if (currentDraggedElement) {\n    const placeholderZone = evt.currentTarget as HTMLElement;\n    placeholderZone.classList.add(\"pv-sortable-list-placeholder-drag-over\");\n  }\n};\n\nconst handlePlaceholderDragLeave = (evt: DragEvent) => {\n  const placeholderZone = evt.currentTarget as HTMLElement;\n  placeholderZone.classList.remove(\"pv-sortable-list-placeholder-drag-over\");\n};\n\nconst handlePlaceholderDrop = (evt: DragEvent, index: number) => {\n  evt.preventDefault();\n  const placeholderZone = evt.currentTarget as HTMLElement;\n  placeholderZone.classList.remove(\"pv-sortable-list-placeholder-drag-over\");\n\n  if (currentDraggedElement) {\n    const draggedId = currentDraggedElement.id;\n    const draggedOption = props.options.find((opt) => opt.id === draggedId);\n\n    if (draggedOption && !isOptionActive(draggedOption)) {\n      // Add this option to active options at the specified index\n      const newActiveOptions = [...activeOptions.value];\n      newActiveOptions.splice(index - 1, 0, draggedOption);\n      activeOptions.value = withLockedOptions(newActiveOptions);\n\n      // Remove the element from its current position in the DOM\n      if (currentDraggedElement.parentNode) {\n        currentDraggedElement.parentNode.removeChild(currentDraggedElement);\n      }\n      // Tell onEnd this drop is already committed\n      placeholderDropHandled = true;\n    }\n  }\n};\n\nconst isOptionActive = (option: MenuOption) => {\n  return activeOptions.value.some((activeOption) => activeOption.id === option.id);\n};\n\nconst activeLimitReached = computed(() => {\n  return props.activeOptionLimit ? activeOptions.value.length >= props.activeOptionLimit : false;\n});\n\nconst handleOptionClick = (option: MenuOption) => {\n  if (isOptionLocked(option)) {\n    return;\n  }\n  if (isOptionActive(option)) {\n    // remove option\n    activeOptions.value = activeOptions.value.filter((activeOption) => activeOption.id !== option.id);\n  } else {\n    // only add if we're below activeOptionLimit\n    if (props.activeOptionLimit && activeOptions.value.length >= props.activeOptionLimit) {\n      return;\n    }\n    activeOptions.value = activeOptions.value.concat([option]);\n  }\n};\n\nconst optionDisabled = (option: MenuOption) => {\n  // disable if the option is already active and we reached the limit\n  return (\n    (!isOptionActive(option) && props.activeOptionLimit && activeOptions.value.length >= props.activeOptionLimit) ||\n    option.disabled\n  );\n};\n\nconst sortableListOptionStyles = (option: MenuOption) => {\n  const styles: CSSProperties = {\n    padding: \"4px 8px\",\n  };\n  if (isOptionActive(option)) {\n    if (isOptionLocked(option)) {\n      // Locked entries stay active but read as fixed: neutral pill with the default border\n      // instead of the brand highlight.\n      styles.backgroundColor = \"var(--color-background-accent, #f7f8f8)\";\n    } else {\n      styles.backgroundColor = \"var(--color-background-highlight, #E4F8F6)\";\n      styles.borderColor = \"var(--color-border-brand, #16696D)\";\n    }\n  }\n  return styles;\n};\n\nconst sortableListButtonStyles = (option: MenuOption) => {\n  const styles: CSSProperties = {};\n\n  if (optionDisabled(option)) {\n    styles.backgroundColor = \"transparent\";\n  }\n  return styles;\n};\n\nconst sortableListButtonClasses = (option: MenuOption) => {\n  if (!isOptionActive(option) && !optionDisabled(option)) {\n    return \"pv-text-tertiary\";\n  } else {\n    return \"pv-text-brand\";\n  }\n};\n</script>\n\n<template>\n  <div ref=\"containerRef\">\n    <!-- Main sortable list -->\n    <ul ref=\"sortableListRef\" role=\"list\">\n      <li v-for=\"option in optionDisplayOrder\" :key=\"option.id\" :id=\"option.id\" class=\"pv-stack-4\">\n        <div v-if=\"option.id === DIVIDER_ID\" class=\"pv-sortable-list-divider-container\">\n          <div\n            class=\"pv-sortable-list-divider pv-text-default pv-text-body-xs pv-text-tertiary\"\n            :data-label=\"activeLimitReached ? `Maximum of ${props.activeOptionLimit}` : ''\"\n          ></div>\n        </div>\n        <div\n          v-else-if=\"option.id.includes(PLACEHOLDER_ID)\"\n          class=\"pv-sortable-list-placeholder-zone\"\n          @dragover=\"handlePlaceholderDragOver($event)\"\n          @dragleave=\"handlePlaceholderDragLeave($event)\"\n          @drop=\"handlePlaceholderDrop($event, parseInt(option.id.split('-')[1]) + 1)\"\n        >\n          <div\n            class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-sortable-list-placeholder-dropzone\"\n            style=\"--flex-justify: center\"\n          >\n            <span class=\"pv-text-body-sm pv-text-tertiary\">{{ props.placeholderText }}</span>\n          </div>\n        </div>\n        <div\n          v-else\n          class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-space-between\"\n          :class=\"[\n            !isOptionActive(option) && activeLimitReached ? 'pv-sortable-list-option-disabled' : '',\n            isOptionLocked(option) ? 'pv-sortable-locked' : '',\n          ]\"\n          :style=\"sortableListOptionStyles(option)\"\n        >\n          <div\n            class=\"pv-flex pv-full-width pv-sortable-list-option\"\n            :class=\"{ 'pv-sortable-list-option-locked': isOptionLocked(option) }\"\n          >\n            <!-- Locked entries gray their icons and text so they read as immovable at a\n                 glance; unlocked active entries keep the brand color. -->\n            <PvIcon class=\"pv-text-tertiary\" :name=\"isOptionLocked(option) ? 'lock' : 'reorder'\" />\n            <PvIcon v-if=\"option.icon\" class=\"pv-text-tertiary\" :name=\"option.icon\" />\n            <span class=\"pv-text-body-sm\" :class=\"{ 'pv-text-tertiary': isOptionLocked(option) }\">\n              {{ option.text }}\n            </span>\n            <!-- Teleported so the tooltip escapes the picker's scroll container; dark variant\n                 matches the panel's other info tips. -->\n            <PvTooltipV2\n              v-if=\"isOptionLocked(option) && lockedOptionTooltip(option)\"\n              variant=\"dark\"\n              size=\"sm\"\n              :useTeleport=\"true\"\n              :disableInteractive=\"true\"\n            >\n              <template #trigger>\n                <PvIcon class=\"pv-text-tertiary\" name=\"info-circle\" />\n              </template>\n              <template #content>\n                <div style=\"max-width: 220px\">{{ lockedOptionTooltip(option) }}</div>\n              </template>\n            </PvTooltipV2>\n          </div>\n          <PvButton\n            v-if=\"!optionDisabled(option) && !isOptionLocked(option)\"\n            :left-icon=\"isOptionActive(option) ? 'remove-circle' : 'add-circle'\"\n            :ariaLabel=\"isOptionActive(option) ? `Remove ${option.text}` : `Add ${option.text}`\"\n            variant=\"ghost\"\n            :style=\"sortableListButtonStyles(option)\"\n            :class=\"sortableListButtonClasses(option)\"\n            @click=\"handleOptionClick(option)\"\n          ></PvButton>\n          <div v-else class=\"pv-sortable-list-button-placeholder\"></div>\n        </div>\n      </li>\n    </ul>\n  </div>\n</template>\n","import { PvPaginationVariant } from \"./types\";\n\nconst variantToNumber: Record<PvPaginationVariant, number> = {\n  short: 5,\n  long: 7,\n};\n\nexport const usePagination = ({\n  variant = \"long\",\n}: {\n  variant?: PvPaginationVariant;\n} = {}) => {\n  /**\n   * Number of reserved pagination slots for:\n   * - First page\n   * - Last page\n   * - Ellipsis (\"...\") indicators\n   * These help keep the pagination compact and readable.\n   */\n  const FIRST_LAST_DOTS = 3;\n\n  const getPaginations = ({\n    currentPage,\n    pages,\n  }: {\n    currentPage: number;\n    pages: number;\n  }) => {\n    if (pages <= variantToNumber[variant]) {\n      return Array.from({ length: pages }, (_, i) => ({\n        page: i + 1,\n        label: (i + 1).toString(),\n      }));\n    }\n\n    const pagination: {\n      page: number;\n      label: string;\n    }[] = [\n      {\n        page: 1,\n        label: \"1\",\n      },\n    ];\n\n    const recalculatedMaxNumberToShow =\n      variantToNumber[variant] - FIRST_LAST_DOTS;\n\n    const halfPagesAhead = Math.floor(recalculatedMaxNumberToShow / 2);\n\n    let start = currentPage - halfPagesAhead;\n    let end = currentPage + halfPagesAhead;\n\n    const showFirstDots = start > 2;\n    const showSecondDots = end < pages - 1;\n\n    if (start <= 2) {\n      start = 2;\n      end = start + recalculatedMaxNumberToShow - 1;\n    }\n\n    if (end >= pages - 1) {\n      end = pages - 1;\n      start = end - recalculatedMaxNumberToShow + 1;\n    }\n\n    if (showFirstDots) {\n      pagination.push({\n        page: 0,\n        label: \"...\",\n      });\n    }\n\n    if (showFirstDots && showSecondDots) {\n      for (let i = start + 1; i <= end - 1; i++) {\n        pagination.push({ page: i, label: i.toString() });\n      }\n    } else {\n      for (let i = start; i <= end; i++) {\n        pagination.push({ page: i, label: i.toString() });\n      }\n    }\n\n    if (showSecondDots) {\n      pagination.push({\n        page: 0,\n        label: \"...\",\n      });\n    }\n\n    if (pages > 1) {\n      pagination.push({ page: pages, label: pages.toString() });\n    }\n\n    return pagination;\n  };\n\n  return {\n    getPaginations,\n  };\n};\n","<script setup lang=\"ts\">\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { usePagination } from \"./usePagination\";\nimport { PvPaginationSize, PvPaginationVariant } from \"./types\";\n\ninterface PvPaginationProps {\n  /** Size of the pagination buttons */\n  size?: PvPaginationSize;\n  /** Total number of pages available */\n  maxPages: number;\n  maxNumberToShow?: number;\n  /** Display variant controlling the number of visible page buttons (\"short\" shows fewer) */\n  variant?: PvPaginationVariant;\n}\n\nconst props = withDefaults(defineProps<PvPaginationProps>(), {\n  size: \"lg\",\n  variant: \"long\",\n});\n\nconst { getPaginations } = usePagination({\n  variant: props.variant,\n});\n\nconst currentPage = defineModel<number>({ required: true });\n</script>\n\n<template>\n  <ol role=\"list\" class=\"pv-pagination\" data-testid=\"pv-pagination\" :data-style=\"size === 'lg' ? 'small' : undefined\">\n    <li>\n      <PvButton\n        data-testid=\"pagination-left-arrow-icon\"\n        :disabled=\"currentPage === 1\"\n        left-icon=\"chevron-left\"\n        ariaLabel=\"Previous page\"\n        variant=\"ghost\"\n        @click=\"$emit('update:modelValue', currentPage - 1)\"\n      />\n    </li>\n    <li\n      v-for=\"page in getPaginations({\n        currentPage,\n        pages: maxPages,\n      })\"\n      :key=\"page.page\"\n      :data-testid=\"`pagination-button-${page.page}`\"\n      :aria-current=\"page.page === currentPage ? 'page' : undefined\"\n    >\n      <button v-if=\"page.label === '...'\" class=\"dots-button pv-text-subdued\" disabled>\n        {{ page.label }}\n      </button>\n      <button v-else @click=\"$emit('update:modelValue', page.page)\">\n        {{ page.label }}\n      </button>\n    </li>\n    <li>\n      <PvButton\n        data-testid=\"pagination-right-arrow-icon\"\n        :disabled=\"currentPage === maxPages\"\n        left-icon=\"chevron-right\"\n        ariaLabel=\"Next page\"\n        variant=\"ghost\"\n        @click=\"$emit('update:modelValue', currentPage + 1)\"\n      />\n    </li>\n  </ol>\n</template>\n\n<style scoped>\n.dots-button {\n  background-color: transparent;\n}\n</style>\n","<script setup lang=\"ts\">\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { usePagination } from \"./usePagination\";\nimport { PvPaginationSize, PvPaginationVariant } from \"./types\";\n\ninterface PvPaginationProps {\n  /** Size of the pagination buttons */\n  size?: PvPaginationSize;\n  /** Total number of pages available */\n  maxPages: number;\n  maxNumberToShow?: number;\n  /** Display variant controlling the number of visible page buttons (\"short\" shows fewer) */\n  variant?: PvPaginationVariant;\n}\n\nconst props = withDefaults(defineProps<PvPaginationProps>(), {\n  size: \"lg\",\n  variant: \"long\",\n});\n\nconst { getPaginations } = usePagination({\n  variant: props.variant,\n});\n\nconst currentPage = defineModel<number>({ required: true });\n</script>\n\n<template>\n  <ol role=\"list\" class=\"pv-pagination\" data-testid=\"pv-pagination\" :data-style=\"size === 'lg' ? 'small' : undefined\">\n    <li>\n      <PvButton\n        data-testid=\"pagination-left-arrow-icon\"\n        :disabled=\"currentPage === 1\"\n        left-icon=\"chevron-left\"\n        ariaLabel=\"Previous page\"\n        variant=\"ghost\"\n        @click=\"$emit('update:modelValue', currentPage - 1)\"\n      />\n    </li>\n    <li\n      v-for=\"page in getPaginations({\n        currentPage,\n        pages: maxPages,\n      })\"\n      :key=\"page.page\"\n      :data-testid=\"`pagination-button-${page.page}`\"\n      :aria-current=\"page.page === currentPage ? 'page' : undefined\"\n    >\n      <button v-if=\"page.label === '...'\" class=\"dots-button pv-text-subdued\" disabled>\n        {{ page.label }}\n      </button>\n      <button v-else @click=\"$emit('update:modelValue', page.page)\">\n        {{ page.label }}\n      </button>\n    </li>\n    <li>\n      <PvButton\n        data-testid=\"pagination-right-arrow-icon\"\n        :disabled=\"currentPage === maxPages\"\n        left-icon=\"chevron-right\"\n        ariaLabel=\"Next page\"\n        variant=\"ghost\"\n        @click=\"$emit('update:modelValue', currentPage + 1)\"\n      />\n    </li>\n  </ol>\n</template>\n\n<style scoped>\n.dots-button {\n  background-color: transparent;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\ninterface PvSelectableCardProps {\n  /** Visual style variant of the selectable card. */\n  variant?: \"default\" | \"highlight\";\n  /** Value associated with this card, used as the input element's value. */\n  value?: string;\n  /** Unique identifier for the card's input element. Auto-generated if not provided. */\n  id?: string;\n  /** When true, renders as a checkbox (allowing deselection). When false, renders as a radio button. */\n  deselect?: boolean;\n  /** Whether the card is currently in the selected state. */\n  selected?: boolean;\n}\n\nconst { variant = \"default\", id } = defineProps<PvSelectableCardProps>();\n\nconst labelId = computed(() => {\n  if (id) {\n    return id;\n  }\n  return `${Math.random()}`;\n});\n</script>\n\n<template>\n  <label\n    data-testid=\"pv-selectable-card\"\n    :class=\"[\n      'pv-label-selectable-small',\n      {\n        'pv-label-selectable-highlight': variant === 'highlight',\n      },\n    ]\"\n    :for=\"labelId\"\n  >\n    <input\n      :checked=\"selected\"\n      class=\"pv-hide\"\n      name=\"type\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :id=\"labelId\"\n    />\n    <slot />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\ninterface PvSelectableCardProps {\n  /** Visual style variant of the selectable card. */\n  variant?: \"default\" | \"highlight\";\n  /** Value associated with this card, used as the input element's value. */\n  value?: string;\n  /** Unique identifier for the card's input element. Auto-generated if not provided. */\n  id?: string;\n  /** When true, renders as a checkbox (allowing deselection). When false, renders as a radio button. */\n  deselect?: boolean;\n  /** Whether the card is currently in the selected state. */\n  selected?: boolean;\n}\n\nconst { variant = \"default\", id } = defineProps<PvSelectableCardProps>();\n\nconst labelId = computed(() => {\n  if (id) {\n    return id;\n  }\n  return `${Math.random()}`;\n});\n</script>\n\n<template>\n  <label\n    data-testid=\"pv-selectable-card\"\n    :class=\"[\n      'pv-label-selectable-small',\n      {\n        'pv-label-selectable-highlight': variant === 'highlight',\n      },\n    ]\"\n    :for=\"labelId\"\n  >\n    <input\n      :checked=\"selected\"\n      class=\"pv-hide\"\n      name=\"type\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :id=\"labelId\"\n    />\n    <slot />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport PvResizeHandle from \"@/components/base/PvResizeHandle/PvResizeHandle.vue\";\nimport type { PvSidePanelProps } from \"./types\";\n\nwithDefaults(defineProps<PvSidePanelProps>(), {\n  leftSidebarMinWidth: 240,\n  resizableLeftSidebar: false,\n  resizableRightSidebar: false,\n  rightSidebarMinWidth: 240,\n});\n\n/** The left sidebar's current width in pixels. Only meaningful when `resizableLeftSidebar` is set. */\nconst leftSidebarWidth = defineModel<number>(\"leftSidebarWidth\", {\n  required: false,\n});\n/** The right sidebar's current width in pixels. Only meaningful when `resizableRightSidebar` is set. */\nconst rightSidebarWidth = defineModel<number>(\"rightSidebarWidth\", {\n  required: false,\n});\n</script>\n\n<template>\n  <div class=\"pv-layout-two-sidebar\">\n    <div\n      :class=\"{ 'pv-resizable': resizableLeftSidebar }\"\n      :data-hidden=\"showLeftSidebar === false ? true : undefined\"\n      data-testid=\"pv-side-panel-left\"\n      data-layout=\"left-sidebar\"\n    >\n      <PvResizeHandle\n        v-if=\"resizableLeftSidebar\"\n        v-model:size=\"leftSidebarWidth\"\n        ariaLabel=\"Resize left sidebar\"\n        :defaultSize=\"leftSidebarDefaultWidth\"\n        :disabled=\"showLeftSidebar === false\"\n        edge=\"right\"\n        :maxSize=\"leftSidebarMaxWidth\"\n        :minSize=\"leftSidebarMinWidth\"\n        :storageKey=\"leftSidebarStorageKey\"\n      />\n      <slot name=\"left-sidebar\" />\n    </div>\n    <div data-layout=\"main-section\">\n      <slot name=\"main\" />\n    </div>\n    <div\n      :class=\"{ 'pv-resizable': resizableRightSidebar }\"\n      :data-hidden=\"showRightSidebar === false ? true : undefined\"\n      data-testid=\"pv-side-panel-right\"\n      data-layout=\"right-sidebar\"\n    >\n      <PvResizeHandle\n        v-if=\"resizableRightSidebar\"\n        v-model:size=\"rightSidebarWidth\"\n        ariaLabel=\"Resize right sidebar\"\n        :defaultSize=\"rightSidebarDefaultWidth\"\n        :disabled=\"showRightSidebar === false\"\n        edge=\"left\"\n        :maxSize=\"rightSidebarMaxWidth\"\n        :minSize=\"rightSidebarMinWidth\"\n        :storageKey=\"rightSidebarStorageKey\"\n      />\n      <slot name=\"right-sidebar\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvResizeHandle from \"@/components/base/PvResizeHandle/PvResizeHandle.vue\";\nimport type { PvSidePanelProps } from \"./types\";\n\nwithDefaults(defineProps<PvSidePanelProps>(), {\n  leftSidebarMinWidth: 240,\n  resizableLeftSidebar: false,\n  resizableRightSidebar: false,\n  rightSidebarMinWidth: 240,\n});\n\n/** The left sidebar's current width in pixels. Only meaningful when `resizableLeftSidebar` is set. */\nconst leftSidebarWidth = defineModel<number>(\"leftSidebarWidth\", {\n  required: false,\n});\n/** The right sidebar's current width in pixels. Only meaningful when `resizableRightSidebar` is set. */\nconst rightSidebarWidth = defineModel<number>(\"rightSidebarWidth\", {\n  required: false,\n});\n</script>\n\n<template>\n  <div class=\"pv-layout-two-sidebar\">\n    <div\n      :class=\"{ 'pv-resizable': resizableLeftSidebar }\"\n      :data-hidden=\"showLeftSidebar === false ? true : undefined\"\n      data-testid=\"pv-side-panel-left\"\n      data-layout=\"left-sidebar\"\n    >\n      <PvResizeHandle\n        v-if=\"resizableLeftSidebar\"\n        v-model:size=\"leftSidebarWidth\"\n        ariaLabel=\"Resize left sidebar\"\n        :defaultSize=\"leftSidebarDefaultWidth\"\n        :disabled=\"showLeftSidebar === false\"\n        edge=\"right\"\n        :maxSize=\"leftSidebarMaxWidth\"\n        :minSize=\"leftSidebarMinWidth\"\n        :storageKey=\"leftSidebarStorageKey\"\n      />\n      <slot name=\"left-sidebar\" />\n    </div>\n    <div data-layout=\"main-section\">\n      <slot name=\"main\" />\n    </div>\n    <div\n      :class=\"{ 'pv-resizable': resizableRightSidebar }\"\n      :data-hidden=\"showRightSidebar === false ? true : undefined\"\n      data-testid=\"pv-side-panel-right\"\n      data-layout=\"right-sidebar\"\n    >\n      <PvResizeHandle\n        v-if=\"resizableRightSidebar\"\n        v-model:size=\"rightSidebarWidth\"\n        ariaLabel=\"Resize right sidebar\"\n        :defaultSize=\"rightSidebarDefaultWidth\"\n        :disabled=\"showRightSidebar === false\"\n        edge=\"left\"\n        :maxSize=\"rightSidebarMaxWidth\"\n        :minSize=\"rightSidebarMinWidth\"\n        :storageKey=\"rightSidebarStorageKey\"\n      />\n      <slot name=\"right-sidebar\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport PvResizeHandle from \"@/components/base/PvResizeHandle/PvResizeHandle.vue\";\nimport type { PvResizeEvent } from \"@/components/base/PvResizeHandle/types\";\nimport type { PvSplitPaneProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvSplitPaneProps>(), {\n  ariaLabel: \"Resize panels\",\n  collapsedSize: 0,\n  collapsible: false,\n  defaultSize: \"50%\",\n  direction: \"horizontal\",\n  disabled: false,\n  keyboardStep: 16,\n  minSize: 0,\n  snapThreshold: 0,\n});\n\n/** Size of the start panel in pixels. */\nconst size = defineModel<number>(\"size\");\n\nconst emit = defineEmits<{\n  (e: \"resize\", event: PvResizeEvent): void;\n  (e: \"resize-end\", event: PvResizeEvent): void;\n  (e: \"resize-start\", event: PvResizeEvent): void;\n}>();\n\n// Only the start panel is sized; the end panel takes whatever is left. That\n// keeps a single source of truth for the split and means the pane survives the\n// container resizing without the two sides drifting apart.\nconst edge = computed(() => (props.direction === \"horizontal\" ? \"right\" : \"bottom\"));\n</script>\n\n<template>\n  <div class=\"pv-split-pane\" :data-pv-split-pane-direction=\"direction\" data-testid=\"pv-split-pane\">\n    <div class=\"pv-split-pane-panel pv-resizable\" data-testid=\"pv-split-pane-start\">\n      <div class=\"pv-split-pane-content\">\n        <slot name=\"start\" />\n      </div>\n      <PvResizeHandle\n        v-model:size=\"size\"\n        :ariaLabel=\"ariaLabel\"\n        :collapsedSize=\"collapsedSize\"\n        :collapsible=\"collapsible\"\n        :defaultSize=\"defaultSize\"\n        :disabled=\"disabled\"\n        :edge=\"edge\"\n        :keyboardStep=\"keyboardStep\"\n        :maxSize=\"maxSize\"\n        :minSize=\"minSize\"\n        :snapThreshold=\"snapThreshold\"\n        :storageKey=\"storageKey\"\n        @resize=\"emit('resize', $event)\"\n        @resize-end=\"emit('resize-end', $event)\"\n        @resize-start=\"emit('resize-start', $event)\"\n      />\n    </div>\n    <div class=\"pv-split-pane-panel pv-split-pane-panel-fill\" data-testid=\"pv-split-pane-end\">\n      <slot name=\"end\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport PvResizeHandle from \"@/components/base/PvResizeHandle/PvResizeHandle.vue\";\nimport type { PvResizeEvent } from \"@/components/base/PvResizeHandle/types\";\nimport type { PvSplitPaneProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvSplitPaneProps>(), {\n  ariaLabel: \"Resize panels\",\n  collapsedSize: 0,\n  collapsible: false,\n  defaultSize: \"50%\",\n  direction: \"horizontal\",\n  disabled: false,\n  keyboardStep: 16,\n  minSize: 0,\n  snapThreshold: 0,\n});\n\n/** Size of the start panel in pixels. */\nconst size = defineModel<number>(\"size\");\n\nconst emit = defineEmits<{\n  (e: \"resize\", event: PvResizeEvent): void;\n  (e: \"resize-end\", event: PvResizeEvent): void;\n  (e: \"resize-start\", event: PvResizeEvent): void;\n}>();\n\n// Only the start panel is sized; the end panel takes whatever is left. That\n// keeps a single source of truth for the split and means the pane survives the\n// container resizing without the two sides drifting apart.\nconst edge = computed(() => (props.direction === \"horizontal\" ? \"right\" : \"bottom\"));\n</script>\n\n<template>\n  <div class=\"pv-split-pane\" :data-pv-split-pane-direction=\"direction\" data-testid=\"pv-split-pane\">\n    <div class=\"pv-split-pane-panel pv-resizable\" data-testid=\"pv-split-pane-start\">\n      <div class=\"pv-split-pane-content\">\n        <slot name=\"start\" />\n      </div>\n      <PvResizeHandle\n        v-model:size=\"size\"\n        :ariaLabel=\"ariaLabel\"\n        :collapsedSize=\"collapsedSize\"\n        :collapsible=\"collapsible\"\n        :defaultSize=\"defaultSize\"\n        :disabled=\"disabled\"\n        :edge=\"edge\"\n        :keyboardStep=\"keyboardStep\"\n        :maxSize=\"maxSize\"\n        :minSize=\"minSize\"\n        :snapThreshold=\"snapThreshold\"\n        :storageKey=\"storageKey\"\n        @resize=\"emit('resize', $event)\"\n        @resize-end=\"emit('resize-end', $event)\"\n        @resize-start=\"emit('resize-start', $event)\"\n      />\n    </div>\n    <div class=\"pv-split-pane-panel pv-split-pane-panel-fill\" data-testid=\"pv-split-pane-end\">\n      <slot name=\"end\" />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useTemplateRef } from \"vue\";\nimport PvAiButton from \"../PvAiButton/PvAiButton.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\nimport type { PvHeaderProps } from \"./types\";\n\nconst rootRef = useTemplateRef<HTMLElement | null>(\"rootRef\");\n// Resolve the host element so slot detection works as a web component too.\nconst slotHost = computed(() => {\n  const rootNode = rootRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\nconst { present: hasRightSlot } = useSlotPresence(\"right\", { host: slotHost });\n\nwithDefaults(defineProps<PvHeaderProps>(), {\n  as: \"div\",\n  askTqButtonBuddy: false,\n  askTqButtonBuddyAnimated: false,\n  askTqButtonBuddyEmote: \"idle\",\n  askTqButtonBuddyTheme: \"default\",\n  askTqButtonBuddyVariant: \"default\",\n  askTqButtonId: \"asktq-launch-button\",\n  headerActionsId: \"header-actions\",\n  headerTitleId: \"header-title\",\n  sticky: false,\n});\n\nconst emit = defineEmits<{\n  \"ask-tq-click\": [event: MouseEvent];\n}>();\n</script>\n\n<template>\n  <component\n    :is=\"as\"\n    ref=\"rootRef\"\n    class=\"pv-inset-square pv-flex pv-space-between pv-surface pv-border-bottom\"\n    :class=\"{ 'pv-sticky': sticky }\"\n    style=\"--inset-size: 0.75rem 1rem; background-color: #fdfdfc\"\n  >\n    <!-- min-height matches a large button, so the header is the same height with or without actions -->\n    <span v-if=\"title\" class=\"pv-heading-2 pv-flex\" style=\"min-height: 2rem\">{{ title }}</span>\n    <div :id=\"headerTitleId\" class=\"pv-flex\" style=\"min-height: 2rem\" v-else>\n      <slot name=\"left\" />\n    </div>\n    <div class=\"pv-flex\">\n      <div :id=\"headerActionsId\" class=\"pv-flex\">\n        <slot name=\"right\" />\n      </div>\n      <div v-if=\"showAskTqButton\" :class=\"{ 'pv-border-left': hasRightSlot }\" style=\"padding-inline-start: 0.5rem\">\n        <PvAiButton\n          :id=\"askTqButtonId\"\n          label=\"AskTQ\"\n          size=\"xl\"\n          :buddy=\"askTqButtonBuddy\"\n          :buddy-animated=\"askTqButtonBuddyAnimated\"\n          :buddy-emote=\"askTqButtonBuddyEmote\"\n          :buddy-theme=\"askTqButtonBuddyTheme\"\n          :buddy-variant=\"askTqButtonBuddyVariant\"\n          :hide-icon=\"!askTqButtonBuddy\"\n          @click=\"emit('ask-tq-click', $event)\"\n        />\n      </div>\n    </div>\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useTemplateRef } from \"vue\";\nimport PvAiButton from \"../PvAiButton/PvAiButton.vue\";\nimport { useSlotPresence } from \"@/composables/useSlotPresence\";\nimport type { PvHeaderProps } from \"./types\";\n\nconst rootRef = useTemplateRef<HTMLElement | null>(\"rootRef\");\n// Resolve the host element so slot detection works as a web component too.\nconst slotHost = computed(() => {\n  const rootNode = rootRef.value?.getRootNode();\n  return rootNode instanceof ShadowRoot ? (rootNode.host as HTMLElement) : null;\n});\nconst { present: hasRightSlot } = useSlotPresence(\"right\", { host: slotHost });\n\nwithDefaults(defineProps<PvHeaderProps>(), {\n  as: \"div\",\n  askTqButtonBuddy: false,\n  askTqButtonBuddyAnimated: false,\n  askTqButtonBuddyEmote: \"idle\",\n  askTqButtonBuddyTheme: \"default\",\n  askTqButtonBuddyVariant: \"default\",\n  askTqButtonId: \"asktq-launch-button\",\n  headerActionsId: \"header-actions\",\n  headerTitleId: \"header-title\",\n  sticky: false,\n});\n\nconst emit = defineEmits<{\n  \"ask-tq-click\": [event: MouseEvent];\n}>();\n</script>\n\n<template>\n  <component\n    :is=\"as\"\n    ref=\"rootRef\"\n    class=\"pv-inset-square pv-flex pv-space-between pv-surface pv-border-bottom\"\n    :class=\"{ 'pv-sticky': sticky }\"\n    style=\"--inset-size: 0.75rem 1rem; background-color: #fdfdfc\"\n  >\n    <!-- min-height matches a large button, so the header is the same height with or without actions -->\n    <span v-if=\"title\" class=\"pv-heading-2 pv-flex\" style=\"min-height: 2rem\">{{ title }}</span>\n    <div :id=\"headerTitleId\" class=\"pv-flex\" style=\"min-height: 2rem\" v-else>\n      <slot name=\"left\" />\n    </div>\n    <div class=\"pv-flex\">\n      <div :id=\"headerActionsId\" class=\"pv-flex\">\n        <slot name=\"right\" />\n      </div>\n      <div v-if=\"showAskTqButton\" :class=\"{ 'pv-border-left': hasRightSlot }\" style=\"padding-inline-start: 0.5rem\">\n        <PvAiButton\n          :id=\"askTqButtonId\"\n          label=\"AskTQ\"\n          size=\"xl\"\n          :buddy=\"askTqButtonBuddy\"\n          :buddy-animated=\"askTqButtonBuddyAnimated\"\n          :buddy-emote=\"askTqButtonBuddyEmote\"\n          :buddy-theme=\"askTqButtonBuddyTheme\"\n          :buddy-variant=\"askTqButtonBuddyVariant\"\n          :hide-icon=\"!askTqButtonBuddy\"\n          @click=\"emit('ask-tq-click', $event)\"\n        />\n      </div>\n    </div>\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport PvCompanyLogo from \"../PvCompanyLogo/PvCompanyLogo.vue\";\nimport { PvCompanyLabelSize } from \"./types\";\n\ninterface PvCompanyLabelProps {\n  /** Display size of the label and logo */\n  size?: PvCompanyLabelSize;\n  /** Logo identifier to display; falls back to label if not provided */\n  logo?: string;\n  /** Text label to display alongside the logo */\n  label: string;\n}\n\nwithDefaults(defineProps<PvCompanyLabelProps>(), {\n  size: \"md\",\n});\n\nconst mapSizeToLabelSize: Record<PvCompanyLabelSize, string> = {\n  xs: \"pv-text-body-xs\",\n  sm: \"pv-text-body-md\",\n  md: \"pv-text-body-md\",\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\">\n    <PvCompanyLogo :name=\"logo ? logo : label\" :size=\"size\" />\n    <span :class=\"mapSizeToLabelSize[size]\">{{ label }}</span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvCompanyLogo from \"../PvCompanyLogo/PvCompanyLogo.vue\";\nimport { PvCompanyLabelSize } from \"./types\";\n\ninterface PvCompanyLabelProps {\n  /** Display size of the label and logo */\n  size?: PvCompanyLabelSize;\n  /** Logo identifier to display; falls back to label if not provided */\n  logo?: string;\n  /** Text label to display alongside the logo */\n  label: string;\n}\n\nwithDefaults(defineProps<PvCompanyLabelProps>(), {\n  size: \"md\",\n});\n\nconst mapSizeToLabelSize: Record<PvCompanyLabelSize, string> = {\n  xs: \"pv-text-body-xs\",\n  sm: \"pv-text-body-md\",\n  md: \"pv-text-body-md\",\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\">\n    <PvCompanyLogo :name=\"logo ? logo : label\" :size=\"size\" />\n    <span :class=\"mapSizeToLabelSize[size]\">{{ label }}</span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvAvatarGroupItem, PvAvatarGroupSize } from \"./types\";\n\ninterface PvAvatarGroupProps {\n  /** Array of avatar items to render in the group. */\n  items: PvAvatarGroupItem[];\n  /** Maximum number of avatars to show before displaying an overflow indicator. Capped at 7. */\n  maxDisplayed: number;\n  /** Size of each avatar in the group. Defaults to 'xl' (32px). */\n  size?: PvAvatarGroupSize;\n}\n\nconst props = defineProps<PvAvatarGroupProps>();\n\nconst displayedItems = computed(() => {\n  return props.maxDisplayed >= 7 ? 7 : props.maxDisplayed;\n});\n\nconst extraDisplayedItems = computed(() => {\n  const extraNumbers = props.items.length - displayedItems.value;\n  return extraNumbers > 0 ? extraNumbers : 0;\n});\n\nconst placeholderClass: Record<PvAvatarGroupSize, string> = {\n  md: \"pv-avatar-20\",\n  lg: \"pv-avatar-xs\",\n  xl: \"pv-avatar-sm\",\n  xxl: \"pv-avatar-md\",\n};\n\nconst avatarPlaceholderClass = computed(() => placeholderClass[props.size ?? \"xl\"]);\n</script>\n\n<template>\n  <ul\n    :class=\"['pv-avatar-group', size && size !== 'xl' ? `pv-avatar-group-${size}` : '']\"\n    role=\"list\"\n    :data-more=\"extraDisplayedItems <= 0 ? undefined : extraDisplayedItems\"\n    data-testid=\"pv-avatar-group\"\n  >\n    <li v-for=\"(item, index) in items.slice(0, displayedItems)\" :key=\"index\" data-testid=\"pv-avatar-group-item\">\n      <template v-if=\"item.initials\">{{ item.initials }}</template>\n      <img v-else-if=\"item.image\" :src=\"item.image\" :alt=\"item.alt ?? ''\" />\n      <div v-else :class=\"avatarPlaceholderClass\"></div>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvAvatarGroupItem, PvAvatarGroupSize } from \"./types\";\n\ninterface PvAvatarGroupProps {\n  /** Array of avatar items to render in the group. */\n  items: PvAvatarGroupItem[];\n  /** Maximum number of avatars to show before displaying an overflow indicator. Capped at 7. */\n  maxDisplayed: number;\n  /** Size of each avatar in the group. Defaults to 'xl' (32px). */\n  size?: PvAvatarGroupSize;\n}\n\nconst props = defineProps<PvAvatarGroupProps>();\n\nconst displayedItems = computed(() => {\n  return props.maxDisplayed >= 7 ? 7 : props.maxDisplayed;\n});\n\nconst extraDisplayedItems = computed(() => {\n  const extraNumbers = props.items.length - displayedItems.value;\n  return extraNumbers > 0 ? extraNumbers : 0;\n});\n\nconst placeholderClass: Record<PvAvatarGroupSize, string> = {\n  md: \"pv-avatar-20\",\n  lg: \"pv-avatar-xs\",\n  xl: \"pv-avatar-sm\",\n  xxl: \"pv-avatar-md\",\n};\n\nconst avatarPlaceholderClass = computed(() => placeholderClass[props.size ?? \"xl\"]);\n</script>\n\n<template>\n  <ul\n    :class=\"['pv-avatar-group', size && size !== 'xl' ? `pv-avatar-group-${size}` : '']\"\n    role=\"list\"\n    :data-more=\"extraDisplayedItems <= 0 ? undefined : extraDisplayedItems\"\n    data-testid=\"pv-avatar-group\"\n  >\n    <li v-for=\"(item, index) in items.slice(0, displayedItems)\" :key=\"index\" data-testid=\"pv-avatar-group-item\">\n      <template v-if=\"item.initials\">{{ item.initials }}</template>\n      <img v-else-if=\"item.image\" :src=\"item.image\" :alt=\"item.alt ?? ''\" />\n      <div v-else :class=\"avatarPlaceholderClass\"></div>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport { PvToggleGroupOption, PvToggleGroupProps } from \"@/components/base/PvToggleGroup/types.ts\";\n\nconst props = defineProps<PvToggleGroupProps>();\nconst selectedOption = defineModel<PvToggleGroupOption | null>();\n\n// Generate a stable unique ID for this component instance\nconst groupId = ref(`toggle-group-${Math.random().toString(36).substr(2, 9)}`);\n\nconst handleToggle = (option: PvToggleGroupOption) => {\n  if (option.disabled) return;\n\n  // If clicking the already selected option and allowDeselect is true, deselect it\n  if (selectedOption.value?.value === option.value) {\n    if (props.allowDeselect) {\n      selectedOption.value = null;\n    }\n    return;\n  }\n\n  // Select the new option\n  selectedOption.value = option;\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\">\n    <template v-for=\"option in options\" :key=\"option.value\">\n      <PvTooltipV2 :description=\"hideLabels ? option.label : ''\">\n        <template #trigger>\n          <label\n            class=\"pv-label pv-label-hover pv-flex pv-toggle-small\"\n            :class=\"{ 'pv-disabled': disabled || option.disabled }\"\n          >\n            <input\n              type=\"radio\"\n              :name=\"groupId\"\n              :value=\"option.value\"\n              :checked=\"selectedOption?.value === option.value\"\n              class=\"pv-radio\"\n              :disabled=\"disabled || option.disabled\"\n              @change=\"handleToggle(option)\"\n            />\n            <PvIcon v-if=\"option.icon\" :name=\"option.icon\" />\n            <span v-if=\"!hideLabels\">{{ option.label }}</span>\n          </label>\n        </template>\n      </PvTooltipV2>\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport { PvToggleGroupOption, PvToggleGroupProps } from \"@/components/base/PvToggleGroup/types.ts\";\n\nconst props = defineProps<PvToggleGroupProps>();\nconst selectedOption = defineModel<PvToggleGroupOption | null>();\n\n// Generate a stable unique ID for this component instance\nconst groupId = ref(`toggle-group-${Math.random().toString(36).substr(2, 9)}`);\n\nconst handleToggle = (option: PvToggleGroupOption) => {\n  if (option.disabled) return;\n\n  // If clicking the already selected option and allowDeselect is true, deselect it\n  if (selectedOption.value?.value === option.value) {\n    if (props.allowDeselect) {\n      selectedOption.value = null;\n    }\n    return;\n  }\n\n  // Select the new option\n  selectedOption.value = option;\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\">\n    <template v-for=\"option in options\" :key=\"option.value\">\n      <PvTooltipV2 :description=\"hideLabels ? option.label : ''\">\n        <template #trigger>\n          <label\n            class=\"pv-label pv-label-hover pv-flex pv-toggle-small\"\n            :class=\"{ 'pv-disabled': disabled || option.disabled }\"\n          >\n            <input\n              type=\"radio\"\n              :name=\"groupId\"\n              :value=\"option.value\"\n              :checked=\"selectedOption?.value === option.value\"\n              class=\"pv-radio\"\n              :disabled=\"disabled || option.disabled\"\n              @change=\"handleToggle(option)\"\n            />\n            <PvIcon v-if=\"option.icon\" :name=\"option.icon\" />\n            <span v-if=\"!hideLabels\">{{ option.label }}</span>\n          </label>\n        </template>\n      </PvTooltipV2>\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\ninterface PvCheckboxProps {\n  /** Accessible name when no wrapping <label> is present. */\n  ariaLabel?: string;\n  /** When true, the checkbox is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** When true, displays the checkbox in an indeterminate (mixed) state. */\n  indeterminate?: boolean;\n}\n\ndefineProps<PvCheckboxProps>();\n\nconst value = defineModel<boolean>();\n</script>\n\n<template>\n  <input\n    v-model=\"value\"\n    class=\"pv-checkbox\"\n    type=\"checkbox\"\n    name=\"checkbox\"\n    :aria-label=\"ariaLabel\"\n    :disabled=\"disabled\"\n    :indeterminate=\"indeterminate\"\n  />\n</template>\n","<script setup lang=\"ts\">\ninterface PvCheckboxProps {\n  /** Accessible name when no wrapping <label> is present. */\n  ariaLabel?: string;\n  /** When true, the checkbox is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** When true, displays the checkbox in an indeterminate (mixed) state. */\n  indeterminate?: boolean;\n}\n\ndefineProps<PvCheckboxProps>();\n\nconst value = defineModel<boolean>();\n</script>\n\n<template>\n  <input\n    v-model=\"value\"\n    class=\"pv-checkbox\"\n    type=\"checkbox\"\n    name=\"checkbox\"\n    :aria-label=\"ariaLabel\"\n    :disabled=\"disabled\"\n    :indeterminate=\"indeterminate\"\n  />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport type { RadioGroupOption } from \"./types\";\n\ninterface PvRadioGroupProps {\n  /** Accessible label when no visible legend is provided. */\n  ariaLabel?: string;\n  /** When true, all options are non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Visible label rendered above the group. */\n  label?: string;\n  /** Name attribute shared by all radio inputs. Auto-generated if omitted. */\n  name?: string;\n  /** Array of options to render as radio buttons. */\n  options?: RadioGroupOption[];\n  /** Layout direction of the options. */\n  orientation?: \"vertical\" | \"horizontal\";\n}\n\nconst props = withDefaults(defineProps<PvRadioGroupProps>(), {\n  options: () => [],\n  orientation: \"vertical\",\n  disabled: false,\n});\n\nconst model = defineModel<string | number | boolean>();\n\nconst generatedName = useId();\nconst labelId = useId();\n\nconst groupName = computed(() => props.name ?? generatedName);\n\nconst radioGroupStyles = computed(() => {\n  if (props.orientation === \"vertical\") {\n    return {\n      \"--flex-align\": \"flex-start\",\n    };\n  }\n\n  return {};\n});\n</script>\n\n<template>\n  <div role=\"radiogroup\" :aria-label=\"!label ? ariaLabel : undefined\" :aria-labelledby=\"label ? labelId : undefined\">\n    <span v-if=\"label\" :id=\"labelId\" class=\"pv-label pv-stack-8\">{{ label }}</span>\n    <div :class=\"orientation === 'horizontal' ? 'pv-flex' : 'pv-flex-vertical'\" :style=\"radioGroupStyles\">\n      <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"pv-label pv-flex\">\n        <input\n          v-model=\"model\"\n          class=\"pv-radio\"\n          type=\"radio\"\n          :name=\"groupName\"\n          :value=\"option.value\"\n          :disabled=\"disabled || option.disabled\"\n        />\n        {{ option.label }}\n      </label>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport type { RadioGroupOption } from \"./types\";\n\ninterface PvRadioGroupProps {\n  /** Accessible label when no visible legend is provided. */\n  ariaLabel?: string;\n  /** When true, all options are non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** Visible label rendered above the group. */\n  label?: string;\n  /** Name attribute shared by all radio inputs. Auto-generated if omitted. */\n  name?: string;\n  /** Array of options to render as radio buttons. */\n  options?: RadioGroupOption[];\n  /** Layout direction of the options. */\n  orientation?: \"vertical\" | \"horizontal\";\n}\n\nconst props = withDefaults(defineProps<PvRadioGroupProps>(), {\n  options: () => [],\n  orientation: \"vertical\",\n  disabled: false,\n});\n\nconst model = defineModel<string | number | boolean>();\n\nconst generatedName = useId();\nconst labelId = useId();\n\nconst groupName = computed(() => props.name ?? generatedName);\n\nconst radioGroupStyles = computed(() => {\n  if (props.orientation === \"vertical\") {\n    return {\n      \"--flex-align\": \"flex-start\",\n    };\n  }\n\n  return {};\n});\n</script>\n\n<template>\n  <div role=\"radiogroup\" :aria-label=\"!label ? ariaLabel : undefined\" :aria-labelledby=\"label ? labelId : undefined\">\n    <span v-if=\"label\" :id=\"labelId\" class=\"pv-label pv-stack-8\">{{ label }}</span>\n    <div :class=\"orientation === 'horizontal' ? 'pv-flex' : 'pv-flex-vertical'\" :style=\"radioGroupStyles\">\n      <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"pv-label pv-flex\">\n        <input\n          v-model=\"model\"\n          class=\"pv-radio\"\n          type=\"radio\"\n          :name=\"groupName\"\n          :value=\"option.value\"\n          :disabled=\"disabled || option.disabled\"\n        />\n        {{ option.label }}\n      </label>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted } from \"vue\";\n\ntype PvSpriteProps = {\n  src: string;\n  variant?: \"v1\" | \"v2\";\n};\n\nconst props = withDefaults(defineProps<PvSpriteProps>(), {\n  variant: \"v2\",\n});\n\nonMounted(async () => {\n  const file = props.variant === \"v1\" ? \"sprite-v1.svg\" : \"sprite-v2.svg\";\n  const fullPath = props.src + file;\n  try {\n    const response = await fetch(fullPath);\n    const svgText = await response.text();\n    const target = document.getElementById(\"pv-sprite-content\");\n    if (target) {\n      target.innerHTML = svgText;\n      target.hidden = false; // Optional: show if needed\n    }\n  } catch (error) {\n    console.error(\"Failed to load SVG:\", error);\n  }\n});\n</script>\n\n<template>\n  <Teleport to=\"body\">\n    <div hidden id=\"pv-sprite-content\"></div>\n  </Teleport>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted } from \"vue\";\n\ntype PvSpriteProps = {\n  src: string;\n  variant?: \"v1\" | \"v2\";\n};\n\nconst props = withDefaults(defineProps<PvSpriteProps>(), {\n  variant: \"v2\",\n});\n\nonMounted(async () => {\n  const file = props.variant === \"v1\" ? \"sprite-v1.svg\" : \"sprite-v2.svg\";\n  const fullPath = props.src + file;\n  try {\n    const response = await fetch(fullPath);\n    const svgText = await response.text();\n    const target = document.getElementById(\"pv-sprite-content\");\n    if (target) {\n      target.innerHTML = svgText;\n      target.hidden = false; // Optional: show if needed\n    }\n  } catch (error) {\n    console.error(\"Failed to load SVG:\", error);\n  }\n});\n</script>\n\n<template>\n  <Teleport to=\"body\">\n    <div hidden id=\"pv-sprite-content\"></div>\n  </Teleport>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { Skeleton } from \"primevue\";\nimport { PvSkeletonSize, PvSkeletonVariant } from \"./types\";\n\nconst mapSizeToPx: Record<PvSkeletonSize, string> = {\n  xs: \"0.75rem\",\n  sm: \"1rem\",\n  md: \"1.25rem\",\n  lg: \"1.5rem\",\n  xl: \"2rem\",\n};\n\ninterface PvSkeletonProps {\n  /** The size of the skeleton placeholder. Sets the height, and the width for the \"square\" and \"circle\" variants. Overridden by `width`/`height` when provided. */\n  size?: PvSkeletonSize;\n  /** The shape variant. \"rectangle\" fills available width; \"square\" and \"circle\" use equal height and width. */\n  variant?: PvSkeletonVariant;\n  /** Optional explicit width (any CSS length, e.g. \"45%\" or \"48px\"). Overrides the width derived from `size`/`variant`. */\n  width?: string;\n  /** Optional explicit height (any CSS length, e.g. \"8px\"). Overrides the height derived from `size`. */\n  height?: string;\n}\n\nconst props = withDefaults(defineProps<PvSkeletonProps>(), {\n  size: \"md\",\n  variant: \"rectangle\",\n});\n\n// \"square\" and \"circle\" are equal-sided unless an explicit width/height is given.\nconst isFixedAspect = computed(() => props.variant === \"square\" || props.variant === \"circle\");\n\nconst resolvedHeight = computed(() => props.height ?? mapSizeToPx[props.size]);\n\nconst resolvedWidth = computed(() => props.width ?? (isFixedAspect.value ? mapSizeToPx[props.size] : \"100%\"));\n\nconst resolvedShape = computed(() => (props.variant === \"circle\" ? \"circle\" : \"rectangle\"));\n</script>\n\n<template>\n  <Skeleton data-testid=\"pv-skeleton\" :shape=\"resolvedShape\" :height=\"resolvedHeight\" :width=\"resolvedWidth\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { Skeleton } from \"primevue\";\nimport { PvSkeletonSize, PvSkeletonVariant } from \"./types\";\n\nconst mapSizeToPx: Record<PvSkeletonSize, string> = {\n  xs: \"0.75rem\",\n  sm: \"1rem\",\n  md: \"1.25rem\",\n  lg: \"1.5rem\",\n  xl: \"2rem\",\n};\n\ninterface PvSkeletonProps {\n  /** The size of the skeleton placeholder. Sets the height, and the width for the \"square\" and \"circle\" variants. Overridden by `width`/`height` when provided. */\n  size?: PvSkeletonSize;\n  /** The shape variant. \"rectangle\" fills available width; \"square\" and \"circle\" use equal height and width. */\n  variant?: PvSkeletonVariant;\n  /** Optional explicit width (any CSS length, e.g. \"45%\" or \"48px\"). Overrides the width derived from `size`/`variant`. */\n  width?: string;\n  /** Optional explicit height (any CSS length, e.g. \"8px\"). Overrides the height derived from `size`. */\n  height?: string;\n}\n\nconst props = withDefaults(defineProps<PvSkeletonProps>(), {\n  size: \"md\",\n  variant: \"rectangle\",\n});\n\n// \"square\" and \"circle\" are equal-sided unless an explicit width/height is given.\nconst isFixedAspect = computed(() => props.variant === \"square\" || props.variant === \"circle\");\n\nconst resolvedHeight = computed(() => props.height ?? mapSizeToPx[props.size]);\n\nconst resolvedWidth = computed(() => props.width ?? (isFixedAspect.value ? mapSizeToPx[props.size] : \"100%\"));\n\nconst resolvedShape = computed(() => (props.variant === \"circle\" ? \"circle\" : \"rectangle\"));\n</script>\n\n<template>\n  <Skeleton data-testid=\"pv-skeleton\" :shape=\"resolvedShape\" :height=\"resolvedHeight\" :width=\"resolvedWidth\" />\n</template>\n","<script setup lang=\"ts\">\nimport type { TqLoaderProps, TqLoaderVariant } from \"./types\";\n\nconst BLOCK_COUNTS: Record<TqLoaderVariant, number> = { pulse: 1, full: 11 };\n\nwithDefaults(defineProps<TqLoaderProps>(), {\n  label: \"Loading\",\n  size: \"md\",\n});\n</script>\n\n<template>\n  <span class=\"tq-loader\" :class=\"[`tq-loader-${variant}`, { 'tq-loader-sm': size === 'sm' }]\" role=\"status\">\n    <span class=\"pv-visually-hidden\">{{ label }}</span>\n    <span class=\"tq-loader-mark\" aria-hidden=\"true\">\n      <span v-for=\"block in BLOCK_COUNTS[variant]\" :key=\"block\"></span>\n    </span>\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport type { TqLoaderProps, TqLoaderVariant } from \"./types\";\n\nconst BLOCK_COUNTS: Record<TqLoaderVariant, number> = { pulse: 1, full: 11 };\n\nwithDefaults(defineProps<TqLoaderProps>(), {\n  label: \"Loading\",\n  size: \"md\",\n});\n</script>\n\n<template>\n  <span class=\"tq-loader\" :class=\"[`tq-loader-${variant}`, { 'tq-loader-sm': size === 'sm' }]\" role=\"status\">\n    <span class=\"pv-visually-hidden\">{{ label }}</span>\n    <span class=\"tq-loader-mark\" aria-hidden=\"true\">\n      <span v-for=\"block in BLOCK_COUNTS[variant]\" :key=\"block\"></span>\n    </span>\n  </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\n\ninterface PvFileInputProps {\n  /** Helper text shown below the input when no file is selected. */\n  helperText?: string;\n  /** Accepted file types, passed through to the native input's accept attribute. */\n  accept?: string;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** When true, allows selecting more than one file at once. */\n  multiple?: boolean;\n  /**\n   * When false, hides the selected file list and remove buttons. Use this\n   * when the parent renders selected files itself, e.g. in a list built\n   * from the `select-file` event.\n   */\n  showSelectedFile?: boolean;\n  /** Visual style of the Choose File button. */\n  confirmButtonVariant?: \"primary\" | \"secondary\";\n  /** Visual style of the remove-file buttons. */\n  destructiveButtonVariant?: \"destructive\" | \"ghost\";\n  /** Background of the input: `primary` is accent, `secondary` is white (for accent surfaces). */\n  variant?: \"primary\" | \"secondary\";\n}\n\nconst props = withDefaults(defineProps<PvFileInputProps>(), {\n  multiple: false,\n  showSelectedFile: true,\n  confirmButtonVariant: \"primary\",\n  destructiveButtonVariant: \"destructive\",\n  variant: \"primary\",\n});\n\nconst emit = defineEmits<{\n  (e: \"select-file\", file: File): void;\n}>();\n\nconst files = defineModel<File[]>({ default: () => [] });\n\nconst inputId = useId();\n\nconst onChange = (event: Event) => {\n  const target = event.target as HTMLInputElement;\n  const selected = Array.from(target.files ?? []);\n  target.value = \"\";\n\n  if (!selected.length) return;\n\n  files.value = [...files.value, ...selected];\n  selected.forEach((selectedFile) => emit(\"select-file\", selectedFile));\n};\n\nconst removeFile = (file: File) => {\n  files.value = files.value.filter((f) => f !== file);\n};\n\nconst summaryText = computed(() => {\n  if (!props.showSelectedFile || files.value.length === 0) return props.helperText;\n  if (files.value.length === 1) return files.value[0].name;\n  return `${files.value.length} files selected`;\n});\n</script>\n\n<template>\n  <div>\n    <div class=\"pv-input-file\" :class=\"{ 'pv-stack-8': showSelectedFile && files.length > 1 }\" :data-variant=\"variant\">\n      <input\n        :id=\"inputId\"\n        type=\"file\"\n        name=\"file\"\n        :accept=\"accept\"\n        :disabled=\"disabled\"\n        :multiple=\"multiple\"\n        @change=\"onChange\"\n      />\n      <label :for=\"inputId\" class=\"pv-label\">\n        <span :class=\"[`pv-button-${confirmButtonVariant}`, 'pv-button-large']\">Choose File</span>\n      </label>\n      <p\n        class=\"pv-text-body-sm\"\n        :class=\"showSelectedFile && files.length ? 'pv-flex-item pv-truncate' : 'pv-text-subdued'\"\n      >\n        {{ summaryText }}\n      </p>\n      <PvButton\n        v-if=\"showSelectedFile && files.length === 1\"\n        left-icon=\"trash\"\n        :variant=\"destructiveButtonVariant\"\n        size=\"md\"\n        aria-label=\"Remove file\"\n        @click=\"removeFile(files[0])\"\n      />\n    </div>\n    <ul v-if=\"showSelectedFile && files.length > 1\" class=\"pv-stack-8\">\n      <li\n        v-for=\"selectedFile in files\"\n        :key=\"selectedFile.name\"\n        class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-space-between pv-inset-square\"\n      >\n        <p class=\"pv-flex-item pv-truncate pv-text-body-sm\">{{ selectedFile.name }}</p>\n        <PvButton\n          left-icon=\"trash\"\n          :variant=\"destructiveButtonVariant\"\n          size=\"md\"\n          aria-label=\"Remove file\"\n          @click=\"removeFile(selectedFile)\"\n        />\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\n\ninterface PvFileInputProps {\n  /** Helper text shown below the input when no file is selected. */\n  helperText?: string;\n  /** Accepted file types, passed through to the native input's accept attribute. */\n  accept?: string;\n  /** When true, the input is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** When true, allows selecting more than one file at once. */\n  multiple?: boolean;\n  /**\n   * When false, hides the selected file list and remove buttons. Use this\n   * when the parent renders selected files itself, e.g. in a list built\n   * from the `select-file` event.\n   */\n  showSelectedFile?: boolean;\n  /** Visual style of the Choose File button. */\n  confirmButtonVariant?: \"primary\" | \"secondary\";\n  /** Visual style of the remove-file buttons. */\n  destructiveButtonVariant?: \"destructive\" | \"ghost\";\n  /** Background of the input: `primary` is accent, `secondary` is white (for accent surfaces). */\n  variant?: \"primary\" | \"secondary\";\n}\n\nconst props = withDefaults(defineProps<PvFileInputProps>(), {\n  multiple: false,\n  showSelectedFile: true,\n  confirmButtonVariant: \"primary\",\n  destructiveButtonVariant: \"destructive\",\n  variant: \"primary\",\n});\n\nconst emit = defineEmits<{\n  (e: \"select-file\", file: File): void;\n}>();\n\nconst files = defineModel<File[]>({ default: () => [] });\n\nconst inputId = useId();\n\nconst onChange = (event: Event) => {\n  const target = event.target as HTMLInputElement;\n  const selected = Array.from(target.files ?? []);\n  target.value = \"\";\n\n  if (!selected.length) return;\n\n  files.value = [...files.value, ...selected];\n  selected.forEach((selectedFile) => emit(\"select-file\", selectedFile));\n};\n\nconst removeFile = (file: File) => {\n  files.value = files.value.filter((f) => f !== file);\n};\n\nconst summaryText = computed(() => {\n  if (!props.showSelectedFile || files.value.length === 0) return props.helperText;\n  if (files.value.length === 1) return files.value[0].name;\n  return `${files.value.length} files selected`;\n});\n</script>\n\n<template>\n  <div>\n    <div class=\"pv-input-file\" :class=\"{ 'pv-stack-8': showSelectedFile && files.length > 1 }\" :data-variant=\"variant\">\n      <input\n        :id=\"inputId\"\n        type=\"file\"\n        name=\"file\"\n        :accept=\"accept\"\n        :disabled=\"disabled\"\n        :multiple=\"multiple\"\n        @change=\"onChange\"\n      />\n      <label :for=\"inputId\" class=\"pv-label\">\n        <span :class=\"[`pv-button-${confirmButtonVariant}`, 'pv-button-large']\">Choose File</span>\n      </label>\n      <p\n        class=\"pv-text-body-sm\"\n        :class=\"showSelectedFile && files.length ? 'pv-flex-item pv-truncate' : 'pv-text-subdued'\"\n      >\n        {{ summaryText }}\n      </p>\n      <PvButton\n        v-if=\"showSelectedFile && files.length === 1\"\n        left-icon=\"trash\"\n        :variant=\"destructiveButtonVariant\"\n        size=\"md\"\n        aria-label=\"Remove file\"\n        @click=\"removeFile(files[0])\"\n      />\n    </div>\n    <ul v-if=\"showSelectedFile && files.length > 1\" class=\"pv-stack-8\">\n      <li\n        v-for=\"selectedFile in files\"\n        :key=\"selectedFile.name\"\n        class=\"pv-full-width pv-bordered pv-radius-md pv-flex pv-space-between pv-inset-square\"\n      >\n        <p class=\"pv-flex-item pv-truncate pv-text-body-sm\">{{ selectedFile.name }}</p>\n        <PvButton\n          left-icon=\"trash\"\n          :variant=\"destructiveButtonVariant\"\n          size=\"md\"\n          aria-label=\"Remove file\"\n          @click=\"removeFile(selectedFile)\"\n        />\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvRatingVariant, PvRatingSize } from \"./types\";\n\ninterface PvRatingProps {\n  /** Display variant: \"dot\" or \"star\" style */\n  variant?: PvRatingVariant;\n  /** Rating value between 0 and 5 */\n  value: number;\n  /** Size of the rating display in pixels */\n  size?: PvRatingSize;\n}\n\nconst props = withDefaults(defineProps<PvRatingProps>(), {\n  variant: \"dot\",\n  size: 20,\n});\n\nconst dataRating = computed(() => {\n  return props.variant === \"dot\" ? \"dot\" : undefined;\n});\n</script>\n\n<template>\n  <div\n    class=\"pv-rating\"\n    data-testid=\"pv-rating\"\n    :style=\"{\n      '--height': `${size}px`,\n    }\"\n    :data-rating=\"dataRating\"\n  >\n    <meter id=\"rating\" min=\"0\" max=\"5\" :value=\"value\">4.0 stars</meter>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvRatingVariant, PvRatingSize } from \"./types\";\n\ninterface PvRatingProps {\n  /** Display variant: \"dot\" or \"star\" style */\n  variant?: PvRatingVariant;\n  /** Rating value between 0 and 5 */\n  value: number;\n  /** Size of the rating display in pixels */\n  size?: PvRatingSize;\n}\n\nconst props = withDefaults(defineProps<PvRatingProps>(), {\n  variant: \"dot\",\n  size: 20,\n});\n\nconst dataRating = computed(() => {\n  return props.variant === \"dot\" ? \"dot\" : undefined;\n});\n</script>\n\n<template>\n  <div\n    class=\"pv-rating\"\n    data-testid=\"pv-rating\"\n    :style=\"{\n      '--height': `${size}px`,\n    }\"\n    :data-rating=\"dataRating\"\n  >\n    <meter id=\"rating\" min=\"0\" max=\"5\" :value=\"value\">4.0 stars</meter>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvCardVariant } from \"./types\";\n\ninterface PvCardProps {\n  /** URL to navigate to when the card is clicked. Renders the card as an anchor element. */\n  href?: string;\n  /** Visual style variant of the card. */\n  variant?: PvCardVariant;\n  /** When true, renders the card as a button element with interactive styling. */\n  interactive?: boolean;\n  /**\n   * Renders the `header` slot as a hover-revealed-action row, paired with the\n   * `header-action` slot. Each row is opted into independently so an unused row\n   * doesn't render an empty slot and leave a gap. Slot presence can't be detected\n   * reliably for the web component build (native light-DOM slotting never\n   * populates Vue's `$slots`), so these are explicit props instead.\n   */\n  headerAction?: boolean;\n  /** Renders the `description` slot as a hover-revealed-action row, paired with the `description-action` slot. */\n  descriptionAction?: boolean;\n  /** Renders the `footer` slot as a hover-revealed-action row, paired with the `footer-action` slot. */\n  footerAction?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCardProps>(), {\n  variant: \"primary\",\n  interactive: false,\n  headerAction: false,\n  descriptionAction: false,\n  footerAction: false,\n});\n\nconst hasHoverActionRows = computed(() => props.headerAction || props.descriptionAction || props.footerAction);\n\nconst componentVariant = computed(() => {\n  return props.href ? \"a\" : props.interactive ? \"button\" : \"div\";\n});\n\n// Only set a `type` attribute when the card renders as a <button>. Anchors and\n// divs don't accept a meaningful `type`, and binding `type=\"div\"` to a <div>\n// produces invalid HTML.\nconst componentType = computed(() => {\n  return !props.href && props.interactive ? \"button\" : undefined;\n});\n\n// `pv-inline-block` shrink-wraps to content, which breaks `pv-truncate` (nowrap\n// text inflates the intrinsic width), so the hover-action layout needs a block\n// flex container instead.\nconst rootClasses = computed(\n  () => `pv-card pv-inset-square-8 ${hasHoverActionRows.value ? \"pv-flex-vertical\" : \"pv-inline-block\"}`,\n);\n</script>\n\n<template>\n  <component\n    :is=\"componentVariant\"\n    :href=\"href\"\n    :type=\"componentType\"\n    :class=\"[\n      rootClasses,\n      {\n        'pv-card-secondary': variant === 'secondary' && !hasHoverActionRows,\n        'pv-card-hover-action': hasHoverActionRows,\n        'pv-card-hover-action-secondary': hasHoverActionRows && variant === 'secondary',\n      },\n    ]\"\n    :style=\"hasHoverActionRows ? { '--flex-align': 'flex-start' } : undefined\"\n    data-testid=\"pv-card\"\n  >\n    <template v-if=\"hasHoverActionRows\">\n      <div v-if=\"headerAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"header\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"header-action\"></slot>\n        </div>\n      </div>\n      <div v-if=\"descriptionAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"description\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"description-action\"></slot>\n        </div>\n      </div>\n      <div v-if=\"footerAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"footer\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"footer-action\"></slot>\n        </div>\n      </div>\n    </template>\n    <slot v-else />\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { PvCardVariant } from \"./types\";\n\ninterface PvCardProps {\n  /** URL to navigate to when the card is clicked. Renders the card as an anchor element. */\n  href?: string;\n  /** Visual style variant of the card. */\n  variant?: PvCardVariant;\n  /** When true, renders the card as a button element with interactive styling. */\n  interactive?: boolean;\n  /**\n   * Renders the `header` slot as a hover-revealed-action row, paired with the\n   * `header-action` slot. Each row is opted into independently so an unused row\n   * doesn't render an empty slot and leave a gap. Slot presence can't be detected\n   * reliably for the web component build (native light-DOM slotting never\n   * populates Vue's `$slots`), so these are explicit props instead.\n   */\n  headerAction?: boolean;\n  /** Renders the `description` slot as a hover-revealed-action row, paired with the `description-action` slot. */\n  descriptionAction?: boolean;\n  /** Renders the `footer` slot as a hover-revealed-action row, paired with the `footer-action` slot. */\n  footerAction?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCardProps>(), {\n  variant: \"primary\",\n  interactive: false,\n  headerAction: false,\n  descriptionAction: false,\n  footerAction: false,\n});\n\nconst hasHoverActionRows = computed(() => props.headerAction || props.descriptionAction || props.footerAction);\n\nconst componentVariant = computed(() => {\n  return props.href ? \"a\" : props.interactive ? \"button\" : \"div\";\n});\n\n// Only set a `type` attribute when the card renders as a <button>. Anchors and\n// divs don't accept a meaningful `type`, and binding `type=\"div\"` to a <div>\n// produces invalid HTML.\nconst componentType = computed(() => {\n  return !props.href && props.interactive ? \"button\" : undefined;\n});\n\n// `pv-inline-block` shrink-wraps to content, which breaks `pv-truncate` (nowrap\n// text inflates the intrinsic width), so the hover-action layout needs a block\n// flex container instead.\nconst rootClasses = computed(\n  () => `pv-card pv-inset-square-8 ${hasHoverActionRows.value ? \"pv-flex-vertical\" : \"pv-inline-block\"}`,\n);\n</script>\n\n<template>\n  <component\n    :is=\"componentVariant\"\n    :href=\"href\"\n    :type=\"componentType\"\n    :class=\"[\n      rootClasses,\n      {\n        'pv-card-secondary': variant === 'secondary' && !hasHoverActionRows,\n        'pv-card-hover-action': hasHoverActionRows,\n        'pv-card-hover-action-secondary': hasHoverActionRows && variant === 'secondary',\n      },\n    ]\"\n    :style=\"hasHoverActionRows ? { '--flex-align': 'flex-start' } : undefined\"\n    data-testid=\"pv-card\"\n  >\n    <template v-if=\"hasHoverActionRows\">\n      <div v-if=\"headerAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"header\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"header-action\"></slot>\n        </div>\n      </div>\n      <div v-if=\"descriptionAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"description\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"description-action\"></slot>\n        </div>\n      </div>\n      <div v-if=\"footerAction\" class=\"pv-flex pv-full-width\">\n        <div class=\"pv-flex-item pv-truncate\">\n          <slot name=\"footer\"></slot>\n        </div>\n        <div class=\"pv-card-hover-action__action pv-flex\">\n          <slot name=\"footer-action\"></slot>\n        </div>\n      </div>\n    </template>\n    <slot v-else />\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport PvCard from \"../PvCard/PvCard.vue\";\n</script>\n\n<template>\n  <PvCard class=\"pv-inset-square-16\">\n    <slot />\n  </PvCard>\n</template>\n","<script setup lang=\"ts\">\nimport PvCard from \"../PvCard/PvCard.vue\";\n</script>\n\n<template>\n  <PvCard class=\"pv-inset-square-16\">\n    <slot />\n  </PvCard>\n</template>\n","<script setup lang=\"ts\">\nimport PvCard from \"../PvCard/PvCard.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { computed } from \"vue\";\n\nexport interface PvInsightCardProps {\n  /** Name of the icon displayed beside the insight text. */\n  icon: string;\n  /** Short insight label displayed next to the icon. */\n  insight: string;\n  /** Optional label displayed above the title in a smaller, tertiary style. */\n  upperLabel?: string;\n  /** Main heading text of the insight card. */\n  title?: string;\n  /** Descriptive text displayed below the title. */\n  description?: string;\n  /** When true, shows a \"new-tab\" icon button in the top-right corner. */\n  showButton?: boolean;\n  /** When true, the card is rendered as an interactive (clickable) element. */\n  interactive?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvInsightCardProps>(), {\n  icon: \"ai\",\n  showButton: false,\n  interactive: false,\n});\n\ndefineEmits<{\n  (e: \"click\"): void;\n  (e: \"icon-click\"): void;\n}>();\n\nconst displayIconLevel = computed(() => {\n  return props.icon || props.insight;\n});\n</script>\n\n<template>\n  <PvCard variant=\"secondary\" :interactive=\"interactive\" @click=\"$emit('click')\" class=\"pv-relative\">\n    <div class=\"pv-flex-vertical\" style=\"--flex-align: flex-start; --flex-gap: 0.25rem\">\n      <div v-if=\"displayIconLevel\" class=\"pv-flex\" style=\"--flex-gap: 0.25rem\">\n        <PvIcon v-if=\"icon\" style=\"color: #218c88\" :name=\"icon\" :size=\"12\" />\n        <span class=\"pv-text-body-sm\">{{ insight }}</span>\n      </div>\n      <span v-if=\"upperLabel\" class=\"pv-text-body-sm pv-text-tertiary\">{{ upperLabel }}</span>\n      <span v-if=\"title\" class=\"pv-heading-2\">{{ title }}</span>\n      <span v-if=\"description\" class=\"pv-text-body-md pv-text-secondary pv-text-subdued\">{{ description }}</span>\n    </div>\n    <PvButton\n      v-if=\"showButton\"\n      left-icon=\"new-tab\"\n      ariaLabel=\"Open in new tab\"\n      variant=\"ghost\"\n      size=\"md\"\n      class=\"pv-insight-button\"\n      @click.stop=\"$emit('icon-click')\"\n    />\n  </PvCard>\n</template>\n\n<style scoped>\n.pv-insight-button {\n  position: absolute;\n  top: 0.5rem;\n  right: 0.5rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport PvCard from \"../PvCard/PvCard.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { computed } from \"vue\";\n\nexport interface PvInsightCardProps {\n  /** Name of the icon displayed beside the insight text. */\n  icon: string;\n  /** Short insight label displayed next to the icon. */\n  insight: string;\n  /** Optional label displayed above the title in a smaller, tertiary style. */\n  upperLabel?: string;\n  /** Main heading text of the insight card. */\n  title?: string;\n  /** Descriptive text displayed below the title. */\n  description?: string;\n  /** When true, shows a \"new-tab\" icon button in the top-right corner. */\n  showButton?: boolean;\n  /** When true, the card is rendered as an interactive (clickable) element. */\n  interactive?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvInsightCardProps>(), {\n  icon: \"ai\",\n  showButton: false,\n  interactive: false,\n});\n\ndefineEmits<{\n  (e: \"click\"): void;\n  (e: \"icon-click\"): void;\n}>();\n\nconst displayIconLevel = computed(() => {\n  return props.icon || props.insight;\n});\n</script>\n\n<template>\n  <PvCard variant=\"secondary\" :interactive=\"interactive\" @click=\"$emit('click')\" class=\"pv-relative\">\n    <div class=\"pv-flex-vertical\" style=\"--flex-align: flex-start; --flex-gap: 0.25rem\">\n      <div v-if=\"displayIconLevel\" class=\"pv-flex\" style=\"--flex-gap: 0.25rem\">\n        <PvIcon v-if=\"icon\" style=\"color: #218c88\" :name=\"icon\" :size=\"12\" />\n        <span class=\"pv-text-body-sm\">{{ insight }}</span>\n      </div>\n      <span v-if=\"upperLabel\" class=\"pv-text-body-sm pv-text-tertiary\">{{ upperLabel }}</span>\n      <span v-if=\"title\" class=\"pv-heading-2\">{{ title }}</span>\n      <span v-if=\"description\" class=\"pv-text-body-md pv-text-secondary pv-text-subdued\">{{ description }}</span>\n    </div>\n    <PvButton\n      v-if=\"showButton\"\n      left-icon=\"new-tab\"\n      ariaLabel=\"Open in new tab\"\n      variant=\"ghost\"\n      size=\"md\"\n      class=\"pv-insight-button\"\n      @click.stop=\"$emit('icon-click')\"\n    />\n  </PvCard>\n</template>\n\n<style scoped>\n.pv-insight-button {\n  position: absolute;\n  top: 0.5rem;\n  right: 0.5rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, computed, onMounted, watch } from \"vue\";\nimport { useMutationObserver, useResizeObserver } from \"@vueuse/core\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { PvExpandableContentSizes, PvExpandableContentVariants } from \"./types\";\n\nconst sizeMap: Record<PvExpandableContentSizes, string> = {\n  none: \"0\",\n  xs: \"4px\",\n  sm: \"8px\",\n  md: \"12px\",\n  lg: \"16px\",\n};\n\nconst props = withDefaults(\n  defineProps<{\n    /** Maximum number of visible lines before content is clamped. */\n    lines?: number;\n    /** Padding size applied to the container. */\n    size?: PvExpandableContentSizes;\n    /** Visual style variant. \"ghost\" applies an accent surface background. */\n    variant?: PvExpandableContentVariants;\n    /** When true, the content starts in the expanded state. */\n    defaultOpen?: boolean;\n  }>(),\n  {\n    lines: 4,\n    size: \"md\",\n    variant: \"primary\",\n    defaultOpen: false,\n  },\n);\n\nconst contentRef = ref<HTMLElement | null>(null);\nconst isExpanded = ref(props.defaultOpen);\n// Assume the content overflows until we have measured it, so the toggle is\n// never missing while the content is still clamped.\nconst isOverflowing = ref(true);\n\nconst toggleExpanded = () => {\n  isExpanded.value = !isExpanded.value;\n};\n\n/**\n * Decides whether the toggle is needed by comparing the full content height\n * against the height of the collapsed state. `scrollHeight` reports the\n * unclamped content height in both the collapsed and expanded states, so this\n * stays accurate without having to unclamp the element to measure it.\n *\n * Anything we cannot measure leaves the previous answer in place, which keeps\n * the toggle rendered so the full content is never unreachable.\n */\nconst measureOverflow = () => {\n  const element = contentRef.value;\n  if (!element) return;\n\n  // No layout box at all: detached, `display: none`, or no layout engine.\n  if (element.offsetWidth === 0 && element.scrollHeight === 0) return;\n\n  // `normal` has no numeric computed value to build a threshold from.\n  const lineHeight = Number.parseFloat(window.getComputedStyle(element).lineHeight);\n  if (!Number.isFinite(lineHeight) || lineHeight <= 0) return;\n\n  isOverflowing.value = element.scrollHeight > lineHeight * props.lines + 1;\n};\n\nonMounted(() => {\n  measureOverflow();\n  // Web fonts change the text metrics after the first measurement.\n  document.fonts?.ready.then(measureOverflow);\n});\n\nwatch(() => props.lines, measureOverflow);\nuseResizeObserver(contentRef, measureOverflow);\nuseMutationObserver(contentRef, measureOverflow, {\n  characterData: true,\n  childList: true,\n  subtree: true,\n});\n\nconst isClamped = computed(() => isOverflowing.value && !isExpanded.value);\n\nconst contentStyle = computed(() => ({\n  \"--lines\": isClamped.value ? props.lines : \"none\",\n  // `1lh` is exactly one line box, so the clamp height always lands on a line\n  // boundary regardless of the theme's line-height token.\n  \"max-height\": isClamped.value ? `calc(${props.lines} * 1lh)` : \"100vh\",\n}));\n</script>\n\n<template>\n  <div\n    :class=\"[\n      'pv-inset-square expandable-content',\n      {\n        'pv-surface-accent': variant === 'ghost',\n      },\n    ]\"\n    :style=\"{ '--inset-size': sizeMap[size] }\"\n  >\n    <p\n      ref=\"contentRef\"\n      :class=\"['pv-line-clamp pv-text-body-md', { 'pv-stack-8': isOverflowing }]\"\n      :style=\"contentStyle\"\n    >\n      <slot />\n    </p>\n    <PvButton\n      v-if=\"isOverflowing\"\n      :label=\"isExpanded ? 'Show Less' : 'Show More'\"\n      variant=\"ghost\"\n      size=\"md\"\n      @click=\"toggleExpanded\"\n      :left-icon=\"isExpanded ? 'chevron-up' : 'chevron-down'\"\n    />\n  </div>\n</template>\n\n<style scoped>\n.expandable-content {\n  border-radius: 0.5rem;\n}\n\n.expandable-content .pv-line-clamp {\n  transition: max-height 0.3s ease-in-out;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, computed, onMounted, watch } from \"vue\";\nimport { useMutationObserver, useResizeObserver } from \"@vueuse/core\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport { PvExpandableContentSizes, PvExpandableContentVariants } from \"./types\";\n\nconst sizeMap: Record<PvExpandableContentSizes, string> = {\n  none: \"0\",\n  xs: \"4px\",\n  sm: \"8px\",\n  md: \"12px\",\n  lg: \"16px\",\n};\n\nconst props = withDefaults(\n  defineProps<{\n    /** Maximum number of visible lines before content is clamped. */\n    lines?: number;\n    /** Padding size applied to the container. */\n    size?: PvExpandableContentSizes;\n    /** Visual style variant. \"ghost\" applies an accent surface background. */\n    variant?: PvExpandableContentVariants;\n    /** When true, the content starts in the expanded state. */\n    defaultOpen?: boolean;\n  }>(),\n  {\n    lines: 4,\n    size: \"md\",\n    variant: \"primary\",\n    defaultOpen: false,\n  },\n);\n\nconst contentRef = ref<HTMLElement | null>(null);\nconst isExpanded = ref(props.defaultOpen);\n// Assume the content overflows until we have measured it, so the toggle is\n// never missing while the content is still clamped.\nconst isOverflowing = ref(true);\n\nconst toggleExpanded = () => {\n  isExpanded.value = !isExpanded.value;\n};\n\n/**\n * Decides whether the toggle is needed by comparing the full content height\n * against the height of the collapsed state. `scrollHeight` reports the\n * unclamped content height in both the collapsed and expanded states, so this\n * stays accurate without having to unclamp the element to measure it.\n *\n * Anything we cannot measure leaves the previous answer in place, which keeps\n * the toggle rendered so the full content is never unreachable.\n */\nconst measureOverflow = () => {\n  const element = contentRef.value;\n  if (!element) return;\n\n  // No layout box at all: detached, `display: none`, or no layout engine.\n  if (element.offsetWidth === 0 && element.scrollHeight === 0) return;\n\n  // `normal` has no numeric computed value to build a threshold from.\n  const lineHeight = Number.parseFloat(window.getComputedStyle(element).lineHeight);\n  if (!Number.isFinite(lineHeight) || lineHeight <= 0) return;\n\n  isOverflowing.value = element.scrollHeight > lineHeight * props.lines + 1;\n};\n\nonMounted(() => {\n  measureOverflow();\n  // Web fonts change the text metrics after the first measurement.\n  document.fonts?.ready.then(measureOverflow);\n});\n\nwatch(() => props.lines, measureOverflow);\nuseResizeObserver(contentRef, measureOverflow);\nuseMutationObserver(contentRef, measureOverflow, {\n  characterData: true,\n  childList: true,\n  subtree: true,\n});\n\nconst isClamped = computed(() => isOverflowing.value && !isExpanded.value);\n\nconst contentStyle = computed(() => ({\n  \"--lines\": isClamped.value ? props.lines : \"none\",\n  // `1lh` is exactly one line box, so the clamp height always lands on a line\n  // boundary regardless of the theme's line-height token.\n  \"max-height\": isClamped.value ? `calc(${props.lines} * 1lh)` : \"100vh\",\n}));\n</script>\n\n<template>\n  <div\n    :class=\"[\n      'pv-inset-square expandable-content',\n      {\n        'pv-surface-accent': variant === 'ghost',\n      },\n    ]\"\n    :style=\"{ '--inset-size': sizeMap[size] }\"\n  >\n    <p\n      ref=\"contentRef\"\n      :class=\"['pv-line-clamp pv-text-body-md', { 'pv-stack-8': isOverflowing }]\"\n      :style=\"contentStyle\"\n    >\n      <slot />\n    </p>\n    <PvButton\n      v-if=\"isOverflowing\"\n      :label=\"isExpanded ? 'Show Less' : 'Show More'\"\n      variant=\"ghost\"\n      size=\"md\"\n      @click=\"toggleExpanded\"\n      :left-icon=\"isExpanded ? 'chevron-up' : 'chevron-down'\"\n    />\n  </div>\n</template>\n\n<style scoped>\n.expandable-content {\n  border-radius: 0.5rem;\n}\n\n.expandable-content .pv-line-clamp {\n  transition: max-height 0.3s ease-in-out;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { PvActionBarTheme } from \"./types\";\n\ninterface PvActionBarProps {\n  /** Visual theme of the action bar. Use \"dark\" on light backgrounds for contrast.\n   * When using \"dark\", set the `inverse` prop on child components that support it. */\n  variant?: PvActionBarTheme;\n}\n\nwithDefaults(defineProps<PvActionBarProps>(), {\n  variant: \"white\",\n});\n\ndefineSlots<{\n  /**\n   * Default slot for action bar content.\n   * sections are divided by the root elements inside the slot.\n   */\n  default(): never;\n}>();\n</script>\n\n<template>\n  <div class=\"pv-action-bar-container\" :data-style=\"variant === 'white' ? 'white' : undefined\">\n    <slot name=\"default\" />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvActionBarTheme } from \"./types\";\n\ninterface PvActionBarProps {\n  /** Visual theme of the action bar. Use \"dark\" on light backgrounds for contrast.\n   * When using \"dark\", set the `inverse` prop on child components that support it. */\n  variant?: PvActionBarTheme;\n}\n\nwithDefaults(defineProps<PvActionBarProps>(), {\n  variant: \"white\",\n});\n\ndefineSlots<{\n  /**\n   * Default slot for action bar content.\n   * sections are divided by the root elements inside the slot.\n   */\n  default(): never;\n}>();\n</script>\n\n<template>\n  <div class=\"pv-action-bar-container\" :data-style=\"variant === 'white' ? 'white' : undefined\">\n    <slot name=\"default\" />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\n\ninterface PvSimpleItemTreeProps {\n  label: string;\n  icon?: string;\n}\n\ndefineProps<PvSimpleItemTreeProps>();\n</script>\n\n<template>\n  <div class=\"pv-flex pv-truncate\" style=\"min-width: 0; min-height: 20px\">\n    <PvIcon v-if=\"icon\" :name=\"icon\" />\n    <span class=\"pv-text-body-md pv-truncate\" style=\"font-weight: 500; min-width: 0\" :title=\"label\">{{ label }}</span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\n\ninterface PvSimpleItemTreeProps {\n  label: string;\n  icon?: string;\n}\n\ndefineProps<PvSimpleItemTreeProps>();\n</script>\n\n<template>\n  <div class=\"pv-flex pv-truncate\" style=\"min-width: 0; min-height: 20px\">\n    <PvIcon v-if=\"icon\" :name=\"icon\" />\n    <span class=\"pv-text-body-md pv-truncate\" style=\"font-weight: 500; min-width: 0\" :title=\"label\">{{ label }}</span>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\n</script>\n\n<template>\n  <PvIcon name=\"reorder\" class=\"pv-tree-reorder-icon pv-text-tertiary\" />\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\n</script>\n\n<template>\n  <PvIcon name=\"reorder\" class=\"pv-tree-reorder-icon pv-text-tertiary\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { PvTreeOption } from \"./types\";\n\ninterface PvButtonTreeItemProps {\n  selected?: boolean;\n  option: PvTreeOption;\n  disableSelection?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvButtonTreeItemProps>(), {\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n}>();\n\n// Shift-click selects a range of rows; without this the browser also extends a text selection over them.\nconst preventShiftTextSelection = (event: MouseEvent) => {\n  if (event.shiftKey && !props.disableSelection) event.preventDefault();\n};\n\nconst handleTreeSelect = (event: MouseEvent) => {\n  if (props.disableSelection) return;\n  emit(\"handle-selected\", { option: props.option, event });\n};\n\nconst componentInstance = computed(() => {\n  return props.disableSelection ? \"button\" : \"div\";\n});\n</script>\n\n<template>\n  <component\n    :is=\"componentInstance\"\n    :class=\"[\n      'pv-full-width',\n      'pv-flex',\n      'pv-relative',\n      'pv-tree-item',\n      { 'pv-tree-item-selected': selected, 'pv-tree-item-disabled': disableSelection },\n    ]\"\n    :data-pv-tree-select-id=\"disableSelection ? undefined : option.node_id\"\n    @mousedown=\"preventShiftTextSelection\"\n    @click=\"handleTreeSelect\"\n  >\n    <slot />\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { PvTreeOption } from \"./types\";\n\ninterface PvButtonTreeItemProps {\n  selected?: boolean;\n  option: PvTreeOption;\n  disableSelection?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvButtonTreeItemProps>(), {\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n}>();\n\n// Shift-click selects a range of rows; without this the browser also extends a text selection over them.\nconst preventShiftTextSelection = (event: MouseEvent) => {\n  if (event.shiftKey && !props.disableSelection) event.preventDefault();\n};\n\nconst handleTreeSelect = (event: MouseEvent) => {\n  if (props.disableSelection) return;\n  emit(\"handle-selected\", { option: props.option, event });\n};\n\nconst componentInstance = computed(() => {\n  return props.disableSelection ? \"button\" : \"div\";\n});\n</script>\n\n<template>\n  <component\n    :is=\"componentInstance\"\n    :class=\"[\n      'pv-full-width',\n      'pv-flex',\n      'pv-relative',\n      'pv-tree-item',\n      { 'pv-tree-item-selected': selected, 'pv-tree-item-disabled': disableSelection },\n    ]\"\n    :data-pv-tree-select-id=\"disableSelection ? undefined : option.node_id\"\n    @mousedown=\"preventShiftTextSelection\"\n    @click=\"handleTreeSelect\"\n  >\n    <slot />\n  </component>\n</template>\n","<script setup lang=\"ts\">\nimport PvCheckbox from \"../PvCheckbox/PvCheckbox.vue\";\nimport type { PvTreeOption } from \"./types\";\n\ninterface PvCheckboxTreeItemProps {\n  selected?: boolean;\n  option: PvTreeOption;\n  disableSelection?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCheckboxTreeItemProps>(), {\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n}>();\n\nconst handleSelected = (event: MouseEvent) => {\n  if (props.disableSelection) return;\n  emit(\"handle-selected\", { option: props.option, event });\n};\n</script>\n\n<template>\n  <label\n    :class=\"[\n      'pv-relative',\n      'pv-label',\n      'pv-label-hover',\n      'pv-flex',\n      'pv-tree-item',\n      'pv-full-width',\n      { 'pv-tree-item-selected': selected, 'pv-tree-item-disabled': disableSelection },\n    ]\"\n    :data-pv-tree-select-id=\"disableSelection ? undefined : option.node_id\"\n  >\n    <PvCheckbox v-if=\"!disableSelection\" :checked=\"selected\" @click=\"handleSelected\" />\n    <slot />\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport PvCheckbox from \"../PvCheckbox/PvCheckbox.vue\";\nimport type { PvTreeOption } from \"./types\";\n\ninterface PvCheckboxTreeItemProps {\n  selected?: boolean;\n  option: PvTreeOption;\n  disableSelection?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvCheckboxTreeItemProps>(), {\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-selected\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n}>();\n\nconst handleSelected = (event: MouseEvent) => {\n  if (props.disableSelection) return;\n  emit(\"handle-selected\", { option: props.option, event });\n};\n</script>\n\n<template>\n  <label\n    :class=\"[\n      'pv-relative',\n      'pv-label',\n      'pv-label-hover',\n      'pv-flex',\n      'pv-tree-item',\n      'pv-full-width',\n      { 'pv-tree-item-selected': selected, 'pv-tree-item-disabled': disableSelection },\n    ]\"\n    :data-pv-tree-select-id=\"disableSelection ? undefined : option.node_id\"\n  >\n    <PvCheckbox v-if=\"!disableSelection\" :checked=\"selected\" @click=\"handleSelected\" />\n    <slot />\n  </label>\n</template>\n","<script setup lang=\"ts\">\ninterface PvTreeConnectorProps {\n  /** Last sibling of its group; closes the branch instead of continuing it */\n  isLast?: boolean;\n}\n\ndefineProps<PvTreeConnectorProps>();\n</script>\n\n<template>\n  <div :class=\"isLast ? 'pv-tree-connector-end' : 'pv-tree-connector-middle'\" />\n</template>\n","<script setup lang=\"ts\">\ninterface PvTreeConnectorProps {\n  /** Last sibling of its group; closes the branch instead of continuing it */\n  isLast?: boolean;\n}\n\ndefineProps<PvTreeConnectorProps>();\n</script>\n\n<template>\n  <div :class=\"isLast ? 'pv-tree-connector-end' : 'pv-tree-connector-middle'\" />\n</template>\n","import { TREE_CONNECTOR_OFFSET_PX, TREE_INDENT_PX } from \"../constants\";\nimport type { PvTreeSettings } from \"../types\";\n\ninterface ChildLevelParams {\n  /** Level of the row the children hang from */\n  level: number;\n  /** Whether that row draws a connector glyph of its own */\n  showNestedTree: boolean;\n  /** Whether the children draw connector glyphs */\n  childrenShowNestedTree: boolean;\n  additionalNestingLevel?: number;\n}\n\nexport const useTreeIndentation = () => {\n  const indentPadding = (level: number, additionalNestingLevel = 0) => {\n    return `${(level + additionalNestingLevel) * TREE_INDENT_PX}px`;\n  };\n\n  const connectorOffset = (level: number) => {\n    return `${level * TREE_INDENT_PX + TREE_CONNECTOR_OFFSET_PX}px`;\n  };\n\n  /** A row draws a connector glyph when the field it is nested under enables showNestedTree */\n  const showsConnector = (settings: PvTreeSettings, parentField?: string) => {\n    return Boolean(parentField && settings[parentField]?.showNestedTree);\n  };\n\n  /** The children of an option draw connector glyphs when that option enables showNestedTree */\n  const showsChildConnectors = (settings: PvTreeSettings, field: string) => {\n    return Boolean(settings[field]?.showNestedTree);\n  };\n\n  /**\n   * A connector glyph occupies a column of its own, so drawing one is itself an indent step.\n   * Children therefore skip the padding step only when their glyph can supply it: they draw a\n   * glyph and the row they hang from is not already sitting in the glyph column itself.\n   */\n  const childLevel = ({\n    level,\n    showNestedTree,\n    childrenShowNestedTree,\n    additionalNestingLevel = 0,\n  }: ChildLevelParams) => {\n    const glyphSuppliesStep = childrenShowNestedTree && !showNestedTree;\n    return level + (glyphSuppliesStep ? 0 : 1) + additionalNestingLevel;\n  };\n\n  return { indentPadding, connectorOffset, showsConnector, showsChildConnectors, childLevel };\n};\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvTreeConnectorGroupProps {\n  /** Draw the vertical line that carries past this row and its children to the next sibling */\n  active?: boolean;\n  /** Indent depth of the row, used to line the vertical up with the row's connector glyph */\n  level: number;\n}\n\nconst props = defineProps<PvTreeConnectorGroupProps>();\n\nconst { connectorOffset } = useTreeIndentation();\n\nconst connectorStyles = computed(() => {\n  return props.active ? { \"--tree-connector-left\": connectorOffset(props.level) } : {};\n});\n</script>\n\n<template>\n  <div :class=\"{ 'pv-tree-connector-line': active }\" :style=\"connectorStyles\">\n    <slot />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvTreeConnectorGroupProps {\n  /** Draw the vertical line that carries past this row and its children to the next sibling */\n  active?: boolean;\n  /** Indent depth of the row, used to line the vertical up with the row's connector glyph */\n  level: number;\n}\n\nconst props = defineProps<PvTreeConnectorGroupProps>();\n\nconst { connectorOffset } = useTreeIndentation();\n\nconst connectorStyles = computed(() => {\n  return props.active ? { \"--tree-connector-left\": connectorOffset(props.level) } : {};\n});\n</script>\n\n<template>\n  <div :class=\"{ 'pv-tree-connector-line': active }\" :style=\"connectorStyles\">\n    <slot />\n  </div>\n</template>\n","import { ref } from \"vue\";\n\nexport const useHoverIcon = () => {\n  const hoveredId = ref<number | string | null>(null);\n\n  const handleMouseEnter = (id: number | string) => {\n    hoveredId.value = id;\n  };\n\n  const handleMouseLeave = () => {\n    hoveredId.value = null;\n  };\n\n  return {\n    hoveredId,\n    handleMouseEnter,\n    handleMouseLeave,\n  };\n};\n","import { InjectionKey, Ref } from \"vue\";\n\nexport type DraggingState = Ref<boolean>;\nexport const DraggingStateKey: InjectionKey<DraggingState> = Symbol(\"DraggingStateKey\");\n\nexport type DraggingGroupName = Ref<string | null>;\nexport const DraggingGroupNameKey: InjectionKey<DraggingGroupName> = Symbol(\"DraggingGroupNameKey\");\n\nexport type DropIndicatorType = {\n  parentId?: string | number;\n  siblingTargetId?: string | number;\n  siblingInsertAfter?: boolean;\n};\nexport type DropIndicator = Ref<DropIndicatorType | null>;\nexport const DropIndicatorKey: InjectionKey<DropIndicator> = Symbol(\"DropIndicatorKey\");\n","import { ref, provide, inject, getCurrentScope, onScopeDispose } from \"vue\";\nimport { DraggingStateKey, DraggingGroupNameKey, DropIndicatorKey, DropIndicatorType } from \"../symbols\";\n\n/**\n * Provides dragging state to the tree component hierarchy.\n * Called by PvTreeGroup (for cross-tree sharing) or by PvTree itself as a fallback (standalone use).\n */\nexport const provideDraggingState = () => {\n  const isDragging = ref(false);\n  const draggingGroupName = ref<string | null>(null);\n  const dropIndicator = ref<DropIndicatorType | null>(null);\n\n  provide(DraggingStateKey, isDragging);\n  provide(DraggingGroupNameKey, draggingGroupName);\n  provide(DropIndicatorKey, dropIndicator);\n\n  // Sortable's `end` (and so `onDragEnd`) is not guaranteed: a host that stops a `drop` from\n  // propagating keeps it from Sortable's document listener, and the browser skips `dragend` when\n  // the dragged element left the DOM mid-drag (e.g. the host re-rendered it into another list).\n  // Either way the indicator classes would stick, so any native drop or dragend ends the drag too.\n  // Capture on window runs before any element's listener can stop it.\n  const resetDragState = () => {\n    isDragging.value = false;\n    draggingGroupName.value = null;\n    dropIndicator.value = null;\n  };\n  if (typeof window !== \"undefined\") {\n    window.addEventListener(\"drop\", resetDragState, true);\n    window.addEventListener(\"dragend\", resetDragState, true);\n    if (getCurrentScope()) {\n      onScopeDispose(() => {\n        window.removeEventListener(\"drop\", resetDragState, true);\n        window.removeEventListener(\"dragend\", resetDragState, true);\n      });\n    }\n  }\n\n  return {\n    isDragging,\n    draggingGroupName,\n    dropIndicator,\n  };\n};\n\n/**\n * Injects dragging state from the nearest PvTreeGroup or PvTree ancestor.\n * Should be called in PvTreeItem and PvSimpleNestedTree components.\n */\nexport const useDraggingState = () => {\n  const isDragging = inject(DraggingStateKey, ref(false));\n  const draggingGroupName = inject(DraggingGroupNameKey, ref<string | null>(null));\n  const dropIndicator = inject(DropIndicatorKey, ref<DropIndicatorType | null>(null));\n\n  const onDragStart = (groupName?: string) => {\n    isDragging.value = true;\n    draggingGroupName.value = groupName ?? null;\n  };\n\n  const onDragEnd = () => {\n    isDragging.value = false;\n    draggingGroupName.value = null;\n    clearDropIndicator();\n  };\n\n  const setDropIndicator = ({ parentId, siblingTargetId, siblingInsertAfter }: DropIndicatorType) => {\n    dropIndicator.value = { parentId, siblingTargetId, siblingInsertAfter };\n  };\n\n  const clearDropIndicator = () => {\n    dropIndicator.value = null;\n  };\n\n  return {\n    isDragging,\n    draggingGroupName,\n    dropIndicator,\n    setDropIndicator,\n    clearDropIndicator,\n    onDragStart,\n    onDragEnd,\n  };\n};\n","import { PvTreeOption, PvTreeSettings } from \"../types\";\nimport { useDraggingState } from \"./useDraggingState\";\n\nexport const useDragAndDrop = () => {\n  const { setDropIndicator, clearDropIndicator } = useDraggingState();\n  const getDragGroupConfig = (settings: PvTreeSettings, option: PvTreeOption) => {\n    const fieldSetting = settings[option.field];\n    const dragGroup = fieldSetting?.dragAndDropConfig;\n\n    return {\n      // Use a single shared group name by default to allow drag between all tree levels\n      name: dragGroup?.name ?? \"pv-tree\",\n      pull: dragGroup?.pull ?? true,\n      put: dragGroup?.put ?? true,\n    };\n  };\n\n  const getDragAndDropDisabled = (isDraggable: boolean | undefined, settings: PvTreeSettings, option: PvTreeOption) => {\n    return !isDraggable || settings[option.field]?.dragAndDropConfig?.disableChildrenDrag;\n  };\n\n  /**\n   * Returns true if an item can be dragged (for showing the reorder icon).\n   * Checks: isDraggable is true, disabled is not set, and preventDrag is not set.\n   */\n  const canItemBeDragged = (isDraggable: boolean | undefined, settings: PvTreeSettings, option: PvTreeOption) => {\n    const config = settings[option.field]?.dragAndDropConfig;\n    return isDraggable && !config?.disableChildrenDrag && !config?.disableDrag;\n  };\n\n  /**\n   * Vuedraggable move callback to prevent specific items from being dragged.\n   * Returns false to cancel the drag, true to allow it.\n   */\n  const handleMoveCallback = (settings: PvTreeSettings) => {\n    return (evt: {\n      to: HTMLElement;\n      draggedContext: { element: PvTreeOption; futureIndex: number };\n      relatedContext: { element: PvTreeOption };\n      willInsertAfter: boolean;\n    }) => {\n      const draggedOption = evt.draggedContext.element;\n      const fieldSetting = settings[draggedOption.field];\n\n      const toParentId =\n        (evt.to as HTMLElement)?.closest?.(\"[data-parent-id]\")?.getAttribute(\"data-parent-id\") ?? undefined;\n\n      if (toParentId != null) {\n        const hasRelated = evt.relatedContext?.element?.node_id != null;\n        const isInsertAsFirstChild = evt.draggedContext.futureIndex === 0;\n\n        setDropIndicator({\n          parentId: toParentId,\n          ...(hasRelated && !isInsertAsFirstChild\n            ? {\n                siblingTargetId: evt.relatedContext.element.node_id,\n                siblingInsertAfter: evt.willInsertAfter,\n              }\n            : {}),\n        });\n      } else {\n        clearDropIndicator();\n      }\n\n      if (fieldSetting?.dragAndDropConfig?.disableDrag) {\n        return false;\n      }\n      return true;\n    };\n  };\n\n  const childrenDraggable = (isDraggable: boolean | undefined, settings: PvTreeSettings, option: PvTreeOption) => {\n    return isDraggable && !settings[option.field]?.dragAndDropConfig?.disableChildrenDrag;\n  };\n\n  /**\n   * Returns true if the drop zone should be shown for this option.\n   * Checks `put` configuration against the dragging group name.\n   *\n   * @param settings - Tree settings\n   * @param option - The option where we want to drop\n   * @param draggingGroupName - The group name of the element being dragged (null if not dragging)\n   *\n   * Logic:\n   * - put: false → never accept drops\n   * - put: true → accept from any group\n   * - put: ['group1', 'group2'] → accept only from specified groups\n   * - put: undefined → accept only from same group (by name)\n   */\n  const canAcceptDrop = (settings: PvTreeSettings, option: PvTreeOption, draggingGroupName: string | null) => {\n    const config = settings[option.field]?.dragAndDropConfig;\n    const put = config?.put;\n\n    // If put is explicitly false, never accept drops\n    if (put === false) {\n      return false;\n    }\n\n    // If put is explicitly true, accept from any group\n    if (put === true) {\n      return true;\n    }\n\n    // If not dragging yet, allow (will be filtered by isDragging anyway)\n    if (!draggingGroupName) {\n      return true;\n    }\n\n    // If put is an array, check if dragging group is in the allowed list\n    if (Array.isArray(put)) {\n      return put.includes(draggingGroupName);\n    }\n\n    // Default: accept only from same group (by name)\n    const targetGroupName = config?.name ?? \"pv-tree\";\n    return targetGroupName === draggingGroupName;\n  };\n\n  return {\n    getDragGroupConfig,\n    getDragAndDropDisabled,\n    canItemBeDragged,\n    handleMoveCallback,\n    childrenDraggable,\n    canAcceptDrop,\n  };\n};\n","import { useDraggingState } from \"./useDraggingState\";\nimport type { PvTreeOption } from \"../types\";\n\nexport const useDragAndDropIndicator = () => {\n  const { dropIndicator } = useDraggingState();\n\n  const dragAndDropIndicatorClasses = (option: PvTreeOption) => {\n    const indicator = dropIndicator.value;\n    const hasSiblingTarget = indicator?.siblingTargetId !== undefined && indicator?.siblingTargetId !== null;\n    const isSiblingTarget = hasSiblingTarget && indicator?.siblingTargetId === option.node_id;\n\n    return {\n      \"pv-drop-indicator-bottom\": Boolean(isSiblingTarget && indicator?.siblingInsertAfter),\n      \"pv-drop-indicator-top\": Boolean(isSiblingTarget && indicator?.siblingInsertAfter === false),\n      \"pv-drop-indicator-parent\": Boolean(indicator?.parentId === option.node_id),\n    };\n  };\n\n  return {\n    dragAndDropIndicatorClasses,\n  };\n};\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport draggable from \"vuedraggable\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\n\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvSimpleNestedTreeItemProps {\n  option: PvTreeOption;\n  settings: PvTreeSettings;\n  level: number;\n  index: number;\n  totalSiblings: number;\n  parentField: string;\n  selectedOptions?: PvTreeOption[];\n  isDraggable?: boolean;\n  isParentPathOpen?: boolean;\n  disableSelection?: boolean;\n}\n\nconst props = defineProps<PvSimpleNestedTreeItemProps>();\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { canItemBeDragged, getDragAndDropDisabled, handleMoveCallback, getDragGroupConfig, canAcceptDrop } =\n  useDragAndDrop();\nconst { indentPadding, showsConnector, showsChildConnectors, childLevel } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((opt) => opt.node_id === id);\n};\n\nconst componentInstance = computed(() => {\n  return props.settings[props.option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n});\n\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst isLastItem = computed(() => {\n  return props.index === props.totalSiblings - 1;\n});\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n\nconst nestedLevelTree = computed(() => {\n  return childLevel({\n    level: props.level,\n    showNestedTree: showNestedTree.value,\n    childrenShowNestedTree: showsChildConnectors(props.settings, props.option.field),\n  });\n});\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\nconst isVisible = computed(() => props.isParentPathOpen ?? true);\n</script>\n\n<template>\n  <PvTreeConnectorGroup :active=\"showContinuationLine\" :level=\"level\">\n    <component\n      :is=\"componentInstance\"\n      :class=\"{\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :option=\"option\"\n      :selected=\"isSelected(option.node_id)\"\n      :disable-selection=\"disableSelection\"\n      :label=\"option.label\"\n      :icon=\"settings[option.field]?.icon\"\n      :style=\"{\n        paddingLeft: indentPadding(level),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n      }\"\n      @handle-selected=\"$emit('handle-tree-select', $event)\"\n      @mouseenter=\"handleMouseEnter(option.node_id)\"\n      @mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <PvTreeReorderIcon v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option)\" />\n      <div class=\"pv-flex pv-full-width\">\n        <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n        <component\n          v-if=\"settings[option.field]?.renderer\"\n          :is=\"settings[option.field]?.renderer\"\n          :option=\"option\"\n          :settings=\"settings\"\n          :is-draggable=\"isDraggable\"\n          :params=\"settings[option.field]?.rendererParams\"\n        />\n        <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n      </div>\n    </component>\n\n    <!-- Drop zone for children -->\n    <div :data-parent-id=\"option.node_id\">\n      <draggable\n        v-model=\"children\"\n        :parent-id=\"option.node_id\"\n        :group=\"getDragGroupConfig(settings, option)\"\n        item-key=\"node_id\"\n        :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n        :move=\"handleMoveCallback(settings)\"\n        :class=\"{\n          'pv-tree-drop-zone':\n            isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n        }\"\n        @start=\"handleDragStart\"\n        @end=\"onDragEnd\"\n        @add=\"onDragEnd\"\n      >\n        <template #item=\"{ element, index: childIndex }\">\n          <PvSimpleNestedTreeItem\n            :is-parent-path-open=\"isParentPathOpen\"\n            :option=\"element\"\n            :settings=\"settings\"\n            :level=\"nestedLevelTree\"\n            :index=\"childIndex\"\n            :total-siblings=\"children.length\"\n            :parent-field=\"option.field\"\n            :selected-options=\"selectedOptions\"\n            :is-draggable=\"isDraggable\"\n            :disable-selection=\"disableSelection\"\n            @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n            @update:children=\"$emit('update:children', $event)\"\n          />\n        </template>\n      </draggable>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport draggable from \"vuedraggable\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\n\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvSimpleNestedTreeItemProps {\n  option: PvTreeOption;\n  settings: PvTreeSettings;\n  level: number;\n  index: number;\n  totalSiblings: number;\n  parentField: string;\n  selectedOptions?: PvTreeOption[];\n  isDraggable?: boolean;\n  isParentPathOpen?: boolean;\n  disableSelection?: boolean;\n}\n\nconst props = defineProps<PvSimpleNestedTreeItemProps>();\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { canItemBeDragged, getDragAndDropDisabled, handleMoveCallback, getDragGroupConfig, canAcceptDrop } =\n  useDragAndDrop();\nconst { indentPadding, showsConnector, showsChildConnectors, childLevel } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((opt) => opt.node_id === id);\n};\n\nconst componentInstance = computed(() => {\n  return props.settings[props.option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n});\n\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst isLastItem = computed(() => {\n  return props.index === props.totalSiblings - 1;\n});\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n\nconst nestedLevelTree = computed(() => {\n  return childLevel({\n    level: props.level,\n    showNestedTree: showNestedTree.value,\n    childrenShowNestedTree: showsChildConnectors(props.settings, props.option.field),\n  });\n});\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\nconst isVisible = computed(() => props.isParentPathOpen ?? true);\n</script>\n\n<template>\n  <PvTreeConnectorGroup :active=\"showContinuationLine\" :level=\"level\">\n    <component\n      :is=\"componentInstance\"\n      :class=\"{\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :option=\"option\"\n      :selected=\"isSelected(option.node_id)\"\n      :disable-selection=\"disableSelection\"\n      :label=\"option.label\"\n      :icon=\"settings[option.field]?.icon\"\n      :style=\"{\n        paddingLeft: indentPadding(level),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n      }\"\n      @handle-selected=\"$emit('handle-tree-select', $event)\"\n      @mouseenter=\"handleMouseEnter(option.node_id)\"\n      @mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <PvTreeReorderIcon v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option)\" />\n      <div class=\"pv-flex pv-full-width\">\n        <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n        <component\n          v-if=\"settings[option.field]?.renderer\"\n          :is=\"settings[option.field]?.renderer\"\n          :option=\"option\"\n          :settings=\"settings\"\n          :is-draggable=\"isDraggable\"\n          :params=\"settings[option.field]?.rendererParams\"\n        />\n        <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n      </div>\n    </component>\n\n    <!-- Drop zone for children -->\n    <div :data-parent-id=\"option.node_id\">\n      <draggable\n        v-model=\"children\"\n        :parent-id=\"option.node_id\"\n        :group=\"getDragGroupConfig(settings, option)\"\n        item-key=\"node_id\"\n        :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n        :move=\"handleMoveCallback(settings)\"\n        :class=\"{\n          'pv-tree-drop-zone':\n            isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n        }\"\n        @start=\"handleDragStart\"\n        @end=\"onDragEnd\"\n        @add=\"onDragEnd\"\n      >\n        <template #item=\"{ element, index: childIndex }\">\n          <PvSimpleNestedTreeItem\n            :is-parent-path-open=\"isParentPathOpen\"\n            :option=\"element\"\n            :settings=\"settings\"\n            :level=\"nestedLevelTree\"\n            :index=\"childIndex\"\n            :total-siblings=\"children.length\"\n            :parent-field=\"option.field\"\n            :selected-options=\"selectedOptions\"\n            :is-draggable=\"isDraggable\"\n            :disable-selection=\"disableSelection\"\n            @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n            @update:children=\"$emit('update:children', $event)\"\n          />\n        </template>\n      </draggable>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport draggable from \"vuedraggable\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvSimpleNestedTreeItem from \"./PvSimpleNestedTreeItem.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\n\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvSimpleNestedTreeProps {\n  option: PvTreeOption;\n  settings: PvTreeSettings;\n  level: number;\n  selectedOptions?: PvTreeOption[];\n  isDraggable?: boolean;\n  isParentPathOpen?: boolean;\n  disableSelection?: boolean;\n  /** Field of the parent option; used to look up showNestedTree for connector-line rendering */\n  parentField?: string;\n  /** Index of this option among its siblings */\n  index?: number;\n  /** Total number of siblings, used to determine if this is the last one */\n  totalSiblings?: number;\n}\n\nconst props = defineProps<PvSimpleNestedTreeProps>();\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { getDragAndDropDisabled, canItemBeDragged, handleMoveCallback, getDragGroupConfig, canAcceptDrop } =\n  useDragAndDrop();\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { indentPadding, showsConnector, showsChildConnectors, childLevel } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst additionalNestingLevel = computed(() => {\n  return props.settings[props.option.field]?.additionalNestingLevel ?? 0;\n});\n\n// Connector glyph on this group's own anchor row: driven by the settings of the field this\n// anchor is nested under, not by settings[option.field] (that governs its children below).\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst nestedLevelTree = computed(() => {\n  return childLevel({\n    level: props.level,\n    showNestedTree: showNestedTree.value,\n    childrenShowNestedTree: showsChildConnectors(props.settings, props.option.field),\n    additionalNestingLevel: additionalNestingLevel.value,\n  });\n});\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((option) => option.node_id === id);\n};\n\nconst componentInstance = (option: PvTreeOption) => {\n  return props.settings[option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n};\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\nconst isVisible = computed(() => props.isParentPathOpen ?? true);\n\nconst isLastItem = computed(() => {\n  return props.index === undefined || props.totalSiblings === undefined\n    ? true\n    : props.index === props.totalSiblings - 1;\n});\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n</script>\n\n<template>\n  <PvTreeConnectorGroup class=\"pv-flow\" style=\"--flow-size: 0px\" :active=\"showContinuationLine\" :level=\"level\">\n    <component\n      :is=\"componentInstance(option)\"\n      :option=\"option\"\n      :selected=\"isSelected(option.node_id)\"\n      :disable-selection=\"disableSelection\"\n      :label=\"option.label\"\n      :icon=\"settings[option.field]?.icon\"\n      :class=\"{\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :style=\"{\n        paddingLeft: indentPadding(level, additionalNestingLevel),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n      }\"\n      @handle-selected=\"$emit('handle-tree-select', $event)\"\n      @mouseenter=\"handleMouseEnter(option.node_id)\"\n      @mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <PvTreeReorderIcon v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option)\" />\n      <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n      <component\n        v-if=\"settings[option.field]?.renderer\"\n        :is=\"settings[option.field]?.renderer\"\n        :option=\"option\"\n        :settings=\"settings\"\n        :selected=\"isSelected(option.node_id)\"\n        :params=\"settings[option.field]?.rendererParams\"\n      />\n      <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n    </component>\n    <!-- Drop zone for children -->\n    <div :data-parent-id=\"option.node_id\">\n      <draggable\n        v-model=\"children\"\n        :parent-id=\"option.node_id\"\n        :group=\"getDragGroupConfig(settings, option)\"\n        item-key=\"node_id\"\n        :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n        :move=\"handleMoveCallback(settings)\"\n        :class=\"{\n          'pv-tree-drop-zone':\n            isDraggable && isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n        }\"\n        @start=\"handleDragStart\"\n        @end=\"onDragEnd\"\n        @add=\"onDragEnd\"\n      >\n        <template #item=\"{ element, index }\">\n          <PvSimpleNestedTreeItem\n            :is-parent-path-open=\"isParentPathOpen\"\n            :option=\"element\"\n            :settings=\"settings\"\n            :level=\"nestedLevelTree\"\n            :index=\"index\"\n            :total-siblings=\"children.length\"\n            :parent-field=\"option.field\"\n            :selected-options=\"selectedOptions\"\n            :is-draggable=\"isDraggable\"\n            :disable-selection=\"disableSelection\"\n            @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n            @update:children=\"$emit('update:children', $event)\"\n          />\n        </template>\n      </draggable>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport draggable from \"vuedraggable\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvSimpleNestedTreeItem from \"./PvSimpleNestedTreeItem.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\n\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\ninterface PvSimpleNestedTreeProps {\n  option: PvTreeOption;\n  settings: PvTreeSettings;\n  level: number;\n  selectedOptions?: PvTreeOption[];\n  isDraggable?: boolean;\n  isParentPathOpen?: boolean;\n  disableSelection?: boolean;\n  /** Field of the parent option; used to look up showNestedTree for connector-line rendering */\n  parentField?: string;\n  /** Index of this option among its siblings */\n  index?: number;\n  /** Total number of siblings, used to determine if this is the last one */\n  totalSiblings?: number;\n}\n\nconst props = defineProps<PvSimpleNestedTreeProps>();\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { getDragAndDropDisabled, canItemBeDragged, handleMoveCallback, getDragGroupConfig, canAcceptDrop } =\n  useDragAndDrop();\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { indentPadding, showsConnector, showsChildConnectors, childLevel } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst additionalNestingLevel = computed(() => {\n  return props.settings[props.option.field]?.additionalNestingLevel ?? 0;\n});\n\n// Connector glyph on this group's own anchor row: driven by the settings of the field this\n// anchor is nested under, not by settings[option.field] (that governs its children below).\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst nestedLevelTree = computed(() => {\n  return childLevel({\n    level: props.level,\n    showNestedTree: showNestedTree.value,\n    childrenShowNestedTree: showsChildConnectors(props.settings, props.option.field),\n    additionalNestingLevel: additionalNestingLevel.value,\n  });\n});\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((option) => option.node_id === id);\n};\n\nconst componentInstance = (option: PvTreeOption) => {\n  return props.settings[option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n};\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\nconst isVisible = computed(() => props.isParentPathOpen ?? true);\n\nconst isLastItem = computed(() => {\n  return props.index === undefined || props.totalSiblings === undefined\n    ? true\n    : props.index === props.totalSiblings - 1;\n});\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n</script>\n\n<template>\n  <PvTreeConnectorGroup class=\"pv-flow\" style=\"--flow-size: 0px\" :active=\"showContinuationLine\" :level=\"level\">\n    <component\n      :is=\"componentInstance(option)\"\n      :option=\"option\"\n      :selected=\"isSelected(option.node_id)\"\n      :disable-selection=\"disableSelection\"\n      :label=\"option.label\"\n      :icon=\"settings[option.field]?.icon\"\n      :class=\"{\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :style=\"{\n        paddingLeft: indentPadding(level, additionalNestingLevel),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n      }\"\n      @handle-selected=\"$emit('handle-tree-select', $event)\"\n      @mouseenter=\"handleMouseEnter(option.node_id)\"\n      @mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <PvTreeReorderIcon v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option)\" />\n      <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n      <component\n        v-if=\"settings[option.field]?.renderer\"\n        :is=\"settings[option.field]?.renderer\"\n        :option=\"option\"\n        :settings=\"settings\"\n        :selected=\"isSelected(option.node_id)\"\n        :params=\"settings[option.field]?.rendererParams\"\n      />\n      <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n    </component>\n    <!-- Drop zone for children -->\n    <div :data-parent-id=\"option.node_id\">\n      <draggable\n        v-model=\"children\"\n        :parent-id=\"option.node_id\"\n        :group=\"getDragGroupConfig(settings, option)\"\n        item-key=\"node_id\"\n        :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n        :move=\"handleMoveCallback(settings)\"\n        :class=\"{\n          'pv-tree-drop-zone':\n            isDraggable && isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n        }\"\n        @start=\"handleDragStart\"\n        @end=\"onDragEnd\"\n        @add=\"onDragEnd\"\n      >\n        <template #item=\"{ element, index }\">\n          <PvSimpleNestedTreeItem\n            :is-parent-path-open=\"isParentPathOpen\"\n            :option=\"element\"\n            :settings=\"settings\"\n            :level=\"nestedLevelTree\"\n            :index=\"index\"\n            :total-siblings=\"children.length\"\n            :parent-field=\"option.field\"\n            :selected-options=\"selectedOptions\"\n            :is-draggable=\"isDraggable\"\n            :disable-selection=\"disableSelection\"\n            @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n            @update:children=\"$emit('update:children', $event)\"\n          />\n        </template>\n      </draggable>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport draggable from \"vuedraggable\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvSimpleNestedTree from \"./PvSimpleNestedTree.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\n\ninterface PvTreeItemProps {\n  option: PvTreeOption;\n  selectedOptions?: PvTreeOption[];\n  level?: number;\n  settings: PvTreeSettings;\n  isDraggable?: boolean;\n  treeOpen?: boolean;\n  isParentPathOpen?: boolean;\n  isLastRootItem?: boolean;\n  disableSelection?: boolean;\n  /** Field of the parent option; used to look up showNestedTree for connector-line rendering */\n  parentField?: string;\n  /** Index of this option among its siblings */\n  index?: number;\n  /** Total number of siblings, used to determine if this is the last one */\n  totalSiblings?: number;\n  /** node_ids to force open; see PvTree's own doc comment on this prop. */\n  openNodeIds?: Array<string | number>;\n}\n\nconst props = withDefaults(defineProps<PvTreeItemProps>(), {\n  level: 0,\n  isParentPathOpen: true,\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\n// Whether openNodeIds (see prop doc) names THIS row. String-compared since callers may pass\n// either a numeric or string id depending on where their id originated.\nconst isForcedOpen = computed(() =>\n  (props.openNodeIds ?? []).some((id) => String(id) === String(props.option.node_id)),\n);\n\n// Local accordion state - independent from treeOpen prop\nconst accordionOpen = ref(\n  props.treeOpen ?? (isForcedOpen.value || (props.settings[props.option.field]?.defaultExpanded ?? false)),\n);\n\n// Watch treeOpen prop to allow programmatic control (e.g., \"expand all\" button)\nwatch(\n  () => props.treeOpen,\n  (newValue) => {\n    if (newValue !== undefined) {\n      accordionOpen.value = newValue;\n    }\n  },\n);\n\n// One-way: forces this row open when openNodeIds newly names it, but never closes it when that\n// stops being true -- a reviewer's own manual collapse (or simply selecting something else) must\n// not undo itself.\nwatch(isForcedOpen, (forced) => {\n  if (forced) accordionOpen.value = true;\n});\n\n// With `lazyChildren`, children mount on first open and stay: a closed row costs only its summary,\n// and reopening keeps nested accordions' own open state.\nconst hasBeenOpened = ref(accordionOpen.value);\nwatch(accordionOpen, (open) => {\n  if (open) hasBeenOpened.value = true;\n});\nconst renderChildren = computed(() => !props.settings[props.option.field]?.lazyChildren || hasBeenOpened.value);\n\nconst {\n  getDragGroupConfig,\n  getDragAndDropDisabled,\n  canItemBeDragged,\n  handleMoveCallback,\n  childrenDraggable,\n  canAcceptDrop,\n} = useDragAndDrop();\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { indentPadding, showsConnector } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst nestedStyles = (level: number) => {\n  return {\n    paddingLeft: indentPadding(level, props.settings[props.option.field]?.additionalNestingLevel ?? 0),\n    \"--border-color\": \"#121313\",\n  };\n};\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((option) => option.node_id === id);\n};\n\nconst componentInstance = computed(() => {\n  return props.settings[props.option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n});\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\n// The text a childless accordion row shows inside itself; unset means such a row is a plain leaf.\nconst emptyAccordionText = computed(() =>\n  props.option.children?.length ? undefined : props.settings[props.option.field]?.emptyAccordionText,\n);\n\nconst isAccordionRow = computed(() =>\n  Boolean(props.settings[props.option.field]?.accordion && (props.option.children?.length || emptyAccordionText.value)),\n);\n\n// Connector glyph: driven by the parent's showNestedTree setting, not this option's own\n// settings, so it decorates whichever branch below ends up rendering (accordion, nested\n// tree, or leaf) without changing how that branch dispatches.\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst isLastItem = computed(() => {\n  return props.index === undefined || props.totalSiblings === undefined\n    ? true\n    : props.index === props.totalSiblings - 1;\n});\n\n// An accordion row drawing a glyph puts it before the chevron, so the glyph and the chevron each\n// take an indent column and the children skip both to hang from the row's icon.\nconst accordionChildLevel = computed(() => props.level + (showNestedTree.value ? 2 : 1));\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n\nconst isVisible = computed(() => {\n  const pathOpen = props.isParentPathOpen ?? true;\n  if (!pathOpen) return false;\n  // For accordion row at root (level 0): background only when this accordion is expanded\n  // For accordion that is a child (level > 0): background when parent is open (pathOpen)\n  if (isAccordionRow.value) return props.level === 0 ? accordionOpen.value : true;\n  return true;\n});\n</script>\n\n<template>\n  <PvTreeConnectorGroup :active=\"showContinuationLine\" :level=\"level\">\n    <PvAccordion\n      v-if=\"isAccordionRow\"\n      v-model=\"accordionOpen\"\n      chevronPosition=\"left\"\n      style=\"\n        --accordion-content-padding: 2px 0px;\n        --accordion-arrow-right-summary-padding: 0.25rem 1.375rem 0.25rem 0.25rem;\n        --accordion-content-padding: 0px;\n      \"\n      :data-parent-id=\"option.node_id\"\n      enableTriggerSlot\n      enableTriggerFullWidth\n      :summaryStyles=\"{\n        ...nestedStyles(level),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n        'justify-content': 'flex-start',\n      }\"\n      :summaryClasses=\"{\n        'pv-tree-item': true,\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :defaultOpen=\"settings[option.field]?.defaultExpanded ?? false\"\n      :toggleOnChevronOnly=\"settings[option.field]?.toggleOnChevronOnly ?? false\"\n      chevron-variant=\"horizontal\"\n      @summary-click=\"settings[option.field]?.rendererParams?.onSummaryClick?.($event, option)\"\n      @summary-mouseenter=\"handleMouseEnter(option.node_id)\"\n      @summary-mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <template v-if=\"showNestedTree\" #leading>\n        <PvTreeConnector :is-last=\"isLastItem\" />\n      </template>\n      <template #trigger>\n        <PvTreeReorderIcon\n          v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option) && level > 0\"\n        />\n        <template v-if=\"settings[option.field]?.renderer\">\n          <component\n            :is=\"settings[option.field]?.renderer\"\n            :option=\"option\"\n            :settings=\"settings\"\n            :selected=\"isSelected(option.node_id)\"\n            :params=\"settings[option.field]?.rendererParams\"\n          />\n        </template>\n        <template v-else>\n          <PvSimpleItemTree :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n        </template>\n      </template>\n      <div\n        v-if=\"emptyAccordionText\"\n        class=\"pv-text-body-sm pv-text-subdued pv-tree-empty-accordion\"\n        :style=\"nestedStyles(accordionChildLevel)\"\n      >\n        {{ emptyAccordionText }}\n      </div>\n      <!-- Drop zone for children -->\n      <div v-if=\"renderChildren\" :data-parent-id=\"option.node_id\">\n        <draggable\n          v-model=\"children\"\n          :parent-id=\"option.node_id\"\n          :group=\"getDragGroupConfig(settings, option)\"\n          item-key=\"node_id\"\n          :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n          :move=\"handleMoveCallback(settings)\"\n          :class=\"{\n            'pv-tree-drop-zone':\n              isDraggable && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n          }\"\n          @start=\"handleDragStart\"\n          @end=\"onDragEnd\"\n          @add=\"onDragEnd\"\n        >\n          <template #item=\"{ element, index: childIndex }\">\n            <PvTreeItem\n              :is-parent-path-open=\"isParentPathOpen && accordionOpen\"\n              :selected-options=\"selectedOptions\"\n              :option=\"element\"\n              :settings=\"settings\"\n              :level=\"accordionChildLevel\"\n              :index=\"childIndex\"\n              :total-siblings=\"children.length\"\n              :parent-field=\"option.field\"\n              :is-draggable=\"childrenDraggable(isDraggable, settings, element)\"\n              :tree-open=\"treeOpen\"\n              :disable-selection=\"disableSelection\"\n              :open-node-ids=\"openNodeIds\"\n              @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n              @update:children=\"$emit('update:children', $event)\"\n            />\n          </template>\n        </draggable>\n      </div>\n    </PvAccordion>\n    <PvSimpleNestedTree\n      v-else-if=\"option.children && option.children.length > 0 && settings && !settings[option.field]?.accordion\"\n      :is-parent-path-open=\"isParentPathOpen\"\n      :selected-options=\"selectedOptions\"\n      :option=\"option\"\n      :settings=\"settings\"\n      :level=\"level\"\n      :index=\"index\"\n      :total-siblings=\"totalSiblings\"\n      :parent-field=\"parentField\"\n      :is-draggable=\"isDraggable\"\n      :disable-selection=\"disableSelection\"\n      @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n      @update:children=\"$emit('update:children', $event)\"\n      :is-last-root-item=\"isLastRootItem\"\n    />\n    <div v-else>\n      <component\n        :is=\"componentInstance\"\n        :class=\"{\n          ...dragAndDropIndicatorClasses(option),\n        }\"\n        :option=\"option\"\n        :selected=\"isSelected(option.node_id)\"\n        :disable-selection=\"disableSelection\"\n        :label=\"option.label\"\n        :icon=\"settings[option.field]?.icon\"\n        :style=\"{\n          ...nestedStyles(level),\n          ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n        }\"\n        @handle-selected=\"$emit('handle-tree-select', $event)\"\n        @mouseenter=\"handleMouseEnter(option.node_id)\"\n        @mouseleave=\"handleMouseLeave()\"\n        @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n      >\n        <PvTreeReorderIcon\n          v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option) && level > 0\"\n        />\n        <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n        <component\n          v-if=\"settings[option.field]?.renderer\"\n          :is=\"settings[option.field]?.renderer\"\n          :option=\"option\"\n          :settings=\"settings\"\n          :params=\"settings[option.field]?.rendererParams\"\n        />\n        <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n      </component>\n      <!-- Drop zone for children -->\n      <div :data-parent-id=\"option.node_id\">\n        <draggable\n          v-model=\"children\"\n          :parent-id=\"option.node_id\"\n          :group=\"getDragGroupConfig(settings, option)\"\n          item-key=\"node_id\"\n          :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n          :move=\"handleMoveCallback(settings)\"\n          :class=\"{\n            'pv-tree-drop-zone':\n              isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n          }\"\n          @start=\"handleDragStart\"\n          @end=\"onDragEnd\"\n          @add=\"onDragEnd\"\n        >\n          <template #item=\"{ element, index: childIndex }\">\n            <PvTreeItem\n              :is-parent-path-open=\"isParentPathOpen\"\n              :selected-options=\"selectedOptions\"\n              :option=\"element\"\n              :settings=\"settings\"\n              :level=\"level + 1\"\n              :index=\"childIndex\"\n              :total-siblings=\"children.length\"\n              :parent-field=\"option.field\"\n              :is-draggable=\"childrenDraggable(isDraggable, settings, element)\"\n              :disable-selection=\"disableSelection\"\n              :open-node-ids=\"openNodeIds\"\n              @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n              @update:children=\"$emit('update:children', $event)\"\n            />\n          </template>\n        </draggable>\n      </div>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from \"vue\";\nimport draggable from \"vuedraggable\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvSimpleItemTree from \"./PvSimpleItemTree.vue\";\nimport PvSimpleNestedTree from \"./PvSimpleNestedTree.vue\";\nimport PvCheckboxTreeItem from \"./PvCheckboxTreeItem.vue\";\nimport PvButtonTreeItem from \"./PvButtonTreeItem.vue\";\nimport PvTreeReorderIcon from \"./PvTreeReorderIcon.vue\";\nimport PvTreeConnector from \"./PvTreeConnector.vue\";\nimport PvTreeConnectorGroup from \"./PvTreeConnectorGroup.vue\";\nimport { useHoverIcon } from \"./composables/useHoverIcon\";\nimport { useDraggingState } from \"./composables/useDraggingState\";\nimport { useDragAndDropIndicator } from \"./composables/useDragAndDropIndicator\";\nimport { useTreeIndentation } from \"./composables/useTreeIndentation\";\n\nimport type { PvTreeOption, PvTreeSettings } from \"./types\";\nimport { useDragAndDrop } from \"./composables/useDragAndDrop\";\n\ninterface PvTreeItemProps {\n  option: PvTreeOption;\n  selectedOptions?: PvTreeOption[];\n  level?: number;\n  settings: PvTreeSettings;\n  isDraggable?: boolean;\n  treeOpen?: boolean;\n  isParentPathOpen?: boolean;\n  isLastRootItem?: boolean;\n  disableSelection?: boolean;\n  /** Field of the parent option; used to look up showNestedTree for connector-line rendering */\n  parentField?: string;\n  /** Index of this option among its siblings */\n  index?: number;\n  /** Total number of siblings, used to determine if this is the last one */\n  totalSiblings?: number;\n  /** node_ids to force open; see PvTree's own doc comment on this prop. */\n  openNodeIds?: Array<string | number>;\n}\n\nconst props = withDefaults(defineProps<PvTreeItemProps>(), {\n  level: 0,\n  isParentPathOpen: true,\n  disableSelection: false,\n});\n\nconst emit = defineEmits<{\n  (e: \"handle-tree-select\", payload: { option: PvTreeOption; event: MouseEvent }): void;\n  (e: \"update:children\", payload: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }): void;\n}>();\n\n// Whether openNodeIds (see prop doc) names THIS row. String-compared since callers may pass\n// either a numeric or string id depending on where their id originated.\nconst isForcedOpen = computed(() =>\n  (props.openNodeIds ?? []).some((id) => String(id) === String(props.option.node_id)),\n);\n\n// Local accordion state - independent from treeOpen prop\nconst accordionOpen = ref(\n  props.treeOpen ?? (isForcedOpen.value || (props.settings[props.option.field]?.defaultExpanded ?? false)),\n);\n\n// Watch treeOpen prop to allow programmatic control (e.g., \"expand all\" button)\nwatch(\n  () => props.treeOpen,\n  (newValue) => {\n    if (newValue !== undefined) {\n      accordionOpen.value = newValue;\n    }\n  },\n);\n\n// One-way: forces this row open when openNodeIds newly names it, but never closes it when that\n// stops being true -- a reviewer's own manual collapse (or simply selecting something else) must\n// not undo itself.\nwatch(isForcedOpen, (forced) => {\n  if (forced) accordionOpen.value = true;\n});\n\n// With `lazyChildren`, children mount on first open and stay: a closed row costs only its summary,\n// and reopening keeps nested accordions' own open state.\nconst hasBeenOpened = ref(accordionOpen.value);\nwatch(accordionOpen, (open) => {\n  if (open) hasBeenOpened.value = true;\n});\nconst renderChildren = computed(() => !props.settings[props.option.field]?.lazyChildren || hasBeenOpened.value);\n\nconst {\n  getDragGroupConfig,\n  getDragAndDropDisabled,\n  canItemBeDragged,\n  handleMoveCallback,\n  childrenDraggable,\n  canAcceptDrop,\n} = useDragAndDrop();\nconst { hoveredId, handleMouseEnter, handleMouseLeave } = useHoverIcon();\nconst { isDragging, draggingGroupName, onDragStart, onDragEnd } = useDraggingState();\nconst { dragAndDropIndicatorClasses } = useDragAndDropIndicator();\nconst { indentPadding, showsConnector } = useTreeIndentation();\n\nconst handleDragStart = () => {\n  const groupConfig = getDragGroupConfig(props.settings, props.option);\n  onDragStart(groupConfig.name);\n};\n\nconst nestedStyles = (level: number) => {\n  return {\n    paddingLeft: indentPadding(level, props.settings[props.option.field]?.additionalNestingLevel ?? 0),\n    \"--border-color\": \"#121313\",\n  };\n};\n\nconst isSelected = (id?: string | number) => {\n  return props.selectedOptions && props.selectedOptions.some((option) => option.node_id === id);\n};\n\nconst componentInstance = computed(() => {\n  return props.settings[props.option.field]?.checkbox ? PvCheckboxTreeItem : PvButtonTreeItem;\n});\n\n// Writable computed for vuedraggable v-model binding\nconst children = computed({\n  get: () => [...(props.option.children || [])],\n  set: (value) => {\n    emit(\"update:children\", { optionId: props.option.node_id, newChildren: value });\n  },\n});\n\n// The text a childless accordion row shows inside itself; unset means such a row is a plain leaf.\nconst emptyAccordionText = computed(() =>\n  props.option.children?.length ? undefined : props.settings[props.option.field]?.emptyAccordionText,\n);\n\nconst isAccordionRow = computed(() =>\n  Boolean(props.settings[props.option.field]?.accordion && (props.option.children?.length || emptyAccordionText.value)),\n);\n\n// Connector glyph: driven by the parent's showNestedTree setting, not this option's own\n// settings, so it decorates whichever branch below ends up rendering (accordion, nested\n// tree, or leaf) without changing how that branch dispatches.\nconst showNestedTree = computed(() => {\n  return showsConnector(props.settings, props.parentField);\n});\n\nconst isLastItem = computed(() => {\n  return props.index === undefined || props.totalSiblings === undefined\n    ? true\n    : props.index === props.totalSiblings - 1;\n});\n\n// An accordion row drawing a glyph puts it before the chevron, so the glyph and the chevron each\n// take an indent column and the children skip both to hang from the row's icon.\nconst accordionChildLevel = computed(() => props.level + (showNestedTree.value ? 2 : 1));\n\n// Only rows with a following sibling need the vertical line carried past their children\nconst showContinuationLine = computed(() => showNestedTree.value && !isLastItem.value);\n\nconst isVisible = computed(() => {\n  const pathOpen = props.isParentPathOpen ?? true;\n  if (!pathOpen) return false;\n  // For accordion row at root (level 0): background only when this accordion is expanded\n  // For accordion that is a child (level > 0): background when parent is open (pathOpen)\n  if (isAccordionRow.value) return props.level === 0 ? accordionOpen.value : true;\n  return true;\n});\n</script>\n\n<template>\n  <PvTreeConnectorGroup :active=\"showContinuationLine\" :level=\"level\">\n    <PvAccordion\n      v-if=\"isAccordionRow\"\n      v-model=\"accordionOpen\"\n      chevronPosition=\"left\"\n      style=\"\n        --accordion-content-padding: 2px 0px;\n        --accordion-arrow-right-summary-padding: 0.25rem 1.375rem 0.25rem 0.25rem;\n        --accordion-content-padding: 0px;\n      \"\n      :data-parent-id=\"option.node_id\"\n      enableTriggerSlot\n      enableTriggerFullWidth\n      :summaryStyles=\"{\n        ...nestedStyles(level),\n        ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n        'justify-content': 'flex-start',\n      }\"\n      :summaryClasses=\"{\n        'pv-tree-item': true,\n        ...dragAndDropIndicatorClasses(option),\n      }\"\n      :defaultOpen=\"settings[option.field]?.defaultExpanded ?? false\"\n      :toggleOnChevronOnly=\"settings[option.field]?.toggleOnChevronOnly ?? false\"\n      chevron-variant=\"horizontal\"\n      @summary-click=\"settings[option.field]?.rendererParams?.onSummaryClick?.($event, option)\"\n      @summary-mouseenter=\"handleMouseEnter(option.node_id)\"\n      @summary-mouseleave=\"handleMouseLeave()\"\n      @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n    >\n      <template v-if=\"showNestedTree\" #leading>\n        <PvTreeConnector :is-last=\"isLastItem\" />\n      </template>\n      <template #trigger>\n        <PvTreeReorderIcon\n          v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option) && level > 0\"\n        />\n        <template v-if=\"settings[option.field]?.renderer\">\n          <component\n            :is=\"settings[option.field]?.renderer\"\n            :option=\"option\"\n            :settings=\"settings\"\n            :selected=\"isSelected(option.node_id)\"\n            :params=\"settings[option.field]?.rendererParams\"\n          />\n        </template>\n        <template v-else>\n          <PvSimpleItemTree :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n        </template>\n      </template>\n      <div\n        v-if=\"emptyAccordionText\"\n        class=\"pv-text-body-sm pv-text-subdued pv-tree-empty-accordion\"\n        :style=\"nestedStyles(accordionChildLevel)\"\n      >\n        {{ emptyAccordionText }}\n      </div>\n      <!-- Drop zone for children -->\n      <div v-if=\"renderChildren\" :data-parent-id=\"option.node_id\">\n        <draggable\n          v-model=\"children\"\n          :parent-id=\"option.node_id\"\n          :group=\"getDragGroupConfig(settings, option)\"\n          item-key=\"node_id\"\n          :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n          :move=\"handleMoveCallback(settings)\"\n          :class=\"{\n            'pv-tree-drop-zone':\n              isDraggable && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n          }\"\n          @start=\"handleDragStart\"\n          @end=\"onDragEnd\"\n          @add=\"onDragEnd\"\n        >\n          <template #item=\"{ element, index: childIndex }\">\n            <PvTreeItem\n              :is-parent-path-open=\"isParentPathOpen && accordionOpen\"\n              :selected-options=\"selectedOptions\"\n              :option=\"element\"\n              :settings=\"settings\"\n              :level=\"accordionChildLevel\"\n              :index=\"childIndex\"\n              :total-siblings=\"children.length\"\n              :parent-field=\"option.field\"\n              :is-draggable=\"childrenDraggable(isDraggable, settings, element)\"\n              :tree-open=\"treeOpen\"\n              :disable-selection=\"disableSelection\"\n              :open-node-ids=\"openNodeIds\"\n              @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n              @update:children=\"$emit('update:children', $event)\"\n            />\n          </template>\n        </draggable>\n      </div>\n    </PvAccordion>\n    <PvSimpleNestedTree\n      v-else-if=\"option.children && option.children.length > 0 && settings && !settings[option.field]?.accordion\"\n      :is-parent-path-open=\"isParentPathOpen\"\n      :selected-options=\"selectedOptions\"\n      :option=\"option\"\n      :settings=\"settings\"\n      :level=\"level\"\n      :index=\"index\"\n      :total-siblings=\"totalSiblings\"\n      :parent-field=\"parentField\"\n      :is-draggable=\"isDraggable\"\n      :disable-selection=\"disableSelection\"\n      @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n      @update:children=\"$emit('update:children', $event)\"\n      :is-last-root-item=\"isLastRootItem\"\n    />\n    <div v-else>\n      <component\n        :is=\"componentInstance\"\n        :class=\"{\n          ...dragAndDropIndicatorClasses(option),\n        }\"\n        :option=\"option\"\n        :selected=\"isSelected(option.node_id)\"\n        :disable-selection=\"disableSelection\"\n        :label=\"option.label\"\n        :icon=\"settings[option.field]?.icon\"\n        :style=\"{\n          ...nestedStyles(level),\n          ...(settings[option.field]?.rendererParams?.onProvideCssStyles?.(option, { isVisible }) ?? {}),\n        }\"\n        @handle-selected=\"$emit('handle-tree-select', $event)\"\n        @mouseenter=\"handleMouseEnter(option.node_id)\"\n        @mouseleave=\"handleMouseLeave()\"\n        @contextmenu.stop=\"settings[option.field]?.rendererParams?.onContextMenu?.($event, option)\"\n      >\n        <PvTreeReorderIcon\n          v-show=\"hoveredId === option.node_id && canItemBeDragged(isDraggable, settings, option) && level > 0\"\n        />\n        <PvTreeConnector v-if=\"showNestedTree\" :is-last=\"isLastItem\" />\n        <component\n          v-if=\"settings[option.field]?.renderer\"\n          :is=\"settings[option.field]?.renderer\"\n          :option=\"option\"\n          :settings=\"settings\"\n          :params=\"settings[option.field]?.rendererParams\"\n        />\n        <PvSimpleItemTree v-else :label=\"option.label\" :icon=\"settings[option.field]?.icon\" />\n      </component>\n      <!-- Drop zone for children -->\n      <div :data-parent-id=\"option.node_id\">\n        <draggable\n          v-model=\"children\"\n          :parent-id=\"option.node_id\"\n          :group=\"getDragGroupConfig(settings, option)\"\n          item-key=\"node_id\"\n          :disabled=\"getDragAndDropDisabled(isDraggable, settings, option)\"\n          :move=\"handleMoveCallback(settings)\"\n          :class=\"{\n            'pv-tree-drop-zone':\n              isDragging && children.length === 0 && canAcceptDrop(settings, option, draggingGroupName),\n          }\"\n          @start=\"handleDragStart\"\n          @end=\"onDragEnd\"\n          @add=\"onDragEnd\"\n        >\n          <template #item=\"{ element, index: childIndex }\">\n            <PvTreeItem\n              :is-parent-path-open=\"isParentPathOpen\"\n              :selected-options=\"selectedOptions\"\n              :option=\"element\"\n              :settings=\"settings\"\n              :level=\"level + 1\"\n              :index=\"childIndex\"\n              :total-siblings=\"children.length\"\n              :parent-field=\"option.field\"\n              :is-draggable=\"childrenDraggable(isDraggable, settings, element)\"\n              :disable-selection=\"disableSelection\"\n              :open-node-ids=\"openNodeIds\"\n              @handle-tree-select=\"$emit('handle-tree-select', $event)\"\n              @update:children=\"$emit('update:children', $event)\"\n            />\n          </template>\n        </draggable>\n      </div>\n    </div>\n  </PvTreeConnectorGroup>\n</template>\n","import { nextTick, Ref } from \"vue\";\nimport { cloneDeep } from \"es-toolkit/object\";\nimport { PvTreeOption } from \"../types\";\n\nexport const useTreeUpdate = (options: Ref<PvTreeOption[]>) => {\n  const pendingChildrenUpdates: { optionId: PvTreeOption[\"node_id\"]; newChildren: PvTreeOption[] }[] = [];\n  let flushScheduled = false;\n\n  /**\n   * Builds fast lookup indexes for the tree:\n   * - nodeById:   allows O(1) access to any node by id\n   * - parentById: tracks the current parent of each node\n   *\n   * This avoids repeated full tree traversals during updates.\n   */\n  function buildIndex(roots: PvTreeOption[]): {\n    nodeById: Map<PvTreeOption[\"node_id\"], PvTreeOption>;\n    parentById: Map<PvTreeOption[\"node_id\"], PvTreeOption | null>;\n  } {\n    const nodeById = new Map<PvTreeOption[\"node_id\"], PvTreeOption>();\n    const parentById = new Map<PvTreeOption[\"node_id\"], PvTreeOption | null>();\n\n    // Iterative DFS to avoid deep recursion on large trees\n    const stack: Array<{ node: PvTreeOption; parent: PvTreeOption | null }> = [];\n    for (const root of roots) {\n      stack.push({ node: root, parent: null });\n    }\n\n    while (stack.length) {\n      const { node, parent } = stack.pop()!;\n      nodeById.set(node.node_id, node);\n      parentById.set(node.node_id, parent);\n\n      if (node.children?.length) {\n        for (const child of node.children) {\n          stack.push({ node: child, parent: node });\n        }\n      }\n    }\n\n    return { nodeById, parentById };\n  }\n\n  /**\n   * Applies all pending children updates in a single flush.\n   *\n   * Key ideas:\n   * - Clone the tree once to keep updates immutable\n   * - Build indexes once for fast lookups\n   * - Move nodes by re-parenting instead of re-traversing the tree\n   */\n  const flushPendingChildrenUpdates = () => {\n    flushScheduled = false;\n\n    // Nothing to do\n    if (pendingChildrenUpdates.length === 0) return;\n\n    // Take all pending updates and clear the queue\n    const updates = pendingChildrenUpdates.splice(0, pendingChildrenUpdates.length);\n\n    // Clone the current options tree only once\n    const result = cloneDeep(options.value);\n\n    // Build fast lookup structures\n    const { nodeById, parentById } = buildIndex(result);\n\n    /**\n     * If multiple updates target the same optionId,\n     * the last one wins.\n     */\n    const lastUpdateByOption = new Map<PvTreeOption[\"node_id\"], PvTreeOption[]>();\n    for (const update of updates) {\n      lastUpdateByOption.set(update.optionId, update.newChildren);\n    }\n\n    // Apply normalized updates\n    for (const [optionId, newChildren] of lastUpdateByOption) {\n      const parentNode = nodeById.get(optionId);\n      if (!parentNode) continue;\n\n      /**\n       * Map children:\n       * - If a node already exists in the tree, reuse it (we are moving it)\n       * - Otherwise, treat it as a new node\n       */\n      const mappedChildren = newChildren.map((child) => nodeById.get(child.node_id) ?? child);\n\n      /**\n       * Register any brand-new nodes in the indexes\n       */\n      for (const child of mappedChildren) {\n        if (!nodeById.has(child.node_id)) {\n          nodeById.set(child.node_id, child);\n          parentById.set(child.node_id, null);\n        }\n      }\n\n      /**\n       * Re-parent children:\n       * - Detach from the old parent if necessary\n       * - Attach to the new parent\n       */\n      for (const child of mappedChildren) {\n        const oldParent = parentById.get(child.node_id) ?? null;\n\n        // Remove from previous parent if it differs from the new one\n        if (oldParent && oldParent !== parentNode) {\n          oldParent.children = (oldParent.children ?? []).filter((c) => c.node_id !== child.node_id);\n        }\n\n        parentById.set(child.node_id, parentNode);\n      }\n\n      // Finally, replace the parent's children list\n      parentNode.children = mappedChildren;\n    }\n\n    // Commit the updated tree\n    options.value = result;\n  };\n\n  const handleUpdateChildren = ({\n    optionId,\n    newChildren,\n  }: {\n    optionId: PvTreeOption[\"node_id\"];\n    newChildren: PvTreeOption[];\n  }) => {\n    // Queue the update; flush applies all pending updates in one pass (last per optionId wins).\n    pendingChildrenUpdates.push({ optionId, newChildren });\n    if (!flushScheduled) {\n      flushScheduled = true;\n      nextTick(flushPendingChildrenUpdates);\n    }\n  };\n\n  return {\n    handleUpdateChildren,\n  };\n};\n","<script setup lang=\"ts\">\nimport { computed, inject, ref } from \"vue\";\n\nimport PvTreeItem from \"./PvTreeItem.vue\";\nimport type { PvTreeOption, PvTreeSetting, PvTreeSettings } from \"./types\";\nimport { provideDraggingState } from \"./composables/useDraggingState\";\nimport { DraggingStateKey } from \"./symbols\";\nimport { useTreeUpdate } from \"./composables/useTreeUpdate\";\n\n// Only provide dragging state if a PvTreeGroup hasn't already provided it.\n// This allows multiple trees inside a PvTreeGroup to share the same state\n// for cross-tree drag indicators, while a standalone PvTree remains self-contained.\nif (!inject(DraggingStateKey, null)) {\n  provideDraggingState();\n}\n\ninterface PvTreeProps {\n  /** Per-field rendering and behavior settings for tree nodes */\n  settings: PvTreeSettings;\n  /** Default settings applied to all node types before field-specific overrides */\n  defaultSettings?: PvTreeSetting;\n  /** Enable drag-and-drop reordering of tree items */\n  isDraggable?: boolean;\n  /** Disable click-to-select behavior on tree items */\n  disableSelection?: boolean;\n  /**\n   * node_ids to force open, e.g. so a selection made from OUTSIDE the tree (a linked canvas or\n   * minimap) can reveal a row nested inside collapsed accordions without the caller reaching into\n   * the DOM. One-way only: an id here forces that row's accordion open, but removing it later does\n   * NOT close a row the reviewer may have opened themselves -- each row's own `accordionOpen` stays\n   * the source of truth otherwise, uncontrolled as before.\n   */\n  openNodeIds?: Array<string | number>;\n}\n\nconst props = withDefaults(defineProps<PvTreeProps>(), {\n  isDraggable: false,\n  disableSelection: false,\n});\n\nconst selectedOptions = defineModel<PvTreeOption[]>(\"selectedOptions\", { required: false });\nconst options = defineModel<PvTreeOption[]>(\"options\", { required: true });\nconst treeOpen = defineModel<boolean>(\"treeOpen\", { required: false });\n\nconst { handleUpdateChildren } = useTreeUpdate(options);\n\nconst treeRef = ref<HTMLElement | null>(null);\n// Where a shift-click range starts: the row last plain- or Cmd-clicked into the selection.\nconst anchorId = ref<PvTreeOption[\"node_id\"] | null>(null);\n\nconst isSelected = (nodeId: PvTreeOption[\"node_id\"]) =>\n  selectedOptions.value?.some((selectedOption) => selectedOption.node_id === nodeId) ?? false;\n\nconst optionsById = (nodes: PvTreeOption[], index = new Map<string, PvTreeOption>()) => {\n  nodes.forEach((node) => {\n    index.set(String(node.node_id), node);\n    optionsById(node.children ?? [], index);\n  });\n  return index;\n};\n\n// A row inside a closed accordion is rendered but hidden: in a closed `<details>`, outside its `<summary>`.\nconst isRowVisible = (row: HTMLElement) => {\n  for (let details = row.closest(\"details\"); details; details = details.parentElement?.closest(\"details\") ?? null) {\n    if (!details.open && !details.querySelector(\":scope > summary\")?.contains(row)) return false;\n  }\n  return true;\n};\n\n/** This tree's selectable rows that are on screen, as ids, in the order they are drawn. */\nconst visibleRowIds = () =>\n  [...(treeRef.value?.querySelectorAll<HTMLElement>(\"[data-pv-tree-select-id]\") ?? [])]\n    .filter(isRowVisible)\n    .map((row) => row.dataset.pvTreeSelectId!);\n\n/**\n * Where a shift-click range starts: the anchor while it is still selected and on screen here, else the\n * most recently selected row that is. The fallback is what Finder does with a selection it did not see\n * made -- one the host set, one from before a remount, or one whose anchor was clicked away.\n */\nconst rangeAnchorId = (rowIds: string[]): string | null => {\n  if (anchorId.value !== null && isSelected(anchorId.value) && rowIds.includes(String(anchorId.value))) {\n    return String(anchorId.value);\n  }\n  const lastSelected = [...(selectedOptions.value ?? [])]\n    .reverse()\n    .find((selectedOption) => rowIds.includes(String(selectedOption.node_id)));\n  return lastSelected ? String(lastSelected.node_id) : null;\n};\n\nconst handleTreeSelect = (option: PvTreeOption, event: MouseEvent) => {\n  const addModifier = event.metaKey || event.ctrlKey;\n  // Shift extends from the anchor, as in Finder: replacing the selection, or adding to it with Cmd/Ctrl\n  // too. The anchor stays put, so successive shift-clicks re-draw the range from the same row. Read\n  // from the DOM rather than `options`, because only the DOM knows which accordions are open.\n  if (event.shiftKey) {\n    const rowIds = visibleRowIds();\n    const fromId = rangeAnchorId(rowIds);\n    const to = rowIds.indexOf(String(option.node_id));\n    if (fromId !== null && to !== -1) {\n      const from = rowIds.indexOf(fromId);\n      const index = optionsById(options.value);\n      const range = rowIds\n        .slice(Math.min(from, to), Math.max(from, to) + 1)\n        .flatMap((id) => (index.has(id) ? [index.get(id)!] : []));\n      const kept = addModifier ? (selectedOptions.value ?? []) : [];\n      const keptIds = new Set(kept.map((selectedOption) => selectedOption.node_id));\n      selectedOptions.value = [...kept, ...range.filter((rangeOption) => !keptIds.has(rangeOption.node_id))];\n      anchorId.value = index.get(fromId)?.node_id ?? fromId;\n      return;\n    }\n  }\n  // Cmd on macOS, Ctrl elsewhere: the platform's own add-to-selection modifier. A click on a selected\n  // row takes it out; a plain one also drops the rest.\n  const wasSelected = isSelected(option.node_id);\n  const current = selectedOptions.value ?? [];\n  if (addModifier) {\n    selectedOptions.value = wasSelected\n      ? current.filter((selectedOption) => selectedOption.node_id !== option.node_id)\n      : [...current, option];\n  } else {\n    selectedOptions.value = wasSelected ? [] : [option];\n  }\n  // From the decision, not by re-reading the model: a parent-bound one only updates on its next render.\n  anchorId.value = wasSelected ? null : option.node_id;\n};\n\nconst computedSettings = computed(() => {\n  return Object.keys(props.settings).reduce((acc, key) => {\n    acc[key] = { ...props.defaultSettings, ...props.settings[key] };\n    return acc;\n  }, {} as PvTreeSettings);\n});\n</script>\n\n<template>\n  <div>\n    <div ref=\"treeRef\" class=\"pv-tree\" :class=\"{ 'pv-tree-disable-selection': disableSelection }\">\n      <div v-for=\"(option, index) in options\" :key=\"option.node_id\">\n        <PvTreeItem\n          :is-last-root-item=\"index === options.length - 1\"\n          :is-parent-path-open=\"true\"\n          :tree-open=\"treeOpen\"\n          :selected-options=\"selectedOptions\"\n          :option=\"option\"\n          :settings=\"computedSettings\"\n          :is-draggable=\"isDraggable\"\n          :disable-selection=\"disableSelection\"\n          :open-node-ids=\"openNodeIds\"\n          @handle-tree-select=\"({ option, event }) => handleTreeSelect(option, event)\"\n          @update:children=\"handleUpdateChildren\"\n        />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, inject, ref } from \"vue\";\n\nimport PvTreeItem from \"./PvTreeItem.vue\";\nimport type { PvTreeOption, PvTreeSetting, PvTreeSettings } from \"./types\";\nimport { provideDraggingState } from \"./composables/useDraggingState\";\nimport { DraggingStateKey } from \"./symbols\";\nimport { useTreeUpdate } from \"./composables/useTreeUpdate\";\n\n// Only provide dragging state if a PvTreeGroup hasn't already provided it.\n// This allows multiple trees inside a PvTreeGroup to share the same state\n// for cross-tree drag indicators, while a standalone PvTree remains self-contained.\nif (!inject(DraggingStateKey, null)) {\n  provideDraggingState();\n}\n\ninterface PvTreeProps {\n  /** Per-field rendering and behavior settings for tree nodes */\n  settings: PvTreeSettings;\n  /** Default settings applied to all node types before field-specific overrides */\n  defaultSettings?: PvTreeSetting;\n  /** Enable drag-and-drop reordering of tree items */\n  isDraggable?: boolean;\n  /** Disable click-to-select behavior on tree items */\n  disableSelection?: boolean;\n  /**\n   * node_ids to force open, e.g. so a selection made from OUTSIDE the tree (a linked canvas or\n   * minimap) can reveal a row nested inside collapsed accordions without the caller reaching into\n   * the DOM. One-way only: an id here forces that row's accordion open, but removing it later does\n   * NOT close a row the reviewer may have opened themselves -- each row's own `accordionOpen` stays\n   * the source of truth otherwise, uncontrolled as before.\n   */\n  openNodeIds?: Array<string | number>;\n}\n\nconst props = withDefaults(defineProps<PvTreeProps>(), {\n  isDraggable: false,\n  disableSelection: false,\n});\n\nconst selectedOptions = defineModel<PvTreeOption[]>(\"selectedOptions\", { required: false });\nconst options = defineModel<PvTreeOption[]>(\"options\", { required: true });\nconst treeOpen = defineModel<boolean>(\"treeOpen\", { required: false });\n\nconst { handleUpdateChildren } = useTreeUpdate(options);\n\nconst treeRef = ref<HTMLElement | null>(null);\n// Where a shift-click range starts: the row last plain- or Cmd-clicked into the selection.\nconst anchorId = ref<PvTreeOption[\"node_id\"] | null>(null);\n\nconst isSelected = (nodeId: PvTreeOption[\"node_id\"]) =>\n  selectedOptions.value?.some((selectedOption) => selectedOption.node_id === nodeId) ?? false;\n\nconst optionsById = (nodes: PvTreeOption[], index = new Map<string, PvTreeOption>()) => {\n  nodes.forEach((node) => {\n    index.set(String(node.node_id), node);\n    optionsById(node.children ?? [], index);\n  });\n  return index;\n};\n\n// A row inside a closed accordion is rendered but hidden: in a closed `<details>`, outside its `<summary>`.\nconst isRowVisible = (row: HTMLElement) => {\n  for (let details = row.closest(\"details\"); details; details = details.parentElement?.closest(\"details\") ?? null) {\n    if (!details.open && !details.querySelector(\":scope > summary\")?.contains(row)) return false;\n  }\n  return true;\n};\n\n/** This tree's selectable rows that are on screen, as ids, in the order they are drawn. */\nconst visibleRowIds = () =>\n  [...(treeRef.value?.querySelectorAll<HTMLElement>(\"[data-pv-tree-select-id]\") ?? [])]\n    .filter(isRowVisible)\n    .map((row) => row.dataset.pvTreeSelectId!);\n\n/**\n * Where a shift-click range starts: the anchor while it is still selected and on screen here, else the\n * most recently selected row that is. The fallback is what Finder does with a selection it did not see\n * made -- one the host set, one from before a remount, or one whose anchor was clicked away.\n */\nconst rangeAnchorId = (rowIds: string[]): string | null => {\n  if (anchorId.value !== null && isSelected(anchorId.value) && rowIds.includes(String(anchorId.value))) {\n    return String(anchorId.value);\n  }\n  const lastSelected = [...(selectedOptions.value ?? [])]\n    .reverse()\n    .find((selectedOption) => rowIds.includes(String(selectedOption.node_id)));\n  return lastSelected ? String(lastSelected.node_id) : null;\n};\n\nconst handleTreeSelect = (option: PvTreeOption, event: MouseEvent) => {\n  const addModifier = event.metaKey || event.ctrlKey;\n  // Shift extends from the anchor, as in Finder: replacing the selection, or adding to it with Cmd/Ctrl\n  // too. The anchor stays put, so successive shift-clicks re-draw the range from the same row. Read\n  // from the DOM rather than `options`, because only the DOM knows which accordions are open.\n  if (event.shiftKey) {\n    const rowIds = visibleRowIds();\n    const fromId = rangeAnchorId(rowIds);\n    const to = rowIds.indexOf(String(option.node_id));\n    if (fromId !== null && to !== -1) {\n      const from = rowIds.indexOf(fromId);\n      const index = optionsById(options.value);\n      const range = rowIds\n        .slice(Math.min(from, to), Math.max(from, to) + 1)\n        .flatMap((id) => (index.has(id) ? [index.get(id)!] : []));\n      const kept = addModifier ? (selectedOptions.value ?? []) : [];\n      const keptIds = new Set(kept.map((selectedOption) => selectedOption.node_id));\n      selectedOptions.value = [...kept, ...range.filter((rangeOption) => !keptIds.has(rangeOption.node_id))];\n      anchorId.value = index.get(fromId)?.node_id ?? fromId;\n      return;\n    }\n  }\n  // Cmd on macOS, Ctrl elsewhere: the platform's own add-to-selection modifier. A click on a selected\n  // row takes it out; a plain one also drops the rest.\n  const wasSelected = isSelected(option.node_id);\n  const current = selectedOptions.value ?? [];\n  if (addModifier) {\n    selectedOptions.value = wasSelected\n      ? current.filter((selectedOption) => selectedOption.node_id !== option.node_id)\n      : [...current, option];\n  } else {\n    selectedOptions.value = wasSelected ? [] : [option];\n  }\n  // From the decision, not by re-reading the model: a parent-bound one only updates on its next render.\n  anchorId.value = wasSelected ? null : option.node_id;\n};\n\nconst computedSettings = computed(() => {\n  return Object.keys(props.settings).reduce((acc, key) => {\n    acc[key] = { ...props.defaultSettings, ...props.settings[key] };\n    return acc;\n  }, {} as PvTreeSettings);\n});\n</script>\n\n<template>\n  <div>\n    <div ref=\"treeRef\" class=\"pv-tree\" :class=\"{ 'pv-tree-disable-selection': disableSelection }\">\n      <div v-for=\"(option, index) in options\" :key=\"option.node_id\">\n        <PvTreeItem\n          :is-last-root-item=\"index === options.length - 1\"\n          :is-parent-path-open=\"true\"\n          :tree-open=\"treeOpen\"\n          :selected-options=\"selectedOptions\"\n          :option=\"option\"\n          :settings=\"computedSettings\"\n          :is-draggable=\"isDraggable\"\n          :disable-selection=\"disableSelection\"\n          :open-node-ids=\"openNodeIds\"\n          @handle-tree-select=\"({ option, event }) => handleTreeSelect(option, event)\"\n          @update:children=\"handleUpdateChildren\"\n        />\n      </div>\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { provideDraggingState } from \"./composables/useDraggingState\";\n\n// Provides shared drag state to all PvTree children so cross-tree\n// drop indicators and drag status work correctly across sibling trees.\nprovideDraggingState();\n</script>\n\n<template>\n  <slot />\n</template>\n","<script setup lang=\"ts\">\nimport { provideDraggingState } from \"./composables/useDraggingState\";\n\n// Provides shared drag state to all PvTree children so cross-tree\n// drop indicators and drag status work correctly across sibling trees.\nprovideDraggingState();\n</script>\n\n<template>\n  <slot />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport type { PvProgressBarProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvProgressBarProps>(), {\n  disabled: false,\n  labelVariant: \"primary\",\n  progress: 0,\n  showLabel: false,\n  size: \"md\",\n});\n\n// Clamp to the valid 0–100 range so out-of-bounds values never overflow the bar.\nconst clampedProgress = computed(() => Math.min(100, Math.max(0, props.progress)));\nconst progressLabel = computed(() => `${clampedProgress.value}% Complete`);\n// Keep labelVariant as a label-only fallback for existing consumers.\nconst resolvedLabelVariant = computed(() => props.variant ?? props.labelVariant);\n// At the exact extremes the bar is a single solid color (fully empty or fully filled), so the\n// divider marker has no boundary left to mark\nconst atBoundary = computed(() => clampedProgress.value === 0 || clampedProgress.value === 100);\n</script>\n\n<template>\n  <div class=\"pv-full-width\">\n    <div v-if=\"showLabel || secondaryLabel\" class=\"pv-flex pv-stack-4\" style=\"--flex-justify: space-between\">\n      <p\n        v-if=\"showLabel\"\n        class=\"pv-text-title-sm\"\n        :class=\"resolvedLabelVariant === 'secondary' ? 'pv-progress-bar__label--secondary' : 'pv-text-brand'\"\n      >\n        {{ progressLabel }}\n      </p>\n      <span\n        v-if=\"secondaryLabel\"\n        class=\"pv-text-title-sm\"\n        :class=\"resolvedLabelVariant === 'secondary' ? 'pv-text-tertiary' : 'pv-text-subdued'\"\n      >\n        {{ secondaryLabel }}\n      </span>\n    </div>\n    <div\n      class=\"pv-progress-bar\"\n      :class=\"{\n        'pv-progress-bar--secondary': variant === 'secondary',\n        'pv-progress-bar--sm': size === 'sm',\n      }\"\n      :data-disabled=\"props.disabled ? true : undefined\"\n      :data-at-boundary=\"atBoundary ? true : undefined\"\n      :style=\"{\n        '--progress': `${clampedProgress}%`,\n      }\"\n    ></div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport type { PvProgressBarProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvProgressBarProps>(), {\n  disabled: false,\n  labelVariant: \"primary\",\n  progress: 0,\n  showLabel: false,\n  size: \"md\",\n});\n\n// Clamp to the valid 0–100 range so out-of-bounds values never overflow the bar.\nconst clampedProgress = computed(() => Math.min(100, Math.max(0, props.progress)));\nconst progressLabel = computed(() => `${clampedProgress.value}% Complete`);\n// Keep labelVariant as a label-only fallback for existing consumers.\nconst resolvedLabelVariant = computed(() => props.variant ?? props.labelVariant);\n// At the exact extremes the bar is a single solid color (fully empty or fully filled), so the\n// divider marker has no boundary left to mark\nconst atBoundary = computed(() => clampedProgress.value === 0 || clampedProgress.value === 100);\n</script>\n\n<template>\n  <div class=\"pv-full-width\">\n    <div v-if=\"showLabel || secondaryLabel\" class=\"pv-flex pv-stack-4\" style=\"--flex-justify: space-between\">\n      <p\n        v-if=\"showLabel\"\n        class=\"pv-text-title-sm\"\n        :class=\"resolvedLabelVariant === 'secondary' ? 'pv-progress-bar__label--secondary' : 'pv-text-brand'\"\n      >\n        {{ progressLabel }}\n      </p>\n      <span\n        v-if=\"secondaryLabel\"\n        class=\"pv-text-title-sm\"\n        :class=\"resolvedLabelVariant === 'secondary' ? 'pv-text-tertiary' : 'pv-text-subdued'\"\n      >\n        {{ secondaryLabel }}\n      </span>\n    </div>\n    <div\n      class=\"pv-progress-bar\"\n      :class=\"{\n        'pv-progress-bar--secondary': variant === 'secondary',\n        'pv-progress-bar--sm': size === 'sm',\n      }\"\n      :data-disabled=\"props.disabled ? true : undefined\"\n      :data-at-boundary=\"atBoundary ? true : undefined\"\n      :style=\"{\n        '--progress': `${clampedProgress}%`,\n      }\"\n    ></div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { PvDistributionBarProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvDistributionBarProps>(), {\n  size: \"lg\",\n});\n\nconst totalValue = computed(() => {\n  return props.values?.reduce((acc, curr) => acc + curr, 0) ?? 0;\n});\n\nconst firstNonZeroIndex = computed(() => props.values?.findIndex((v) => v > 0) ?? -1);\nconst lastNonZeroIndex = computed(() => props.values?.findLastIndex((v) => v > 0) ?? -1);\n\nconst barStyles = (value: number, index: number) => {\n  const isFirstVisibleElement = index === firstNonZeroIndex.value;\n  const isLastVisibleElement = index === lastNonZeroIndex.value;\n  const radius = (corner: boolean) => (corner ? \"12px\" : \"0\");\n  // Guard against division by zero when every value is 0 (avoids NaN% widths).\n  const width = totalValue.value > 0 ? (value / totalValue.value) * 100 : 0;\n\n  return {\n    width: `${width}%`,\n    height: \"100%\",\n    borderRadius: `${radius(isFirstVisibleElement)} ${radius(isLastVisibleElement)} ${radius(isLastVisibleElement)} ${radius(isFirstVisibleElement)}`,\n  };\n};\n\nconst barWrapper = computed(() => {\n  const baseProps = {\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.size === \"xs\") {\n    return {\n      ...baseProps,\n      height: \"8px\",\n    };\n  }\n\n  return {\n    ...baseProps,\n    height: \"24px\",\n  };\n});\n\n// The 15 dataviz colors, repeating after the last one.\nconst DATAVIZ_COLOR_COUNT = 15;\n\nconst barColors = (index: number) => `pv-data-surface-visualization-${(index % DATAVIZ_COLOR_COUNT) + 1}`;\n</script>\n\n<template>\n  <div class=\"pv-flex\" :style=\"barWrapper\">\n    <div v-for=\"(value, index) in values\" :key=\"index\" :class=\"[barColors(index)]\" :style=\"barStyles(value, index)\" />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { PvDistributionBarProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvDistributionBarProps>(), {\n  size: \"lg\",\n});\n\nconst totalValue = computed(() => {\n  return props.values?.reduce((acc, curr) => acc + curr, 0) ?? 0;\n});\n\nconst firstNonZeroIndex = computed(() => props.values?.findIndex((v) => v > 0) ?? -1);\nconst lastNonZeroIndex = computed(() => props.values?.findLastIndex((v) => v > 0) ?? -1);\n\nconst barStyles = (value: number, index: number) => {\n  const isFirstVisibleElement = index === firstNonZeroIndex.value;\n  const isLastVisibleElement = index === lastNonZeroIndex.value;\n  const radius = (corner: boolean) => (corner ? \"12px\" : \"0\");\n  // Guard against division by zero when every value is 0 (avoids NaN% widths).\n  const width = totalValue.value > 0 ? (value / totalValue.value) * 100 : 0;\n\n  return {\n    width: `${width}%`,\n    height: \"100%\",\n    borderRadius: `${radius(isFirstVisibleElement)} ${radius(isLastVisibleElement)} ${radius(isLastVisibleElement)} ${radius(isFirstVisibleElement)}`,\n  };\n};\n\nconst barWrapper = computed(() => {\n  const baseProps = {\n    \"--flex-gap\": \"4px\",\n  };\n\n  if (props.size === \"xs\") {\n    return {\n      ...baseProps,\n      height: \"8px\",\n    };\n  }\n\n  return {\n    ...baseProps,\n    height: \"24px\",\n  };\n});\n\n// The 15 dataviz colors, repeating after the last one.\nconst DATAVIZ_COLOR_COUNT = 15;\n\nconst barColors = (index: number) => `pv-data-surface-visualization-${(index % DATAVIZ_COLOR_COUNT) + 1}`;\n</script>\n\n<template>\n  <div class=\"pv-flex\" :style=\"barWrapper\">\n    <div v-for=\"(value, index) in values\" :key=\"index\" :class=\"[barColors(index)]\" :style=\"barStyles(value, index)\" />\n  </div>\n</template>\n","// Finer than {1, 2, 5, 10} so a rounded axis bound leaves at most ~25% empty space past the data.\nconst NICE_STEPS = [1, 1.5, 2, 3, 4, 5, 6, 8, 10];\n\nconst roundUpToNice = (value: number): number => {\n  const pow = Math.pow(10, Math.floor(Math.log10(value)));\n  const step = NICE_STEPS.find((s) => value / pow <= s) ?? 10;\n  return step * pow;\n};\n\n/** Rounds `value` up to a clean axis bound. Returns 100 for zero or negative input so an empty axis still has a scale. */\nexport const niceCeiling = (value: number): number => (value > 0 ? roundUpToNice(value) : 100);\n\n/** Tick interval that gives about five ticks on an axis from 0 to `max`. */\nexport const niceStep = (max: number): number => (max > 0 ? roundUpToNice(max / 5) : 10);\n\n/** Tick positions from 0 to `max`, inclusive. */\nexport const axisTicks = (max: number): number[] => {\n  const step = niceStep(max);\n  const ticks: number[] = [];\n  // Rounding keeps float steps like 1.5 from drifting (e.g. 4.5000000001).\n  for (let i = 0; i * step <= max + 1e-6; i++) ticks.push(Number((i * step).toPrecision(12)));\n  return ticks;\n};\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", maximumFractionDigits: 0 });\n\nexport const formatWholeDollars = (value: number): string => usd.format(value);\n","<script setup lang=\"ts\">\nimport { useElementSize } from \"@vueuse/core\";\nimport { computed, useTemplateRef } from \"vue\";\nimport { axisTicks, formatWholeDollars, niceCeiling } from \"./helpers\";\nimport type { PvBoxPlotMarker, PvBoxPlotProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvBoxPlotProps>(), {\n  ariaLabel: undefined,\n  height: 180,\n  highlight: null,\n  hideLabels: false,\n  markers: () => [],\n  stats: null,\n  valueFormatter: formatWholeDollars,\n  xMax: null,\n});\n\n// Colors with a Pit Viper theming hook use it, with the compiled hex as the fallback, the same way Pit Viper's own\n// CSS does. SVG presentation attributes can't resolve var(), so these are applied through `style`.\nconst TEAL = \"var(--color-text-brand, #16696D)\";\nconst TERTIARY = \"var(--color-text-tertiary, #6E8081)\";\nconst AXIS = \"var(--color-border, #E3E7EA)\";\nconst CORAL = \"var(--color-data-viz-3, #FF7A4E)\";\n// No hook exists for these, so they are the compiled SCSS tokens.\nconst DEEP_TEAL = \"#02363D\"; // $primary-darken-6\nconst LIGHT_TEAL = \"#B0E8E4\"; // $primary-lighten-4\nconst TICK = \"#D2D8DC\"; // $tag-secondary-border-color\n\n// Room around the plot area: 40px each side so edge labels centred on P10/P90 or the axis ends aren't clipped, 44px\n// above for the callout row (median or marker label), 36px below for the axis and its tick labels.\nconst PAD = { left: 40, right: 40, top: 44, bottom: 36 };\n// Used until the container is measured, and in environments without layout (tests, SSR).\nconst FALLBACK_WIDTH = 520;\n// Callout labels are 12px bold, about 7px per character. Two centred labels overlap when their centres are closer than\n// half their combined widths; the gap keeps them from touching.\nconst CALLOUT_CHAR_WIDTH = 7;\nconst CALLOUT_GAP = 8;\n// Box height: 44px at most, leaving 4px above and below inside the plot area, and never under 12px on short plots.\nconst MAX_BOX_HEIGHT = 44;\nconst BOX_INSET = 8;\nconst MIN_BOX_HEIGHT = 12;\n\nconst container = useTemplateRef<HTMLDivElement>(\"container\");\nconst { width: measuredWidth } = useElementSize(container);\n\nconst width = computed(() => measuredWidth.value || FALLBACK_WIDTH);\n\nconst geometry = computed(() => {\n  const stats = props.stats;\n  if (!stats) return null;\n  const plotWidth = width.value - PAD.left - PAD.right;\n  const plotHeight = props.height - PAD.top - PAD.bottom;\n  // 5% headroom past the data fits the P90 label without leaving much dead axis.\n  const upper = Math.max(stats.p90, ...props.markers.map((marker) => marker.value), props.highlight ?? 0);\n  const max = props.xMax && props.xMax > 0 ? props.xMax : niceCeiling(upper * 1.05);\n  const x = (value: number) => PAD.left + (Math.min(Math.max(value, 0), max) / max) * plotWidth;\n  const cy = PAD.top + plotHeight / 2;\n  const boxHeight = Math.min(MAX_BOX_HEIGHT, Math.max(plotHeight - BOX_INSET, MIN_BOX_HEIGHT));\n  return {\n    x,\n    cy,\n    boxTop: cy - boxHeight / 2,\n    boxBottom: cy + boxHeight / 2,\n    axisY: PAD.top + plotHeight,\n    axisStart: PAD.left,\n    axisEnd: PAD.left + plotWidth,\n    calloutY: PAD.top - 8,\n    ticks: axisTicks(max).map((value) => ({ value, x: x(value) })),\n    stats,\n  };\n});\n\nconst percentileLabels = computed(() => {\n  const geo = geometry.value;\n  if (!geo) return [];\n  return ([\"p10\", \"p25\", \"p50\", \"p75\", \"p90\"] as const).map((key) => ({ key, x: geo.x(geo.stats[key]) }));\n});\n\nconst markerLabel = (marker: PvBoxPlotMarker) => `${marker.label} ${props.valueFormatter(marker.value)}`;\n\nconst labelledMarkers = computed(() => {\n  const geo = geometry.value;\n  if (!geo) return [];\n  return props.markers\n    .filter((marker) => marker.label)\n    .map((marker) => ({ ...marker, x: geo.x(marker.value), color: marker.color ?? CORAL }));\n});\n\nconst medianCallout = computed(() => (props.stats ? `Median ${props.valueFormatter(props.stats.p50)}` : \"\"));\n\n// A labelled marker takes the callout row, so the median callout is dropped when the two labels would overlap.\nconst showMedianCallout = computed(() => {\n  const geo = geometry.value;\n  if (!geo || props.hideLabels) return false;\n  const medianX = geo.x(geo.stats.p50);\n  return labelledMarkers.value.every((marker) => {\n    const chars = medianCallout.value.length + markerLabel(marker).length;\n    return Math.abs(marker.x - medianX) >= (chars * CALLOUT_CHAR_WIDTH) / 2 + CALLOUT_GAP;\n  });\n});\n\nconst label = computed(() => {\n  if (props.ariaLabel) return props.ariaLabel;\n  const stats = props.stats;\n  if (!stats) return \"\";\n  const format = props.valueFormatter;\n  const parts = [`P10 ${format(stats.p10)} to P90 ${format(stats.p90)}, median ${format(stats.p50)}`];\n  for (const marker of props.markers) {\n    parts.push(`${marker.label ?? \"Marker\"} ${format(marker.value)}`);\n  }\n  return parts.join(\"; \");\n});\n</script>\n\n<template>\n  <div ref=\"container\">\n    <svg\n      v-if=\"geometry\"\n      :width=\"width\"\n      :height=\"height\"\n      role=\"img\"\n      :aria-label=\"label\"\n      display=\"block\"\n      overflow=\"visible\"\n    >\n      <line\n        :x1=\"geometry.axisStart\"\n        :y1=\"geometry.axisY\"\n        :x2=\"geometry.axisEnd\"\n        :y2=\"geometry.axisY\"\n        :style=\"{ stroke: AXIS }\"\n      />\n      <g v-for=\"tick in geometry.ticks\" :key=\"tick.value\" data-testid=\"pv-box-plot-tick\">\n        <line :x1=\"tick.x\" :y1=\"geometry.axisY\" :x2=\"tick.x\" :y2=\"geometry.axisY + 4\" :stroke=\"TICK\" />\n        <text :x=\"tick.x\" :y=\"geometry.axisY + 16\" font-size=\"10\" :style=\"{ fill: TERTIARY }\" text-anchor=\"middle\">\n          {{ valueFormatter(tick.value) }}\n        </text>\n      </g>\n\n      <line\n        :x1=\"geometry.x(geometry.stats.p10)\"\n        :y1=\"geometry.cy\"\n        :x2=\"geometry.x(geometry.stats.p90)\"\n        :y2=\"geometry.cy\"\n        :style=\"{ stroke: TEAL }\"\n        data-testid=\"pv-box-plot-whisker\"\n      />\n      <line\n        v-for=\"key in ['p10', 'p90'] as const\"\n        :key=\"key\"\n        :x1=\"geometry.x(geometry.stats[key])\"\n        :y1=\"geometry.cy - 8\"\n        :x2=\"geometry.x(geometry.stats[key])\"\n        :y2=\"geometry.cy + 8\"\n        :style=\"{ stroke: TEAL }\"\n        stroke-width=\"1.5\"\n      />\n      <rect\n        :x=\"geometry.x(geometry.stats.p25)\"\n        :y=\"geometry.boxTop\"\n        :width=\"geometry.x(geometry.stats.p75) - geometry.x(geometry.stats.p25)\"\n        :height=\"geometry.boxBottom - geometry.boxTop\"\n        :fill=\"LIGHT_TEAL\"\n        fill-opacity=\"0.55\"\n        :style=\"{ stroke: TEAL }\"\n        rx=\"2\"\n        data-testid=\"pv-box-plot-box\"\n      />\n      <line\n        :x1=\"geometry.x(geometry.stats.p50)\"\n        :y1=\"geometry.boxTop\"\n        :x2=\"geometry.x(geometry.stats.p50)\"\n        :y2=\"geometry.boxBottom\"\n        :stroke=\"DEEP_TEAL\"\n        stroke-width=\"2.5\"\n        data-testid=\"pv-box-plot-median\"\n      />\n\n      <g v-if=\"!hideLabels\" font-size=\"10\" data-testid=\"pv-box-plot-labels\">\n        <text\n          v-for=\"percentile in percentileLabels\"\n          :key=\"percentile.key\"\n          :x=\"percentile.x\"\n          :y=\"geometry.boxBottom + 14\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: percentile.key === 'p50' ? DEEP_TEAL : TEAL }\"\n          :font-weight=\"percentile.key === 'p50' ? 600 : undefined\"\n        >\n          {{ percentile.key }}\n        </text>\n        <text\n          v-for=\"key in ['p10', 'p90'] as const\"\n          :key=\"`${key}-value`\"\n          :x=\"geometry.x(geometry.stats[key])\"\n          :y=\"geometry.boxTop - 10\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: TEAL }\"\n        >\n          {{ valueFormatter(geometry.stats[key]) }}\n        </text>\n      </g>\n\n      <g v-if=\"showMedianCallout\" data-testid=\"pv-box-plot-median-callout\">\n        <!-- Dotted bridge from the median line up to its callout, so the label doesn't float in empty space. -->\n        <line\n          :x1=\"geometry.x(geometry.stats.p50)\"\n          :y1=\"geometry.boxTop\"\n          :x2=\"geometry.x(geometry.stats.p50)\"\n          :y2=\"geometry.calloutY + 4\"\n          :stroke=\"DEEP_TEAL\"\n          stroke-dasharray=\"2 2\"\n          stroke-opacity=\"0.5\"\n        />\n        <text\n          :x=\"geometry.x(geometry.stats.p50)\"\n          :y=\"geometry.calloutY\"\n          text-anchor=\"middle\"\n          :fill=\"DEEP_TEAL\"\n          font-size=\"12\"\n          font-weight=\"700\"\n        >\n          {{ medianCallout }}\n        </text>\n      </g>\n\n      <circle\n        v-for=\"(marker, index) in markers\"\n        :key=\"`marker-${index}`\"\n        :cx=\"geometry.x(marker.value)\"\n        :cy=\"geometry.cy\"\n        r=\"7\"\n        :style=\"{ fill: marker.color ?? CORAL }\"\n        stroke=\"#fff\"\n        stroke-width=\"2\"\n        data-testid=\"pv-box-plot-marker\"\n      />\n      <g\n        v-for=\"(marker, index) in labelledMarkers\"\n        :key=\"`marker-label-${index}`\"\n        data-testid=\"pv-box-plot-marker-label\"\n      >\n        <line\n          :x1=\"marker.x\"\n          :y1=\"geometry.cy - 9\"\n          :x2=\"marker.x\"\n          :y2=\"geometry.calloutY + 4\"\n          :style=\"{ stroke: marker.color }\"\n          stroke-dasharray=\"2 2\"\n          stroke-opacity=\"0.6\"\n        />\n        <text\n          :x=\"marker.x\"\n          :y=\"geometry.calloutY\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: marker.color }\"\n          font-size=\"12\"\n          font-weight=\"700\"\n        >\n          {{ markerLabel(marker) }}\n        </text>\n      </g>\n\n      <g v-if=\"highlight != null\" data-testid=\"pv-box-plot-highlight\">\n        <line\n          :x1=\"geometry.x(highlight)\"\n          :y1=\"geometry.boxTop - 4\"\n          :x2=\"geometry.x(highlight)\"\n          :y2=\"geometry.boxBottom + 4\"\n          :style=\"{ stroke: CORAL }\"\n          stroke-width=\"2\"\n          stroke-dasharray=\"3 2\"\n        />\n        <circle\n          :cx=\"geometry.x(highlight)\"\n          :cy=\"geometry.cy\"\n          r=\"4\"\n          :style=\"{ fill: CORAL }\"\n          stroke=\"#fff\"\n          stroke-width=\"1.5\"\n        />\n      </g>\n    </svg>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useElementSize } from \"@vueuse/core\";\nimport { computed, useTemplateRef } from \"vue\";\nimport { axisTicks, formatWholeDollars, niceCeiling } from \"./helpers\";\nimport type { PvBoxPlotMarker, PvBoxPlotProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvBoxPlotProps>(), {\n  ariaLabel: undefined,\n  height: 180,\n  highlight: null,\n  hideLabels: false,\n  markers: () => [],\n  stats: null,\n  valueFormatter: formatWholeDollars,\n  xMax: null,\n});\n\n// Colors with a Pit Viper theming hook use it, with the compiled hex as the fallback, the same way Pit Viper's own\n// CSS does. SVG presentation attributes can't resolve var(), so these are applied through `style`.\nconst TEAL = \"var(--color-text-brand, #16696D)\";\nconst TERTIARY = \"var(--color-text-tertiary, #6E8081)\";\nconst AXIS = \"var(--color-border, #E3E7EA)\";\nconst CORAL = \"var(--color-data-viz-3, #FF7A4E)\";\n// No hook exists for these, so they are the compiled SCSS tokens.\nconst DEEP_TEAL = \"#02363D\"; // $primary-darken-6\nconst LIGHT_TEAL = \"#B0E8E4\"; // $primary-lighten-4\nconst TICK = \"#D2D8DC\"; // $tag-secondary-border-color\n\n// Room around the plot area: 40px each side so edge labels centred on P10/P90 or the axis ends aren't clipped, 44px\n// above for the callout row (median or marker label), 36px below for the axis and its tick labels.\nconst PAD = { left: 40, right: 40, top: 44, bottom: 36 };\n// Used until the container is measured, and in environments without layout (tests, SSR).\nconst FALLBACK_WIDTH = 520;\n// Callout labels are 12px bold, about 7px per character. Two centred labels overlap when their centres are closer than\n// half their combined widths; the gap keeps them from touching.\nconst CALLOUT_CHAR_WIDTH = 7;\nconst CALLOUT_GAP = 8;\n// Box height: 44px at most, leaving 4px above and below inside the plot area, and never under 12px on short plots.\nconst MAX_BOX_HEIGHT = 44;\nconst BOX_INSET = 8;\nconst MIN_BOX_HEIGHT = 12;\n\nconst container = useTemplateRef<HTMLDivElement>(\"container\");\nconst { width: measuredWidth } = useElementSize(container);\n\nconst width = computed(() => measuredWidth.value || FALLBACK_WIDTH);\n\nconst geometry = computed(() => {\n  const stats = props.stats;\n  if (!stats) return null;\n  const plotWidth = width.value - PAD.left - PAD.right;\n  const plotHeight = props.height - PAD.top - PAD.bottom;\n  // 5% headroom past the data fits the P90 label without leaving much dead axis.\n  const upper = Math.max(stats.p90, ...props.markers.map((marker) => marker.value), props.highlight ?? 0);\n  const max = props.xMax && props.xMax > 0 ? props.xMax : niceCeiling(upper * 1.05);\n  const x = (value: number) => PAD.left + (Math.min(Math.max(value, 0), max) / max) * plotWidth;\n  const cy = PAD.top + plotHeight / 2;\n  const boxHeight = Math.min(MAX_BOX_HEIGHT, Math.max(plotHeight - BOX_INSET, MIN_BOX_HEIGHT));\n  return {\n    x,\n    cy,\n    boxTop: cy - boxHeight / 2,\n    boxBottom: cy + boxHeight / 2,\n    axisY: PAD.top + plotHeight,\n    axisStart: PAD.left,\n    axisEnd: PAD.left + plotWidth,\n    calloutY: PAD.top - 8,\n    ticks: axisTicks(max).map((value) => ({ value, x: x(value) })),\n    stats,\n  };\n});\n\nconst percentileLabels = computed(() => {\n  const geo = geometry.value;\n  if (!geo) return [];\n  return ([\"p10\", \"p25\", \"p50\", \"p75\", \"p90\"] as const).map((key) => ({ key, x: geo.x(geo.stats[key]) }));\n});\n\nconst markerLabel = (marker: PvBoxPlotMarker) => `${marker.label} ${props.valueFormatter(marker.value)}`;\n\nconst labelledMarkers = computed(() => {\n  const geo = geometry.value;\n  if (!geo) return [];\n  return props.markers\n    .filter((marker) => marker.label)\n    .map((marker) => ({ ...marker, x: geo.x(marker.value), color: marker.color ?? CORAL }));\n});\n\nconst medianCallout = computed(() => (props.stats ? `Median ${props.valueFormatter(props.stats.p50)}` : \"\"));\n\n// A labelled marker takes the callout row, so the median callout is dropped when the two labels would overlap.\nconst showMedianCallout = computed(() => {\n  const geo = geometry.value;\n  if (!geo || props.hideLabels) return false;\n  const medianX = geo.x(geo.stats.p50);\n  return labelledMarkers.value.every((marker) => {\n    const chars = medianCallout.value.length + markerLabel(marker).length;\n    return Math.abs(marker.x - medianX) >= (chars * CALLOUT_CHAR_WIDTH) / 2 + CALLOUT_GAP;\n  });\n});\n\nconst label = computed(() => {\n  if (props.ariaLabel) return props.ariaLabel;\n  const stats = props.stats;\n  if (!stats) return \"\";\n  const format = props.valueFormatter;\n  const parts = [`P10 ${format(stats.p10)} to P90 ${format(stats.p90)}, median ${format(stats.p50)}`];\n  for (const marker of props.markers) {\n    parts.push(`${marker.label ?? \"Marker\"} ${format(marker.value)}`);\n  }\n  return parts.join(\"; \");\n});\n</script>\n\n<template>\n  <div ref=\"container\">\n    <svg\n      v-if=\"geometry\"\n      :width=\"width\"\n      :height=\"height\"\n      role=\"img\"\n      :aria-label=\"label\"\n      display=\"block\"\n      overflow=\"visible\"\n    >\n      <line\n        :x1=\"geometry.axisStart\"\n        :y1=\"geometry.axisY\"\n        :x2=\"geometry.axisEnd\"\n        :y2=\"geometry.axisY\"\n        :style=\"{ stroke: AXIS }\"\n      />\n      <g v-for=\"tick in geometry.ticks\" :key=\"tick.value\" data-testid=\"pv-box-plot-tick\">\n        <line :x1=\"tick.x\" :y1=\"geometry.axisY\" :x2=\"tick.x\" :y2=\"geometry.axisY + 4\" :stroke=\"TICK\" />\n        <text :x=\"tick.x\" :y=\"geometry.axisY + 16\" font-size=\"10\" :style=\"{ fill: TERTIARY }\" text-anchor=\"middle\">\n          {{ valueFormatter(tick.value) }}\n        </text>\n      </g>\n\n      <line\n        :x1=\"geometry.x(geometry.stats.p10)\"\n        :y1=\"geometry.cy\"\n        :x2=\"geometry.x(geometry.stats.p90)\"\n        :y2=\"geometry.cy\"\n        :style=\"{ stroke: TEAL }\"\n        data-testid=\"pv-box-plot-whisker\"\n      />\n      <line\n        v-for=\"key in ['p10', 'p90'] as const\"\n        :key=\"key\"\n        :x1=\"geometry.x(geometry.stats[key])\"\n        :y1=\"geometry.cy - 8\"\n        :x2=\"geometry.x(geometry.stats[key])\"\n        :y2=\"geometry.cy + 8\"\n        :style=\"{ stroke: TEAL }\"\n        stroke-width=\"1.5\"\n      />\n      <rect\n        :x=\"geometry.x(geometry.stats.p25)\"\n        :y=\"geometry.boxTop\"\n        :width=\"geometry.x(geometry.stats.p75) - geometry.x(geometry.stats.p25)\"\n        :height=\"geometry.boxBottom - geometry.boxTop\"\n        :fill=\"LIGHT_TEAL\"\n        fill-opacity=\"0.55\"\n        :style=\"{ stroke: TEAL }\"\n        rx=\"2\"\n        data-testid=\"pv-box-plot-box\"\n      />\n      <line\n        :x1=\"geometry.x(geometry.stats.p50)\"\n        :y1=\"geometry.boxTop\"\n        :x2=\"geometry.x(geometry.stats.p50)\"\n        :y2=\"geometry.boxBottom\"\n        :stroke=\"DEEP_TEAL\"\n        stroke-width=\"2.5\"\n        data-testid=\"pv-box-plot-median\"\n      />\n\n      <g v-if=\"!hideLabels\" font-size=\"10\" data-testid=\"pv-box-plot-labels\">\n        <text\n          v-for=\"percentile in percentileLabels\"\n          :key=\"percentile.key\"\n          :x=\"percentile.x\"\n          :y=\"geometry.boxBottom + 14\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: percentile.key === 'p50' ? DEEP_TEAL : TEAL }\"\n          :font-weight=\"percentile.key === 'p50' ? 600 : undefined\"\n        >\n          {{ percentile.key }}\n        </text>\n        <text\n          v-for=\"key in ['p10', 'p90'] as const\"\n          :key=\"`${key}-value`\"\n          :x=\"geometry.x(geometry.stats[key])\"\n          :y=\"geometry.boxTop - 10\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: TEAL }\"\n        >\n          {{ valueFormatter(geometry.stats[key]) }}\n        </text>\n      </g>\n\n      <g v-if=\"showMedianCallout\" data-testid=\"pv-box-plot-median-callout\">\n        <!-- Dotted bridge from the median line up to its callout, so the label doesn't float in empty space. -->\n        <line\n          :x1=\"geometry.x(geometry.stats.p50)\"\n          :y1=\"geometry.boxTop\"\n          :x2=\"geometry.x(geometry.stats.p50)\"\n          :y2=\"geometry.calloutY + 4\"\n          :stroke=\"DEEP_TEAL\"\n          stroke-dasharray=\"2 2\"\n          stroke-opacity=\"0.5\"\n        />\n        <text\n          :x=\"geometry.x(geometry.stats.p50)\"\n          :y=\"geometry.calloutY\"\n          text-anchor=\"middle\"\n          :fill=\"DEEP_TEAL\"\n          font-size=\"12\"\n          font-weight=\"700\"\n        >\n          {{ medianCallout }}\n        </text>\n      </g>\n\n      <circle\n        v-for=\"(marker, index) in markers\"\n        :key=\"`marker-${index}`\"\n        :cx=\"geometry.x(marker.value)\"\n        :cy=\"geometry.cy\"\n        r=\"7\"\n        :style=\"{ fill: marker.color ?? CORAL }\"\n        stroke=\"#fff\"\n        stroke-width=\"2\"\n        data-testid=\"pv-box-plot-marker\"\n      />\n      <g\n        v-for=\"(marker, index) in labelledMarkers\"\n        :key=\"`marker-label-${index}`\"\n        data-testid=\"pv-box-plot-marker-label\"\n      >\n        <line\n          :x1=\"marker.x\"\n          :y1=\"geometry.cy - 9\"\n          :x2=\"marker.x\"\n          :y2=\"geometry.calloutY + 4\"\n          :style=\"{ stroke: marker.color }\"\n          stroke-dasharray=\"2 2\"\n          stroke-opacity=\"0.6\"\n        />\n        <text\n          :x=\"marker.x\"\n          :y=\"geometry.calloutY\"\n          text-anchor=\"middle\"\n          :style=\"{ fill: marker.color }\"\n          font-size=\"12\"\n          font-weight=\"700\"\n        >\n          {{ markerLabel(marker) }}\n        </text>\n      </g>\n\n      <g v-if=\"highlight != null\" data-testid=\"pv-box-plot-highlight\">\n        <line\n          :x1=\"geometry.x(highlight)\"\n          :y1=\"geometry.boxTop - 4\"\n          :x2=\"geometry.x(highlight)\"\n          :y2=\"geometry.boxBottom + 4\"\n          :style=\"{ stroke: CORAL }\"\n          stroke-width=\"2\"\n          stroke-dasharray=\"3 2\"\n        />\n        <circle\n          :cx=\"geometry.x(highlight)\"\n          :cy=\"geometry.cy\"\n          r=\"4\"\n          :style=\"{ fill: CORAL }\"\n          stroke=\"#fff\"\n          stroke-width=\"1.5\"\n        />\n      </g>\n    </svg>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useAttrs, useId, watch } from \"vue\";\nimport type { PropType } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport type { PvRangeProps, PvRangeValue } from \"./types\";\n\ntype RangeBounds = { max: number; min: number };\ntype RangeInputName = \"min\" | \"max\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\n/**\n * Native range inputs address a log-scaled track by position instead of by value. 10,000 positions is\n * finer than any display can resolve, so dragging never feels notched, and the values it produces are\n * snapped by magnitude anyway.\n */\nconst POSITION_STEPS = 10_000;\n/** Narrowest dual-mode input, matching the width used before bounds-aware sizing. */\nconst MIN_INPUT_WIDTH = \"4.6875rem\";\n/** Share of a log-scaled track covered by one arrow key press. */\nconst KEYBOARD_POSITION_STEP = 0.01;\n\nconst props = withDefaults(defineProps<PvRangeProps>(), {\n  allowMinMaxEqual: true,\n  alwaysEditMin: false,\n  color: \"single\",\n  dataType: null,\n  disabled: false,\n  inputIcon: null,\n  label: \"Range\",\n  max: null,\n  maxLabel: \"Max\",\n  min: null,\n  minLabel: \"Min\",\n  mode: \"single\",\n  scale: \"linear\",\n  showBoundLabels: false,\n  showClear: true,\n  showInputs: true,\n  showValueTooltips: true,\n  size: \"md\",\n  sliderStep: null,\n  step: null,\n  valueDecimals: null,\n});\n\nconst modelValue = defineModel<number>({ default: 0, type: Number });\nconst rangeValue = defineModel<PvRangeValue>(\"rangeValue\", {\n  default: () => ({ max: null, min: null }),\n  type: Object as PropType<PvRangeValue>,\n});\n\nconst attrs = useAttrs();\nconst id = useId();\nconst maxInputId = `${id}-max`;\nconst minInputId = `${id}-min`;\nconst maxText = ref(\"\");\nconst minText = ref(\"\");\nconst activeHandle = ref<RangeInputName | null>(null);\nconst focusedInput = ref<RangeInputName | null>(null);\nconst isSingleHandleActive = ref(false);\nconst sliderRef = ref<HTMLElement | null>(null);\n\nlet removePointerListeners: (() => void) | null = null;\nlet removeSinglePointerListeners: (() => void) | null = null;\n\nconst isFiniteNumber = (value: unknown): value is number => typeof value === \"number\" && Number.isFinite(value);\nconst toFiniteNumber = (value: unknown): number | null => (isFiniteNumber(value) ? value : null);\n\nconst parseNumber = (value: string): number | null => {\n  const textValue = value.trim();\n  if (textValue === \"\") return null;\n\n  const parsed = Number(textValue.replace(/[^0-9.\\-]/g, \"\"));\n  return Number.isFinite(parsed) ? parsed : null;\n};\n\nconst getDefaultDecimals = (dataType?: string | null): number | null => {\n  if (dataType === \"currency\" || dataType === \"integer\" || dataType === \"percent\") return 0;\n  return null;\n};\n\nconst getFractionDigits = () => {\n  if (props.valueDecimals !== null && props.valueDecimals !== undefined) return Math.max(0, props.valueDecimals);\n  const defaultDecimals = getDefaultDecimals(props.dataType);\n  if (defaultDecimals !== null) return defaultDecimals;\n  return 2;\n};\n\n/** Cached because formatting runs on every tooltip, label, and aria-valuetext update while dragging. */\nconst numberFormatter = computed(\n  () =>\n    new Intl.NumberFormat(\"en-US\", {\n      maximumFractionDigits: getFractionDigits(),\n      minimumFractionDigits: 0,\n    }),\n);\n\nconst formatNumber = (value: number): string => numberFormatter.value.format(value);\n\n/** Grouped digits keep six-figure bounds readable in the inputs; parseNumber strips the separators back out. */\nconst formatInputValue = (value: number): string => formatNumber(value);\n\nconst formatDisplayValue = (value: number): string => {\n  const formattedNumber = formatNumber(value);\n\n  if (props.dataType === \"currency\") return `$${formattedNumber}`;\n  return props.dataType === \"percent\" ? `${formattedNumber}%` : formattedNumber;\n};\n\nconst isLogScale = computed(() => props.scale === \"log\");\nconst finiteStep = computed(() => toFiniteNumber(props.step));\nconst finiteSliderStep = computed(() => toFiniteNumber(props.sliderStep));\nconst dualNumericStep = computed(() => (finiteStep.value !== null && finiteStep.value > 0 ? finiteStep.value : 0));\nconst dualNumericSliderStep = computed(() => {\n  if (finiteSliderStep.value !== null && finiteSliderStep.value > 0) {\n    return Math.max(finiteSliderStep.value, dualNumericStep.value);\n  }\n  return dualNumericStep.value;\n});\nconst dualInputStep = computed(() => (dualNumericStep.value > 0 ? String(dualNumericStep.value) : \"any\"));\nconst dualSliderStep = computed(() => {\n  if (isLogScale.value) return \"1\";\n  return dualNumericSliderStep.value > 0 ? String(dualNumericSliderStep.value) : \"any\";\n});\nconst singleNumericStep = computed(() => {\n  if (finiteStep.value === null) return 1;\n  return finiteStep.value > 0 ? finiteStep.value : 0;\n});\nconst singleNumericSliderStep = computed(() => {\n  if (finiteSliderStep.value !== null && finiteSliderStep.value > 0) {\n    return Math.max(finiteSliderStep.value, singleNumericStep.value);\n  }\n  return singleNumericStep.value;\n});\nconst singleSliderStep = computed(() => {\n  if (isLogScale.value) return \"1\";\n  return singleNumericSliderStep.value > 0 ? String(singleNumericSliderStep.value) : \"any\";\n});\nconst rangeTrackColor = computed(() =>\n  props.color === \"multiple\" ? \"var(--color-data-viz-3, #ff7a4e)\" : \"var(--color-border, #e3e7ea)\",\n);\n\n/** Shift bounds into positive territory so the log mapping stays defined for zero and negative minimums. */\nconst logShift = (bounds: RangeBounds) => (bounds.min > 0 ? 0 : 1 - bounds.min);\n\nconst positionForValue = (value: number, bounds: RangeBounds) => {\n  if (bounds.max === bounds.min) return 0;\n  if (!isLogScale.value) return (value - bounds.min) / (bounds.max - bounds.min);\n\n  const shift = logShift(bounds);\n  const lowerLog = Math.log(bounds.min + shift);\n  const upperLog = Math.log(bounds.max + shift);\n  if (upperLog === lowerLog) return 0;\n\n  const clampedValue = Math.max(bounds.min, Math.min(bounds.max, value));\n  return (Math.log(clampedValue + shift) - lowerLog) / (upperLog - lowerLog);\n};\n\nconst valueForPosition = (position: number, bounds: RangeBounds) => {\n  const clampedPosition = Math.max(0, Math.min(1, position));\n  if (!isLogScale.value) return bounds.min + clampedPosition * (bounds.max - bounds.min);\n\n  const shift = logShift(bounds);\n  const lowerLog = Math.log(bounds.min + shift);\n  const upperLog = Math.log(bounds.max + shift);\n  return Math.exp(lowerLog + clampedPosition * (upperLog - lowerLog)) - shift;\n};\n\nconst percentForValue = (value: number, bounds: RangeBounds) =>\n  Math.max(0, Math.min(100, positionForValue(value, bounds) * 100));\n\nconst singleBounds = computed<RangeBounds>(() => {\n  const propMin = toFiniteNumber(props.min) ?? DEFAULT_MIN;\n  const propMax = toFiniteNumber(props.max) ?? DEFAULT_MAX;\n\n  if (propMin > propMax) return { max: propMin, min: propMax };\n  if (propMin === propMax) return { max: propMin + 1, min: propMin };\n  return { max: propMax, min: propMin };\n});\n\nconst singleValue = computed(() => toFiniteNumber(modelValue.value) ?? singleBounds.value.min);\nconst singlePercent = computed(() => percentForValue(singleValue.value, singleBounds.value));\nconst singleRangeStyle = computed(() => ({\n  \"--range-track-color\": rangeTrackColor.value,\n  \"--value\": `${singlePercent.value}%`,\n}));\nconst singleTooltipStyle = computed(() => ({ left: `${singlePercent.value}%` }));\n\nconst countFractionDigits = (value: number) => {\n  if (!Number.isFinite(value)) return 0;\n\n  const valueText = String(value).toLowerCase();\n  if (valueText.includes(\"e-\")) {\n    const [base, exponent] = valueText.split(\"e-\");\n    const baseDecimals = base?.split(\".\")[1]?.length ?? 0;\n    return baseDecimals + Number(exponent);\n  }\n\n  return valueText.split(\".\")[1]?.length ?? 0;\n};\n\nconst dualSliderBounds = computed<RangeBounds>(() => {\n  const propMin = toFiniteNumber(props.min);\n  const propMax = toFiniteNumber(props.max);\n  const currentMin = toFiniteNumber(rangeValue.value?.min);\n  const currentMax = toFiniteNumber(rangeValue.value?.max);\n\n  let min = propMin ?? Math.min(DEFAULT_MIN, currentMin ?? DEFAULT_MIN, currentMax ?? DEFAULT_MIN);\n  let max = propMax ?? Math.max(DEFAULT_MAX, currentMin ?? DEFAULT_MAX, currentMax ?? DEFAULT_MAX);\n\n  if (min > max) [min, max] = [max, min];\n  if (min === max) max = min + (dualNumericStep.value > 0 ? dualNumericStep.value : 1);\n\n  return { max, min };\n});\n\nconst clampToBounds = (value: number) => {\n  return Math.max(dualSliderBounds.value.min, Math.min(dualSliderBounds.value.max, value));\n};\n\nconst stepFractionDigits = computed(() => {\n  const boundFractionDigits = Math.max(\n    countFractionDigits(dualSliderBounds.value.min),\n    countFractionDigits(dualSliderBounds.value.max),\n  );\n\n  if (dualNumericStep.value <= 0) return Math.max(6, boundFractionDigits);\n  return Math.max(boundFractionDigits, countFractionDigits(dualNumericStep.value));\n});\n\nconst normalizePrecision = (value: number) => {\n  const fractionDigits = Math.min(20, stepFractionDigits.value);\n  return clampToBounds(Number(value.toFixed(fractionDigits)));\n};\n\n/**\n * A single fixed step cannot serve both ends of a very wide range, so log-scaled tracks snap to\n * roughly three significant digits: 1 near zero, 100 around 47,800, 1,000 around 240,000. An explicit\n * `step` or `sliderStep` raises that floor.\n */\nconst adaptiveIncrement = (value: number, floor: number) => {\n  const smallestIncrement = 10 ** -Math.min(getFractionDigits(), 1);\n  const magnitude = Math.abs(value);\n  const decade = magnitude < 1 ? 0 : 10 ** Math.floor(Math.log10(magnitude)) / 100;\n\n  return Math.max(decade, smallestIncrement, floor);\n};\n\n/** Linear tracks answer to their configured increment; log tracks widen it with the value's magnitude. */\nconst incrementForValue = (value: number, floor: number) =>\n  isLogScale.value ? adaptiveIncrement(value, floor) : floor;\n\nconst minimumGap = computed(() => {\n  if (props.allowMinMaxEqual) return 0;\n\n  const boundsSpan = dualSliderBounds.value.max - dualSliderBounds.value.min;\n  if (boundsSpan <= 0) return 0;\n\n  const continuousGap = Math.max(boundsSpan / 1_000_000, 10 ** -stepFractionDigits.value);\n  const gap = dualNumericStep.value > 0 ? dualNumericStep.value : continuousGap;\n  return Math.min(gap, boundsSpan);\n});\n\nconst snapToIncrement = (value: number, increment: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") => {\n  const clampedValue = clampToBounds(value);\n  if (increment <= 0) return normalizePrecision(clampedValue);\n\n  // An adaptive increment tracks the value's own magnitude, so it only lines up with round numbers from zero.\n  const origin = isLogScale.value ? 0 : dualSliderBounds.value.min;\n  const steps = (clampedValue - origin) / increment;\n  const roundedSteps =\n    direction === \"down\" ? Math.floor(steps) : direction === \"up\" ? Math.ceil(steps) : Math.round(steps);\n  return normalizePrecision(roundedSteps * increment + origin);\n};\n\nconst snapValue = (value: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") =>\n  snapToIncrement(value, incrementForValue(value, dualNumericStep.value), direction);\n\nconst snapSliderValue = (value: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") =>\n  snapValue(snapToIncrement(value, incrementForValue(value, dualNumericSliderStep.value), direction), direction);\n\n/** Typed values answer to `step` alone; the adaptive increment exists only to keep a log track legible. */\nconst snapTypedValue = (value: number) => snapToIncrement(value, dualNumericStep.value);\n\nconst clampMinHandleValue = (value: number, maxValue: number, snap = true) => {\n  const maxAllowed = Math.max(dualSliderBounds.value.min, maxValue - minimumGap.value);\n  const limitedValue = Math.min(value, maxAllowed);\n  return snap ? snapValue(limitedValue, \"down\") : normalizePrecision(limitedValue);\n};\n\nconst clampMaxHandleValue = (value: number, minValue: number, snap = true) => {\n  const minAllowed = Math.min(dualSliderBounds.value.max, minValue + minimumGap.value);\n  const limitedValue = Math.max(value, minAllowed);\n  return snap ? snapValue(limitedValue, \"up\") : normalizePrecision(limitedValue);\n};\n\nconst handleValues = computed(() => {\n  const minValue = toFiniteNumber(rangeValue.value?.min) ?? dualSliderBounds.value.min;\n  const maxValue = toFiniteNumber(rangeValue.value?.max) ?? dualSliderBounds.value.max;\n  const clampedMin = clampToBounds(minValue);\n  const clampedMax = clampToBounds(maxValue);\n\n  return {\n    max: Math.max(clampedMin, clampedMax),\n    min: Math.min(clampedMin, clampedMax),\n  };\n});\n\nconst minPercent = computed(() => percentForValue(handleValues.value.min, dualSliderBounds.value));\nconst maxPercent = computed(() => percentForValue(handleValues.value.max, dualSliderBounds.value));\nconst dualRangeStyle = computed(() => ({\n  \"--range-track-color\": rangeTrackColor.value,\n  \"--value-max\": `${maxPercent.value}%`,\n  \"--value-min\": `${minPercent.value}%`,\n}));\nconst minTooltipStyle = computed(() => ({ left: `${minPercent.value}%` }));\nconst maxTooltipStyle = computed(() => ({ left: `${maxPercent.value}%` }));\nconst hasValue = computed(\n  () => toFiniteNumber(rangeValue.value?.min) !== null || toFiniteNumber(rangeValue.value?.max) !== null,\n);\n\nconst toSliderValue = (value: number, bounds: RangeBounds) =>\n  isLogScale.value ? Math.round(positionForValue(value, bounds) * POSITION_STEPS) : value;\nconst fromSliderValue = (sliderValue: number, bounds: RangeBounds) =>\n  isLogScale.value ? valueForPosition(sliderValue / POSITION_STEPS, bounds) : sliderValue;\n\nconst sliderMin = computed(() => (isLogScale.value ? 0 : dualSliderBounds.value.min));\nconst sliderMax = computed(() => (isLogScale.value ? POSITION_STEPS : dualSliderBounds.value.max));\nconst minSliderValue = computed(() => toSliderValue(handleValues.value.min, dualSliderBounds.value));\nconst maxSliderValue = computed(() => toSliderValue(handleValues.value.max, dualSliderBounds.value));\n\nconst singleSliderMin = computed(() => (isLogScale.value ? 0 : singleBounds.value.min));\nconst singleSliderMax = computed(() => (isLogScale.value ? POSITION_STEPS : singleBounds.value.max));\nconst singleSliderValue = computed(() => toSliderValue(singleValue.value, singleBounds.value));\n\n/** Reserve enough room for the widest bound so six-figure values are not clipped. */\nconst inputCharacterCount = computed(() =>\n  Math.max(formatInputValue(dualSliderBounds.value.min).length, formatInputValue(dualSliderBounds.value.max).length, 3),\n);\nconst inputFieldStyle = computed(() => {\n  const chrome = props.inputIcon ? \"3.25rem\" : \"2rem\";\n  return {\n    // Set inline because the pv-flex-vertical utility declares these defaults later in the cascade.\n    \"--flex-align\": \"stretch\",\n    \"--flex-gap\": \"0\",\n    \"--pv-range-input-width\": `max(${MIN_INPUT_WIDTH}, calc(${inputCharacterCount.value}ch + ${chrome}))`,\n  };\n});\n\nconst shouldClearMinAtBoundary = () => toFiniteNumber(props.min) !== null || dualSliderBounds.value.min === DEFAULT_MIN;\nconst shouldClearMaxAtBoundary = () => toFiniteNumber(props.max) !== null || dualSliderBounds.value.max === DEFAULT_MAX;\n\nconst emitHandleValues = (nextMin: number, nextMax: number) => {\n  rangeValue.value = {\n    max: nextMax >= dualSliderBounds.value.max && shouldClearMaxAtBoundary() ? null : nextMax,\n    min: nextMin <= dualSliderBounds.value.min && shouldClearMinAtBoundary() ? null : nextMin,\n  };\n};\n\nconst setMinHandleValue = (nextMinValue: number, snap = true) => {\n  emitHandleValues(clampMinHandleValue(nextMinValue, handleValues.value.max, snap), handleValues.value.max);\n};\n\nconst setMaxHandleValue = (nextMaxValue: number, snap = true) => {\n  emitHandleValues(handleValues.value.min, clampMaxHandleValue(nextMaxValue, handleValues.value.min, snap));\n};\n\nconst setHandleValue = (handle: RangeInputName, value: number, snap = true) => {\n  if (handle === \"min\") {\n    setMinHandleValue(value, snap);\n  } else {\n    setMaxHandleValue(value, snap);\n  }\n};\n\nconst clearActiveHandle = () => {\n  activeHandle.value = null;\n};\n\nconst setActiveHandle = (handle: RangeInputName) => {\n  activeHandle.value = handle;\n};\n\nconst handleClear = () => {\n  rangeValue.value = { max: null, min: null };\n};\n\nconst removeSingleHandlePointerListeners = () => {\n  removeSinglePointerListeners?.();\n  removeSinglePointerListeners = null;\n};\n\nconst clearSingleHandle = () => {\n  isSingleHandleActive.value = false;\n  removeSingleHandlePointerListeners();\n};\n\nconst snapSingleToIncrement = (value: number, increment: number) => {\n  const clampedValue = Math.max(singleBounds.value.min, Math.min(singleBounds.value.max, value));\n  if (increment <= 0) return clampedValue;\n\n  const origin = isLogScale.value ? 0 : singleBounds.value.min;\n  const steps = (clampedValue - origin) / increment;\n  const snapped = Number((Math.round(steps) * increment + origin).toFixed(20));\n  return Math.max(singleBounds.value.min, Math.min(singleBounds.value.max, snapped));\n};\n\nconst snapSingleValue = (value: number) =>\n  snapSingleToIncrement(value, incrementForValue(value, singleNumericStep.value));\nconst snapSingleSliderValue = (value: number) =>\n  snapSingleValue(snapSingleToIncrement(value, incrementForValue(value, singleNumericSliderStep.value)));\n\nconst handleSinglePointerDown = () => {\n  if (props.disabled) return;\n\n  isSingleHandleActive.value = true;\n  removeSingleHandlePointerListeners();\n\n  window.addEventListener(\"pointerup\", clearSingleHandle);\n  removeSinglePointerListeners = () => window.removeEventListener(\"pointerup\", clearSingleHandle);\n};\n\nconst handleSingleSliderInput = (event: Event) => {\n  const sliderValue = Number((event.target as HTMLInputElement).value);\n  modelValue.value = snapSingleSliderValue(fromSliderValue(sliderValue, singleBounds.value));\n};\n\nconst handleMinSliderInput = (event: Event) => {\n  setActiveHandle(\"min\");\n  const nextValue = fromSliderValue(Number((event.target as HTMLInputElement).value), dualSliderBounds.value);\n  setMinHandleValue(snapSliderValue(nextValue));\n};\n\nconst handleMaxSliderInput = (event: Event) => {\n  setActiveHandle(\"max\");\n  const nextValue = fromSliderValue(Number((event.target as HTMLInputElement).value), dualSliderBounds.value);\n  setMaxHandleValue(snapSliderValue(nextValue));\n};\n\n/**\n * A log track's position steps are far finer than its snapped values, so the native arrow-key step\n * would round straight back onto the current value. Move by a fixed slice of the track instead,\n * which reads as a constant ratio: one press covers a dollar down low and thousands up top.\n */\nconst handleSliderKeydown = (event: KeyboardEvent, handle: RangeInputName) => {\n  if (!isLogScale.value || props.disabled) return;\n\n  const bounds = dualSliderBounds.value;\n  const currentValue = handle === \"min\" ? handleValues.value.min : handleValues.value.max;\n\n  if (event.key === \"Home\" || event.key === \"End\") {\n    event.preventDefault();\n    setActiveHandle(handle);\n    setHandleValue(handle, event.key === \"Home\" ? bounds.min : bounds.max, false);\n    return;\n  }\n\n  const isIncrease = event.key === \"ArrowRight\" || event.key === \"ArrowUp\" || event.key === \"PageUp\";\n  const isDecrease = event.key === \"ArrowLeft\" || event.key === \"ArrowDown\" || event.key === \"PageDown\";\n  if (!isIncrease && !isDecrease) return;\n\n  event.preventDefault();\n  const direction = isIncrease ? 1 : -1;\n  const multiplier = event.key === \"PageUp\" || event.key === \"PageDown\" ? 10 : 1;\n  const nextPosition = positionForValue(currentValue, bounds) + direction * KEYBOARD_POSITION_STEP * multiplier;\n\n  let nextValue = snapSliderValue(valueForPosition(nextPosition, bounds), isIncrease ? \"up\" : \"down\");\n  // Snapping can land back on the current value near the bottom of the track, where a slice of the\n  // track is worth less than one increment.\n  if (nextValue === currentValue) {\n    nextValue = currentValue + direction * incrementForValue(currentValue, dualNumericSliderStep.value);\n  }\n\n  setActiveHandle(handle);\n  setHandleValue(handle, nextValue, false);\n};\n\nconst updateTextFromModel = () => {\n  if (focusedInput.value !== \"min\") minText.value = formatInputValue(handleValues.value.min);\n  if (focusedInput.value !== \"max\") maxText.value = formatInputValue(handleValues.value.max);\n};\n\nconst commitTextInput = (input: RangeInputName) => {\n  const parsed = parseNumber(input === \"min\" ? minText.value : maxText.value);\n  const nextValue =\n    parsed === null\n      ? input === \"min\"\n        ? dualSliderBounds.value.min\n        : dualSliderBounds.value.max\n      : snapTypedValue(parsed);\n\n  setHandleValue(input, nextValue, false);\n};\n\nconst updateMinText = (event: Event) => {\n  minText.value = (event.target as HTMLInputElement).value;\n  commitTextInput(\"min\");\n};\n\nconst updateMaxText = (event: Event) => {\n  maxText.value = (event.target as HTMLInputElement).value;\n  commitTextInput(\"max\");\n};\n\nconst handleInputFocus = (input: RangeInputName) => {\n  focusedInput.value = input;\n};\n\nconst handleInputBlur = (input: RangeInputName) => {\n  commitTextInput(input);\n  focusedInput.value = null;\n  updateTextFromModel();\n};\n\nconst handleInputEnter = (event: KeyboardEvent, input: RangeInputName) => {\n  event.preventDefault();\n  commitTextInput(input);\n  (event.target as HTMLInputElement).blur();\n};\n\nconst valueFromPointer = (clientX: number) => {\n  const rect = sliderRef.value?.getBoundingClientRect();\n  if (!rect || rect.width <= 0) return null;\n\n  const percentage = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));\n  return snapSliderValue(valueForPosition(percentage, dualSliderBounds.value));\n};\n\nconst setNearestHandleFromPointer = (clientX: number) => {\n  const nextValue = valueFromPointer(clientX);\n  if (nextValue === null) return;\n\n  if (props.alwaysEditMin) {\n    setActiveHandle(\"min\");\n    setMinHandleValue(nextValue);\n    return;\n  }\n\n  const distanceToMin = Math.abs(nextValue - handleValues.value.min);\n  const distanceToMax = Math.abs(nextValue - handleValues.value.max);\n  const handle = distanceToMin <= distanceToMax ? \"min\" : \"max\";\n\n  setActiveHandle(handle);\n  setHandleValue(handle, nextValue);\n};\n\nconst removeActivePointerListeners = () => {\n  removePointerListeners?.();\n  removePointerListeners = null;\n};\n\nconst finishPointerDrag = () => {\n  clearActiveHandle();\n  removeActivePointerListeners();\n};\n\nconst handleTrackPointerDown = (event: PointerEvent) => {\n  if (props.disabled) return;\n\n  const target = event.target as HTMLElement | null;\n  if (target !== sliderRef.value && !target?.classList.contains(\"pv-range-dual-fill\")) return;\n\n  setNearestHandleFromPointer(event.clientX);\n\n  const handlePointerMove = (moveEvent: PointerEvent) => setNearestHandleFromPointer(moveEvent.clientX);\n  window.addEventListener(\"pointermove\", handlePointerMove);\n  window.addEventListener(\"pointerup\", finishPointerDrag);\n  removePointerListeners = () => {\n    window.removeEventListener(\"pointermove\", handlePointerMove);\n    window.removeEventListener(\"pointerup\", finishPointerDrag);\n  };\n  event.preventDefault();\n};\n\nwatch([handleValues, dualSliderBounds], updateTextFromModel, { immediate: true });\nonBeforeUnmount(() => {\n  removeActivePointerListeners();\n  removeSingleHandlePointerListeners();\n});\n</script>\n\n<template>\n  <div v-if=\"mode === 'single'\" class=\"pv-range-single-slider\">\n    <span v-if=\"showValueTooltips && isSingleHandleActive\" class=\"pv-range-tooltip\" :style=\"singleTooltipStyle\">\n      {{ formatDisplayValue(singleValue) }}\n    </span>\n    <input\n      :id=\"id\"\n      v-bind=\"attrs\"\n      :aria-label=\"ariaLabel\"\n      :aria-valuetext=\"formatDisplayValue(singleValue)\"\n      :class=\"['pv-range', `pv-range-${props.size}`]\"\n      :disabled=\"disabled\"\n      :max=\"singleSliderMax\"\n      :min=\"singleSliderMin\"\n      :step=\"singleSliderStep\"\n      :style=\"singleRangeStyle\"\n      type=\"range\"\n      :value=\"singleSliderValue\"\n      @change=\"clearSingleHandle\"\n      @input=\"handleSingleSliderInput\"\n      @pointerdown=\"handleSinglePointerDown\"\n      @pointerup=\"clearSingleHandle\"\n    />\n  </div>\n\n  <div\n    v-else\n    v-bind=\"attrs\"\n    class=\"pv-flex-vertical\"\n    data-testid=\"pv-range-dual\"\n    role=\"group\"\n    :aria-label=\"label\"\n    style=\"--flex-align: stretch; --flex-gap: 0\"\n  >\n    <div v-if=\"showBoundLabels\" class=\"pv-space-between pv-text-body-xs pv-text-subdued\" style=\"line-height: 1\">\n      <span>{{ formatDisplayValue(dualSliderBounds.min) }}</span>\n      <span>{{ formatDisplayValue(dualSliderBounds.max) }}</span>\n    </div>\n\n    <div\n      ref=\"sliderRef\"\n      class=\"pv-range-dual-slider\"\n      :class=\"[`pv-range-dual-slider-${size}`, { 'pv-range-dual-slider-disabled': disabled }]\"\n      :style=\"dualRangeStyle\"\n      @pointerdown=\"handleTrackPointerDown\"\n    >\n      <div class=\"pv-range-dual-fill\" />\n      <span v-if=\"showValueTooltips && activeHandle === 'min'\" class=\"pv-range-dual-tooltip\" :style=\"minTooltipStyle\">\n        {{ formatDisplayValue(handleValues.min) }}\n      </span>\n      <span v-if=\"showValueTooltips && activeHandle === 'max'\" class=\"pv-range-dual-tooltip\" :style=\"maxTooltipStyle\">\n        {{ formatDisplayValue(handleValues.max) }}\n      </span>\n      <input\n        class=\"pv-range pv-range-dual-native pv-range-dual-native-min\"\n        type=\"range\"\n        :aria-label=\"`${label} minimum`\"\n        :aria-valuetext=\"formatDisplayValue(handleValues.min)\"\n        :disabled=\"disabled\"\n        :max=\"sliderMax\"\n        :min=\"sliderMin\"\n        :step=\"dualSliderStep\"\n        :value=\"minSliderValue\"\n        @blur=\"clearActiveHandle\"\n        @change=\"clearActiveHandle\"\n        @input=\"handleMinSliderInput\"\n        @keydown=\"(event) => handleSliderKeydown(event, 'min')\"\n        @pointerdown=\"setActiveHandle('min')\"\n        @pointerup=\"clearActiveHandle\"\n      />\n      <input\n        class=\"pv-range pv-range-dual-native pv-range-dual-native-max\"\n        type=\"range\"\n        :aria-label=\"`${label} maximum`\"\n        :aria-valuetext=\"formatDisplayValue(handleValues.max)\"\n        :disabled=\"disabled\"\n        :max=\"sliderMax\"\n        :min=\"sliderMin\"\n        :step=\"dualSliderStep\"\n        :value=\"maxSliderValue\"\n        @blur=\"clearActiveHandle\"\n        @change=\"clearActiveHandle\"\n        @input=\"handleMaxSliderInput\"\n        @keydown=\"(event) => handleSliderKeydown(event, 'max')\"\n        @pointerdown=\"setActiveHandle('max')\"\n        @pointerup=\"clearActiveHandle\"\n      />\n    </div>\n\n    <div v-if=\"showInputs\" class=\"pv-flex\" style=\"--flex-align: flex-end; --flex-gap: 0.75rem; --flex-wrap: wrap\">\n      <label class=\"pv-flex-vertical pv-range-input-label\" :for=\"minInputId\" :style=\"inputFieldStyle\">\n        <span class=\"pv-text-body-sm\">{{ minLabel }}</span>\n        <span class=\"pv-range-input-field\" :class=\"{ 'pv-range-input-field-with-icon': inputIcon }\">\n          <PvIcon v-if=\"inputIcon\" class=\"pv-range-input-icon\" :name=\"inputIcon\" />\n          <input\n            :id=\"minInputId\"\n            class=\"pv-input-text\"\n            :disabled=\"disabled\"\n            inputmode=\"decimal\"\n            placeholder=\"Min\"\n            :step=\"dualInputStep\"\n            type=\"text\"\n            :value=\"minText\"\n            @blur=\"handleInputBlur('min')\"\n            @focus=\"handleInputFocus('min')\"\n            @input=\"updateMinText\"\n            @keydown.enter=\"(event) => handleInputEnter(event, 'min')\"\n          />\n        </span>\n      </label>\n      <label class=\"pv-flex-vertical pv-range-input-label\" :for=\"maxInputId\" :style=\"inputFieldStyle\">\n        <span class=\"pv-text-body-sm\">{{ maxLabel }}</span>\n        <span class=\"pv-range-input-field\" :class=\"{ 'pv-range-input-field-with-icon': inputIcon }\">\n          <PvIcon v-if=\"inputIcon\" class=\"pv-range-input-icon\" :name=\"inputIcon\" />\n          <input\n            :id=\"maxInputId\"\n            class=\"pv-input-text\"\n            :disabled=\"disabled\"\n            inputmode=\"decimal\"\n            placeholder=\"Max\"\n            :step=\"dualInputStep\"\n            type=\"text\"\n            :value=\"maxText\"\n            @blur=\"handleInputBlur('max')\"\n            @focus=\"handleInputFocus('max')\"\n            @input=\"updateMaxText\"\n            @keydown.enter=\"(event) => handleInputEnter(event, 'max')\"\n          />\n        </span>\n      </label>\n      <PvButton\n        v-if=\"showClear && hasValue\"\n        class=\"pv-text-brand\"\n        :disabled=\"disabled\"\n        label=\"Clear range\"\n        variant=\"ghost\"\n        @click=\"handleClear\"\n      />\n    </div>\n\n    <PvButton\n      v-else-if=\"showClear && hasValue\"\n      class=\"pv-text-brand\"\n      :disabled=\"disabled\"\n      label=\"Clear range\"\n      variant=\"ghost\"\n      @click=\"handleClear\"\n    />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useAttrs, useId, watch } from \"vue\";\nimport type { PropType } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport type { PvRangeProps, PvRangeValue } from \"./types\";\n\ntype RangeBounds = { max: number; min: number };\ntype RangeInputName = \"min\" | \"max\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\n/**\n * Native range inputs address a log-scaled track by position instead of by value. 10,000 positions is\n * finer than any display can resolve, so dragging never feels notched, and the values it produces are\n * snapped by magnitude anyway.\n */\nconst POSITION_STEPS = 10_000;\n/** Narrowest dual-mode input, matching the width used before bounds-aware sizing. */\nconst MIN_INPUT_WIDTH = \"4.6875rem\";\n/** Share of a log-scaled track covered by one arrow key press. */\nconst KEYBOARD_POSITION_STEP = 0.01;\n\nconst props = withDefaults(defineProps<PvRangeProps>(), {\n  allowMinMaxEqual: true,\n  alwaysEditMin: false,\n  color: \"single\",\n  dataType: null,\n  disabled: false,\n  inputIcon: null,\n  label: \"Range\",\n  max: null,\n  maxLabel: \"Max\",\n  min: null,\n  minLabel: \"Min\",\n  mode: \"single\",\n  scale: \"linear\",\n  showBoundLabels: false,\n  showClear: true,\n  showInputs: true,\n  showValueTooltips: true,\n  size: \"md\",\n  sliderStep: null,\n  step: null,\n  valueDecimals: null,\n});\n\nconst modelValue = defineModel<number>({ default: 0, type: Number });\nconst rangeValue = defineModel<PvRangeValue>(\"rangeValue\", {\n  default: () => ({ max: null, min: null }),\n  type: Object as PropType<PvRangeValue>,\n});\n\nconst attrs = useAttrs();\nconst id = useId();\nconst maxInputId = `${id}-max`;\nconst minInputId = `${id}-min`;\nconst maxText = ref(\"\");\nconst minText = ref(\"\");\nconst activeHandle = ref<RangeInputName | null>(null);\nconst focusedInput = ref<RangeInputName | null>(null);\nconst isSingleHandleActive = ref(false);\nconst sliderRef = ref<HTMLElement | null>(null);\n\nlet removePointerListeners: (() => void) | null = null;\nlet removeSinglePointerListeners: (() => void) | null = null;\n\nconst isFiniteNumber = (value: unknown): value is number => typeof value === \"number\" && Number.isFinite(value);\nconst toFiniteNumber = (value: unknown): number | null => (isFiniteNumber(value) ? value : null);\n\nconst parseNumber = (value: string): number | null => {\n  const textValue = value.trim();\n  if (textValue === \"\") return null;\n\n  const parsed = Number(textValue.replace(/[^0-9.\\-]/g, \"\"));\n  return Number.isFinite(parsed) ? parsed : null;\n};\n\nconst getDefaultDecimals = (dataType?: string | null): number | null => {\n  if (dataType === \"currency\" || dataType === \"integer\" || dataType === \"percent\") return 0;\n  return null;\n};\n\nconst getFractionDigits = () => {\n  if (props.valueDecimals !== null && props.valueDecimals !== undefined) return Math.max(0, props.valueDecimals);\n  const defaultDecimals = getDefaultDecimals(props.dataType);\n  if (defaultDecimals !== null) return defaultDecimals;\n  return 2;\n};\n\n/** Cached because formatting runs on every tooltip, label, and aria-valuetext update while dragging. */\nconst numberFormatter = computed(\n  () =>\n    new Intl.NumberFormat(\"en-US\", {\n      maximumFractionDigits: getFractionDigits(),\n      minimumFractionDigits: 0,\n    }),\n);\n\nconst formatNumber = (value: number): string => numberFormatter.value.format(value);\n\n/** Grouped digits keep six-figure bounds readable in the inputs; parseNumber strips the separators back out. */\nconst formatInputValue = (value: number): string => formatNumber(value);\n\nconst formatDisplayValue = (value: number): string => {\n  const formattedNumber = formatNumber(value);\n\n  if (props.dataType === \"currency\") return `$${formattedNumber}`;\n  return props.dataType === \"percent\" ? `${formattedNumber}%` : formattedNumber;\n};\n\nconst isLogScale = computed(() => props.scale === \"log\");\nconst finiteStep = computed(() => toFiniteNumber(props.step));\nconst finiteSliderStep = computed(() => toFiniteNumber(props.sliderStep));\nconst dualNumericStep = computed(() => (finiteStep.value !== null && finiteStep.value > 0 ? finiteStep.value : 0));\nconst dualNumericSliderStep = computed(() => {\n  if (finiteSliderStep.value !== null && finiteSliderStep.value > 0) {\n    return Math.max(finiteSliderStep.value, dualNumericStep.value);\n  }\n  return dualNumericStep.value;\n});\nconst dualInputStep = computed(() => (dualNumericStep.value > 0 ? String(dualNumericStep.value) : \"any\"));\nconst dualSliderStep = computed(() => {\n  if (isLogScale.value) return \"1\";\n  return dualNumericSliderStep.value > 0 ? String(dualNumericSliderStep.value) : \"any\";\n});\nconst singleNumericStep = computed(() => {\n  if (finiteStep.value === null) return 1;\n  return finiteStep.value > 0 ? finiteStep.value : 0;\n});\nconst singleNumericSliderStep = computed(() => {\n  if (finiteSliderStep.value !== null && finiteSliderStep.value > 0) {\n    return Math.max(finiteSliderStep.value, singleNumericStep.value);\n  }\n  return singleNumericStep.value;\n});\nconst singleSliderStep = computed(() => {\n  if (isLogScale.value) return \"1\";\n  return singleNumericSliderStep.value > 0 ? String(singleNumericSliderStep.value) : \"any\";\n});\nconst rangeTrackColor = computed(() =>\n  props.color === \"multiple\" ? \"var(--color-data-viz-3, #ff7a4e)\" : \"var(--color-border, #e3e7ea)\",\n);\n\n/** Shift bounds into positive territory so the log mapping stays defined for zero and negative minimums. */\nconst logShift = (bounds: RangeBounds) => (bounds.min > 0 ? 0 : 1 - bounds.min);\n\nconst positionForValue = (value: number, bounds: RangeBounds) => {\n  if (bounds.max === bounds.min) return 0;\n  if (!isLogScale.value) return (value - bounds.min) / (bounds.max - bounds.min);\n\n  const shift = logShift(bounds);\n  const lowerLog = Math.log(bounds.min + shift);\n  const upperLog = Math.log(bounds.max + shift);\n  if (upperLog === lowerLog) return 0;\n\n  const clampedValue = Math.max(bounds.min, Math.min(bounds.max, value));\n  return (Math.log(clampedValue + shift) - lowerLog) / (upperLog - lowerLog);\n};\n\nconst valueForPosition = (position: number, bounds: RangeBounds) => {\n  const clampedPosition = Math.max(0, Math.min(1, position));\n  if (!isLogScale.value) return bounds.min + clampedPosition * (bounds.max - bounds.min);\n\n  const shift = logShift(bounds);\n  const lowerLog = Math.log(bounds.min + shift);\n  const upperLog = Math.log(bounds.max + shift);\n  return Math.exp(lowerLog + clampedPosition * (upperLog - lowerLog)) - shift;\n};\n\nconst percentForValue = (value: number, bounds: RangeBounds) =>\n  Math.max(0, Math.min(100, positionForValue(value, bounds) * 100));\n\nconst singleBounds = computed<RangeBounds>(() => {\n  const propMin = toFiniteNumber(props.min) ?? DEFAULT_MIN;\n  const propMax = toFiniteNumber(props.max) ?? DEFAULT_MAX;\n\n  if (propMin > propMax) return { max: propMin, min: propMax };\n  if (propMin === propMax) return { max: propMin + 1, min: propMin };\n  return { max: propMax, min: propMin };\n});\n\nconst singleValue = computed(() => toFiniteNumber(modelValue.value) ?? singleBounds.value.min);\nconst singlePercent = computed(() => percentForValue(singleValue.value, singleBounds.value));\nconst singleRangeStyle = computed(() => ({\n  \"--range-track-color\": rangeTrackColor.value,\n  \"--value\": `${singlePercent.value}%`,\n}));\nconst singleTooltipStyle = computed(() => ({ left: `${singlePercent.value}%` }));\n\nconst countFractionDigits = (value: number) => {\n  if (!Number.isFinite(value)) return 0;\n\n  const valueText = String(value).toLowerCase();\n  if (valueText.includes(\"e-\")) {\n    const [base, exponent] = valueText.split(\"e-\");\n    const baseDecimals = base?.split(\".\")[1]?.length ?? 0;\n    return baseDecimals + Number(exponent);\n  }\n\n  return valueText.split(\".\")[1]?.length ?? 0;\n};\n\nconst dualSliderBounds = computed<RangeBounds>(() => {\n  const propMin = toFiniteNumber(props.min);\n  const propMax = toFiniteNumber(props.max);\n  const currentMin = toFiniteNumber(rangeValue.value?.min);\n  const currentMax = toFiniteNumber(rangeValue.value?.max);\n\n  let min = propMin ?? Math.min(DEFAULT_MIN, currentMin ?? DEFAULT_MIN, currentMax ?? DEFAULT_MIN);\n  let max = propMax ?? Math.max(DEFAULT_MAX, currentMin ?? DEFAULT_MAX, currentMax ?? DEFAULT_MAX);\n\n  if (min > max) [min, max] = [max, min];\n  if (min === max) max = min + (dualNumericStep.value > 0 ? dualNumericStep.value : 1);\n\n  return { max, min };\n});\n\nconst clampToBounds = (value: number) => {\n  return Math.max(dualSliderBounds.value.min, Math.min(dualSliderBounds.value.max, value));\n};\n\nconst stepFractionDigits = computed(() => {\n  const boundFractionDigits = Math.max(\n    countFractionDigits(dualSliderBounds.value.min),\n    countFractionDigits(dualSliderBounds.value.max),\n  );\n\n  if (dualNumericStep.value <= 0) return Math.max(6, boundFractionDigits);\n  return Math.max(boundFractionDigits, countFractionDigits(dualNumericStep.value));\n});\n\nconst normalizePrecision = (value: number) => {\n  const fractionDigits = Math.min(20, stepFractionDigits.value);\n  return clampToBounds(Number(value.toFixed(fractionDigits)));\n};\n\n/**\n * A single fixed step cannot serve both ends of a very wide range, so log-scaled tracks snap to\n * roughly three significant digits: 1 near zero, 100 around 47,800, 1,000 around 240,000. An explicit\n * `step` or `sliderStep` raises that floor.\n */\nconst adaptiveIncrement = (value: number, floor: number) => {\n  const smallestIncrement = 10 ** -Math.min(getFractionDigits(), 1);\n  const magnitude = Math.abs(value);\n  const decade = magnitude < 1 ? 0 : 10 ** Math.floor(Math.log10(magnitude)) / 100;\n\n  return Math.max(decade, smallestIncrement, floor);\n};\n\n/** Linear tracks answer to their configured increment; log tracks widen it with the value's magnitude. */\nconst incrementForValue = (value: number, floor: number) =>\n  isLogScale.value ? adaptiveIncrement(value, floor) : floor;\n\nconst minimumGap = computed(() => {\n  if (props.allowMinMaxEqual) return 0;\n\n  const boundsSpan = dualSliderBounds.value.max - dualSliderBounds.value.min;\n  if (boundsSpan <= 0) return 0;\n\n  const continuousGap = Math.max(boundsSpan / 1_000_000, 10 ** -stepFractionDigits.value);\n  const gap = dualNumericStep.value > 0 ? dualNumericStep.value : continuousGap;\n  return Math.min(gap, boundsSpan);\n});\n\nconst snapToIncrement = (value: number, increment: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") => {\n  const clampedValue = clampToBounds(value);\n  if (increment <= 0) return normalizePrecision(clampedValue);\n\n  // An adaptive increment tracks the value's own magnitude, so it only lines up with round numbers from zero.\n  const origin = isLogScale.value ? 0 : dualSliderBounds.value.min;\n  const steps = (clampedValue - origin) / increment;\n  const roundedSteps =\n    direction === \"down\" ? Math.floor(steps) : direction === \"up\" ? Math.ceil(steps) : Math.round(steps);\n  return normalizePrecision(roundedSteps * increment + origin);\n};\n\nconst snapValue = (value: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") =>\n  snapToIncrement(value, incrementForValue(value, dualNumericStep.value), direction);\n\nconst snapSliderValue = (value: number, direction: \"down\" | \"nearest\" | \"up\" = \"nearest\") =>\n  snapValue(snapToIncrement(value, incrementForValue(value, dualNumericSliderStep.value), direction), direction);\n\n/** Typed values answer to `step` alone; the adaptive increment exists only to keep a log track legible. */\nconst snapTypedValue = (value: number) => snapToIncrement(value, dualNumericStep.value);\n\nconst clampMinHandleValue = (value: number, maxValue: number, snap = true) => {\n  const maxAllowed = Math.max(dualSliderBounds.value.min, maxValue - minimumGap.value);\n  const limitedValue = Math.min(value, maxAllowed);\n  return snap ? snapValue(limitedValue, \"down\") : normalizePrecision(limitedValue);\n};\n\nconst clampMaxHandleValue = (value: number, minValue: number, snap = true) => {\n  const minAllowed = Math.min(dualSliderBounds.value.max, minValue + minimumGap.value);\n  const limitedValue = Math.max(value, minAllowed);\n  return snap ? snapValue(limitedValue, \"up\") : normalizePrecision(limitedValue);\n};\n\nconst handleValues = computed(() => {\n  const minValue = toFiniteNumber(rangeValue.value?.min) ?? dualSliderBounds.value.min;\n  const maxValue = toFiniteNumber(rangeValue.value?.max) ?? dualSliderBounds.value.max;\n  const clampedMin = clampToBounds(minValue);\n  const clampedMax = clampToBounds(maxValue);\n\n  return {\n    max: Math.max(clampedMin, clampedMax),\n    min: Math.min(clampedMin, clampedMax),\n  };\n});\n\nconst minPercent = computed(() => percentForValue(handleValues.value.min, dualSliderBounds.value));\nconst maxPercent = computed(() => percentForValue(handleValues.value.max, dualSliderBounds.value));\nconst dualRangeStyle = computed(() => ({\n  \"--range-track-color\": rangeTrackColor.value,\n  \"--value-max\": `${maxPercent.value}%`,\n  \"--value-min\": `${minPercent.value}%`,\n}));\nconst minTooltipStyle = computed(() => ({ left: `${minPercent.value}%` }));\nconst maxTooltipStyle = computed(() => ({ left: `${maxPercent.value}%` }));\nconst hasValue = computed(\n  () => toFiniteNumber(rangeValue.value?.min) !== null || toFiniteNumber(rangeValue.value?.max) !== null,\n);\n\nconst toSliderValue = (value: number, bounds: RangeBounds) =>\n  isLogScale.value ? Math.round(positionForValue(value, bounds) * POSITION_STEPS) : value;\nconst fromSliderValue = (sliderValue: number, bounds: RangeBounds) =>\n  isLogScale.value ? valueForPosition(sliderValue / POSITION_STEPS, bounds) : sliderValue;\n\nconst sliderMin = computed(() => (isLogScale.value ? 0 : dualSliderBounds.value.min));\nconst sliderMax = computed(() => (isLogScale.value ? POSITION_STEPS : dualSliderBounds.value.max));\nconst minSliderValue = computed(() => toSliderValue(handleValues.value.min, dualSliderBounds.value));\nconst maxSliderValue = computed(() => toSliderValue(handleValues.value.max, dualSliderBounds.value));\n\nconst singleSliderMin = computed(() => (isLogScale.value ? 0 : singleBounds.value.min));\nconst singleSliderMax = computed(() => (isLogScale.value ? POSITION_STEPS : singleBounds.value.max));\nconst singleSliderValue = computed(() => toSliderValue(singleValue.value, singleBounds.value));\n\n/** Reserve enough room for the widest bound so six-figure values are not clipped. */\nconst inputCharacterCount = computed(() =>\n  Math.max(formatInputValue(dualSliderBounds.value.min).length, formatInputValue(dualSliderBounds.value.max).length, 3),\n);\nconst inputFieldStyle = computed(() => {\n  const chrome = props.inputIcon ? \"3.25rem\" : \"2rem\";\n  return {\n    // Set inline because the pv-flex-vertical utility declares these defaults later in the cascade.\n    \"--flex-align\": \"stretch\",\n    \"--flex-gap\": \"0\",\n    \"--pv-range-input-width\": `max(${MIN_INPUT_WIDTH}, calc(${inputCharacterCount.value}ch + ${chrome}))`,\n  };\n});\n\nconst shouldClearMinAtBoundary = () => toFiniteNumber(props.min) !== null || dualSliderBounds.value.min === DEFAULT_MIN;\nconst shouldClearMaxAtBoundary = () => toFiniteNumber(props.max) !== null || dualSliderBounds.value.max === DEFAULT_MAX;\n\nconst emitHandleValues = (nextMin: number, nextMax: number) => {\n  rangeValue.value = {\n    max: nextMax >= dualSliderBounds.value.max && shouldClearMaxAtBoundary() ? null : nextMax,\n    min: nextMin <= dualSliderBounds.value.min && shouldClearMinAtBoundary() ? null : nextMin,\n  };\n};\n\nconst setMinHandleValue = (nextMinValue: number, snap = true) => {\n  emitHandleValues(clampMinHandleValue(nextMinValue, handleValues.value.max, snap), handleValues.value.max);\n};\n\nconst setMaxHandleValue = (nextMaxValue: number, snap = true) => {\n  emitHandleValues(handleValues.value.min, clampMaxHandleValue(nextMaxValue, handleValues.value.min, snap));\n};\n\nconst setHandleValue = (handle: RangeInputName, value: number, snap = true) => {\n  if (handle === \"min\") {\n    setMinHandleValue(value, snap);\n  } else {\n    setMaxHandleValue(value, snap);\n  }\n};\n\nconst clearActiveHandle = () => {\n  activeHandle.value = null;\n};\n\nconst setActiveHandle = (handle: RangeInputName) => {\n  activeHandle.value = handle;\n};\n\nconst handleClear = () => {\n  rangeValue.value = { max: null, min: null };\n};\n\nconst removeSingleHandlePointerListeners = () => {\n  removeSinglePointerListeners?.();\n  removeSinglePointerListeners = null;\n};\n\nconst clearSingleHandle = () => {\n  isSingleHandleActive.value = false;\n  removeSingleHandlePointerListeners();\n};\n\nconst snapSingleToIncrement = (value: number, increment: number) => {\n  const clampedValue = Math.max(singleBounds.value.min, Math.min(singleBounds.value.max, value));\n  if (increment <= 0) return clampedValue;\n\n  const origin = isLogScale.value ? 0 : singleBounds.value.min;\n  const steps = (clampedValue - origin) / increment;\n  const snapped = Number((Math.round(steps) * increment + origin).toFixed(20));\n  return Math.max(singleBounds.value.min, Math.min(singleBounds.value.max, snapped));\n};\n\nconst snapSingleValue = (value: number) =>\n  snapSingleToIncrement(value, incrementForValue(value, singleNumericStep.value));\nconst snapSingleSliderValue = (value: number) =>\n  snapSingleValue(snapSingleToIncrement(value, incrementForValue(value, singleNumericSliderStep.value)));\n\nconst handleSinglePointerDown = () => {\n  if (props.disabled) return;\n\n  isSingleHandleActive.value = true;\n  removeSingleHandlePointerListeners();\n\n  window.addEventListener(\"pointerup\", clearSingleHandle);\n  removeSinglePointerListeners = () => window.removeEventListener(\"pointerup\", clearSingleHandle);\n};\n\nconst handleSingleSliderInput = (event: Event) => {\n  const sliderValue = Number((event.target as HTMLInputElement).value);\n  modelValue.value = snapSingleSliderValue(fromSliderValue(sliderValue, singleBounds.value));\n};\n\nconst handleMinSliderInput = (event: Event) => {\n  setActiveHandle(\"min\");\n  const nextValue = fromSliderValue(Number((event.target as HTMLInputElement).value), dualSliderBounds.value);\n  setMinHandleValue(snapSliderValue(nextValue));\n};\n\nconst handleMaxSliderInput = (event: Event) => {\n  setActiveHandle(\"max\");\n  const nextValue = fromSliderValue(Number((event.target as HTMLInputElement).value), dualSliderBounds.value);\n  setMaxHandleValue(snapSliderValue(nextValue));\n};\n\n/**\n * A log track's position steps are far finer than its snapped values, so the native arrow-key step\n * would round straight back onto the current value. Move by a fixed slice of the track instead,\n * which reads as a constant ratio: one press covers a dollar down low and thousands up top.\n */\nconst handleSliderKeydown = (event: KeyboardEvent, handle: RangeInputName) => {\n  if (!isLogScale.value || props.disabled) return;\n\n  const bounds = dualSliderBounds.value;\n  const currentValue = handle === \"min\" ? handleValues.value.min : handleValues.value.max;\n\n  if (event.key === \"Home\" || event.key === \"End\") {\n    event.preventDefault();\n    setActiveHandle(handle);\n    setHandleValue(handle, event.key === \"Home\" ? bounds.min : bounds.max, false);\n    return;\n  }\n\n  const isIncrease = event.key === \"ArrowRight\" || event.key === \"ArrowUp\" || event.key === \"PageUp\";\n  const isDecrease = event.key === \"ArrowLeft\" || event.key === \"ArrowDown\" || event.key === \"PageDown\";\n  if (!isIncrease && !isDecrease) return;\n\n  event.preventDefault();\n  const direction = isIncrease ? 1 : -1;\n  const multiplier = event.key === \"PageUp\" || event.key === \"PageDown\" ? 10 : 1;\n  const nextPosition = positionForValue(currentValue, bounds) + direction * KEYBOARD_POSITION_STEP * multiplier;\n\n  let nextValue = snapSliderValue(valueForPosition(nextPosition, bounds), isIncrease ? \"up\" : \"down\");\n  // Snapping can land back on the current value near the bottom of the track, where a slice of the\n  // track is worth less than one increment.\n  if (nextValue === currentValue) {\n    nextValue = currentValue + direction * incrementForValue(currentValue, dualNumericSliderStep.value);\n  }\n\n  setActiveHandle(handle);\n  setHandleValue(handle, nextValue, false);\n};\n\nconst updateTextFromModel = () => {\n  if (focusedInput.value !== \"min\") minText.value = formatInputValue(handleValues.value.min);\n  if (focusedInput.value !== \"max\") maxText.value = formatInputValue(handleValues.value.max);\n};\n\nconst commitTextInput = (input: RangeInputName) => {\n  const parsed = parseNumber(input === \"min\" ? minText.value : maxText.value);\n  const nextValue =\n    parsed === null\n      ? input === \"min\"\n        ? dualSliderBounds.value.min\n        : dualSliderBounds.value.max\n      : snapTypedValue(parsed);\n\n  setHandleValue(input, nextValue, false);\n};\n\nconst updateMinText = (event: Event) => {\n  minText.value = (event.target as HTMLInputElement).value;\n  commitTextInput(\"min\");\n};\n\nconst updateMaxText = (event: Event) => {\n  maxText.value = (event.target as HTMLInputElement).value;\n  commitTextInput(\"max\");\n};\n\nconst handleInputFocus = (input: RangeInputName) => {\n  focusedInput.value = input;\n};\n\nconst handleInputBlur = (input: RangeInputName) => {\n  commitTextInput(input);\n  focusedInput.value = null;\n  updateTextFromModel();\n};\n\nconst handleInputEnter = (event: KeyboardEvent, input: RangeInputName) => {\n  event.preventDefault();\n  commitTextInput(input);\n  (event.target as HTMLInputElement).blur();\n};\n\nconst valueFromPointer = (clientX: number) => {\n  const rect = sliderRef.value?.getBoundingClientRect();\n  if (!rect || rect.width <= 0) return null;\n\n  const percentage = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));\n  return snapSliderValue(valueForPosition(percentage, dualSliderBounds.value));\n};\n\nconst setNearestHandleFromPointer = (clientX: number) => {\n  const nextValue = valueFromPointer(clientX);\n  if (nextValue === null) return;\n\n  if (props.alwaysEditMin) {\n    setActiveHandle(\"min\");\n    setMinHandleValue(nextValue);\n    return;\n  }\n\n  const distanceToMin = Math.abs(nextValue - handleValues.value.min);\n  const distanceToMax = Math.abs(nextValue - handleValues.value.max);\n  const handle = distanceToMin <= distanceToMax ? \"min\" : \"max\";\n\n  setActiveHandle(handle);\n  setHandleValue(handle, nextValue);\n};\n\nconst removeActivePointerListeners = () => {\n  removePointerListeners?.();\n  removePointerListeners = null;\n};\n\nconst finishPointerDrag = () => {\n  clearActiveHandle();\n  removeActivePointerListeners();\n};\n\nconst handleTrackPointerDown = (event: PointerEvent) => {\n  if (props.disabled) return;\n\n  const target = event.target as HTMLElement | null;\n  if (target !== sliderRef.value && !target?.classList.contains(\"pv-range-dual-fill\")) return;\n\n  setNearestHandleFromPointer(event.clientX);\n\n  const handlePointerMove = (moveEvent: PointerEvent) => setNearestHandleFromPointer(moveEvent.clientX);\n  window.addEventListener(\"pointermove\", handlePointerMove);\n  window.addEventListener(\"pointerup\", finishPointerDrag);\n  removePointerListeners = () => {\n    window.removeEventListener(\"pointermove\", handlePointerMove);\n    window.removeEventListener(\"pointerup\", finishPointerDrag);\n  };\n  event.preventDefault();\n};\n\nwatch([handleValues, dualSliderBounds], updateTextFromModel, { immediate: true });\nonBeforeUnmount(() => {\n  removeActivePointerListeners();\n  removeSingleHandlePointerListeners();\n});\n</script>\n\n<template>\n  <div v-if=\"mode === 'single'\" class=\"pv-range-single-slider\">\n    <span v-if=\"showValueTooltips && isSingleHandleActive\" class=\"pv-range-tooltip\" :style=\"singleTooltipStyle\">\n      {{ formatDisplayValue(singleValue) }}\n    </span>\n    <input\n      :id=\"id\"\n      v-bind=\"attrs\"\n      :aria-label=\"ariaLabel\"\n      :aria-valuetext=\"formatDisplayValue(singleValue)\"\n      :class=\"['pv-range', `pv-range-${props.size}`]\"\n      :disabled=\"disabled\"\n      :max=\"singleSliderMax\"\n      :min=\"singleSliderMin\"\n      :step=\"singleSliderStep\"\n      :style=\"singleRangeStyle\"\n      type=\"range\"\n      :value=\"singleSliderValue\"\n      @change=\"clearSingleHandle\"\n      @input=\"handleSingleSliderInput\"\n      @pointerdown=\"handleSinglePointerDown\"\n      @pointerup=\"clearSingleHandle\"\n    />\n  </div>\n\n  <div\n    v-else\n    v-bind=\"attrs\"\n    class=\"pv-flex-vertical\"\n    data-testid=\"pv-range-dual\"\n    role=\"group\"\n    :aria-label=\"label\"\n    style=\"--flex-align: stretch; --flex-gap: 0\"\n  >\n    <div v-if=\"showBoundLabels\" class=\"pv-space-between pv-text-body-xs pv-text-subdued\" style=\"line-height: 1\">\n      <span>{{ formatDisplayValue(dualSliderBounds.min) }}</span>\n      <span>{{ formatDisplayValue(dualSliderBounds.max) }}</span>\n    </div>\n\n    <div\n      ref=\"sliderRef\"\n      class=\"pv-range-dual-slider\"\n      :class=\"[`pv-range-dual-slider-${size}`, { 'pv-range-dual-slider-disabled': disabled }]\"\n      :style=\"dualRangeStyle\"\n      @pointerdown=\"handleTrackPointerDown\"\n    >\n      <div class=\"pv-range-dual-fill\" />\n      <span v-if=\"showValueTooltips && activeHandle === 'min'\" class=\"pv-range-dual-tooltip\" :style=\"minTooltipStyle\">\n        {{ formatDisplayValue(handleValues.min) }}\n      </span>\n      <span v-if=\"showValueTooltips && activeHandle === 'max'\" class=\"pv-range-dual-tooltip\" :style=\"maxTooltipStyle\">\n        {{ formatDisplayValue(handleValues.max) }}\n      </span>\n      <input\n        class=\"pv-range pv-range-dual-native pv-range-dual-native-min\"\n        type=\"range\"\n        :aria-label=\"`${label} minimum`\"\n        :aria-valuetext=\"formatDisplayValue(handleValues.min)\"\n        :disabled=\"disabled\"\n        :max=\"sliderMax\"\n        :min=\"sliderMin\"\n        :step=\"dualSliderStep\"\n        :value=\"minSliderValue\"\n        @blur=\"clearActiveHandle\"\n        @change=\"clearActiveHandle\"\n        @input=\"handleMinSliderInput\"\n        @keydown=\"(event) => handleSliderKeydown(event, 'min')\"\n        @pointerdown=\"setActiveHandle('min')\"\n        @pointerup=\"clearActiveHandle\"\n      />\n      <input\n        class=\"pv-range pv-range-dual-native pv-range-dual-native-max\"\n        type=\"range\"\n        :aria-label=\"`${label} maximum`\"\n        :aria-valuetext=\"formatDisplayValue(handleValues.max)\"\n        :disabled=\"disabled\"\n        :max=\"sliderMax\"\n        :min=\"sliderMin\"\n        :step=\"dualSliderStep\"\n        :value=\"maxSliderValue\"\n        @blur=\"clearActiveHandle\"\n        @change=\"clearActiveHandle\"\n        @input=\"handleMaxSliderInput\"\n        @keydown=\"(event) => handleSliderKeydown(event, 'max')\"\n        @pointerdown=\"setActiveHandle('max')\"\n        @pointerup=\"clearActiveHandle\"\n      />\n    </div>\n\n    <div v-if=\"showInputs\" class=\"pv-flex\" style=\"--flex-align: flex-end; --flex-gap: 0.75rem; --flex-wrap: wrap\">\n      <label class=\"pv-flex-vertical pv-range-input-label\" :for=\"minInputId\" :style=\"inputFieldStyle\">\n        <span class=\"pv-text-body-sm\">{{ minLabel }}</span>\n        <span class=\"pv-range-input-field\" :class=\"{ 'pv-range-input-field-with-icon': inputIcon }\">\n          <PvIcon v-if=\"inputIcon\" class=\"pv-range-input-icon\" :name=\"inputIcon\" />\n          <input\n            :id=\"minInputId\"\n            class=\"pv-input-text\"\n            :disabled=\"disabled\"\n            inputmode=\"decimal\"\n            placeholder=\"Min\"\n            :step=\"dualInputStep\"\n            type=\"text\"\n            :value=\"minText\"\n            @blur=\"handleInputBlur('min')\"\n            @focus=\"handleInputFocus('min')\"\n            @input=\"updateMinText\"\n            @keydown.enter=\"(event) => handleInputEnter(event, 'min')\"\n          />\n        </span>\n      </label>\n      <label class=\"pv-flex-vertical pv-range-input-label\" :for=\"maxInputId\" :style=\"inputFieldStyle\">\n        <span class=\"pv-text-body-sm\">{{ maxLabel }}</span>\n        <span class=\"pv-range-input-field\" :class=\"{ 'pv-range-input-field-with-icon': inputIcon }\">\n          <PvIcon v-if=\"inputIcon\" class=\"pv-range-input-icon\" :name=\"inputIcon\" />\n          <input\n            :id=\"maxInputId\"\n            class=\"pv-input-text\"\n            :disabled=\"disabled\"\n            inputmode=\"decimal\"\n            placeholder=\"Max\"\n            :step=\"dualInputStep\"\n            type=\"text\"\n            :value=\"maxText\"\n            @blur=\"handleInputBlur('max')\"\n            @focus=\"handleInputFocus('max')\"\n            @input=\"updateMaxText\"\n            @keydown.enter=\"(event) => handleInputEnter(event, 'max')\"\n          />\n        </span>\n      </label>\n      <PvButton\n        v-if=\"showClear && hasValue\"\n        class=\"pv-text-brand\"\n        :disabled=\"disabled\"\n        label=\"Clear range\"\n        variant=\"ghost\"\n        @click=\"handleClear\"\n      />\n    </div>\n\n    <PvButton\n      v-else-if=\"showClear && hasValue\"\n      class=\"pv-text-brand\"\n      :disabled=\"disabled\"\n      label=\"Clear range\"\n      variant=\"ghost\"\n      @click=\"handleClear\"\n    />\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, type CSSProperties, useSlots } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvCheckbox from \"@/components/base/PvCheckbox/PvCheckbox.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { PvFilterPanelOptionRowProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelOptionRowProps>(), {\n  control: \"checkbox\",\n  depth: 0,\n  disabled: false,\n  focusActionDisabled: false,\n  focusText: \"Focus\",\n  indeterminate: false,\n  isFocused: false,\n  resultCount: null,\n  selected: false,\n  showFocusAction: false,\n});\n\nconst emit = defineEmits<{\n  \"focus-value\": [value: string];\n  \"toggle-value\": [value: string, checked: boolean];\n}>();\n\nconst slots = useSlots();\n\nconst hasResultCount = computed(\n  () => props.resultCount !== null && props.resultCount !== undefined && props.resultCount !== \"\",\n);\nconst focusActionLabel = computed(\n  () => props.focusActionLabel ?? (props.isFocused ? `Remove ${props.focusText}` : `Select as ${props.focusText}`),\n);\nconst hasRightContent = computed(() => !props.renderer && (hasResultCount.value || Boolean(slots[\"result-count\"])));\nconst rowStyle = computed<CSSProperties>(() => ({\n  \"--pv-filter-panel-option-row-depth\": String(props.depth),\n}));\nconst rendererProps = computed(() => ({\n  disabled: props.disabled,\n  highlightSearchText: true,\n  id: props.value,\n  indeterminate: props.indeterminate,\n  label: props.label,\n  queryText: props.queryText,\n  resultCount: props.resultCount ?? undefined,\n  secondaryText: props.resultCount ?? undefined,\n  selected: props.selected,\n  subText: props.subText,\n  subduedText: props.subduedText,\n  text: props.label,\n  value: props.value,\n}));\n\nconst handleToggleValue = (checked: boolean | undefined) => {\n  if (props.disabled) return;\n  emit(\"toggle-value\", props.value, checked === true);\n};\n\nconst handleRadioChange = (event: Event) => {\n  handleToggleValue((event.target as HTMLInputElement).checked);\n};\n\nconst handleFocusValue = () => {\n  if (props.disabled || props.focusActionDisabled) return;\n  emit(\"focus-value\", props.value);\n};\n</script>\n\n<template>\n  <label\n    class=\"pv-filter-panel-option-row pv-flex\"\n    :class=\"{ 'pv-filter-panel-option-row-disabled': disabled }\"\n    data-testid=\"pv-filter-panel-option-row\"\n    :style=\"rowStyle\"\n  >\n    <input\n      v-if=\"control === 'radio'\"\n      class=\"pv-radio\"\n      type=\"radio\"\n      :aria-label=\"ariaLabel || label\"\n      :checked=\"selected\"\n      :disabled=\"disabled\"\n      :name=\"name\"\n      @change=\"handleRadioChange\"\n    />\n    <PvCheckbox\n      v-else\n      :ariaLabel=\"ariaLabel || label\"\n      :disabled=\"disabled\"\n      :indeterminate=\"indeterminate\"\n      :modelValue=\"selected\"\n      @update:modelValue=\"handleToggleValue\"\n    />\n    <component v-if=\"renderer\" :is=\"renderer\" v-bind=\"rendererProps\" />\n    <span v-else class=\"pv-filter-panel-option-row-content pv-flex-vertical\">\n      <span class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-sm\">{{ label }}</span>\n      <span v-if=\"subduedText\" class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-xs pv-text-subdued\">\n        {{ subduedText }}\n      </span>\n      <span v-if=\"subText\" class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-xs pv-text-subdued\">\n        {{ subText }}\n      </span>\n    </span>\n    <span v-if=\"hasRightContent\" class=\"pv-filter-panel-option-row-right pv-text-body-xs pv-text-subdued\">\n      <slot name=\"result-count\">({{ resultCount }})</slot>\n    </span>\n    <div\n      v-if=\"showFocusAction\"\n      class=\"pv-filter-panel-option-row-focus-action\"\n      :class=\"{ 'pv-filter-panel-option-row-focus-action-always-visible': isFocused }\"\n      data-testid=\"pv-filter-panel-option-row-focus-action\"\n    >\n      <PvTooltipV2 :description=\"focusActionLabel\" position=\"top-right\" size=\"sm\">\n        <template #trigger>\n          <PvButton\n            :ariaLabel=\"focusActionLabel\"\n            :disabled=\"disabled || focusActionDisabled\"\n            :class=\"{ 'pv-text-brand': isFocused }\"\n            leftIcon=\"focus\"\n            size=\"md\"\n            variant=\"ghost\"\n            @click.stop.prevent=\"handleFocusValue\"\n          />\n        </template>\n      </PvTooltipV2>\n    </div>\n  </label>\n</template>\n\n<style scoped>\n.pv-filter-panel-option-row {\n  --flex-align: center;\n  --flex-gap: 0.5rem;\n  cursor: pointer;\n  min-width: 0;\n  padding-left: calc(var(--pv-filter-panel-option-row-depth) * 1.25rem);\n}\n\n.pv-filter-panel-option-row-content {\n  --flex-align: stretch;\n  --flex-gap: 0;\n  flex: 1 1 auto;\n  min-width: 0;\n}\n\n.pv-filter-panel-option-row-disabled {\n  cursor: not-allowed;\n  opacity: 0.6;\n}\n\n.pv-filter-panel-option-row-line {\n  --lines: 1;\n}\n\n.pv-filter-panel-option-row-right {\n  flex: 0 0 auto;\n  text-align: right;\n}\n\n.pv-filter-panel-option-row-focus-action {\n  opacity: 0;\n  pointer-events: none;\n}\n\n.pv-filter-panel-option-row:hover .pv-filter-panel-option-row-focus-action,\n.pv-filter-panel-option-row:focus-within .pv-filter-panel-option-row-focus-action,\n.pv-filter-panel-option-row-focus-action-always-visible {\n  opacity: 1;\n  pointer-events: auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, type CSSProperties, useSlots } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvCheckbox from \"@/components/base/PvCheckbox/PvCheckbox.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { PvFilterPanelOptionRowProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelOptionRowProps>(), {\n  control: \"checkbox\",\n  depth: 0,\n  disabled: false,\n  focusActionDisabled: false,\n  focusText: \"Focus\",\n  indeterminate: false,\n  isFocused: false,\n  resultCount: null,\n  selected: false,\n  showFocusAction: false,\n});\n\nconst emit = defineEmits<{\n  \"focus-value\": [value: string];\n  \"toggle-value\": [value: string, checked: boolean];\n}>();\n\nconst slots = useSlots();\n\nconst hasResultCount = computed(\n  () => props.resultCount !== null && props.resultCount !== undefined && props.resultCount !== \"\",\n);\nconst focusActionLabel = computed(\n  () => props.focusActionLabel ?? (props.isFocused ? `Remove ${props.focusText}` : `Select as ${props.focusText}`),\n);\nconst hasRightContent = computed(() => !props.renderer && (hasResultCount.value || Boolean(slots[\"result-count\"])));\nconst rowStyle = computed<CSSProperties>(() => ({\n  \"--pv-filter-panel-option-row-depth\": String(props.depth),\n}));\nconst rendererProps = computed(() => ({\n  disabled: props.disabled,\n  highlightSearchText: true,\n  id: props.value,\n  indeterminate: props.indeterminate,\n  label: props.label,\n  queryText: props.queryText,\n  resultCount: props.resultCount ?? undefined,\n  secondaryText: props.resultCount ?? undefined,\n  selected: props.selected,\n  subText: props.subText,\n  subduedText: props.subduedText,\n  text: props.label,\n  value: props.value,\n}));\n\nconst handleToggleValue = (checked: boolean | undefined) => {\n  if (props.disabled) return;\n  emit(\"toggle-value\", props.value, checked === true);\n};\n\nconst handleRadioChange = (event: Event) => {\n  handleToggleValue((event.target as HTMLInputElement).checked);\n};\n\nconst handleFocusValue = () => {\n  if (props.disabled || props.focusActionDisabled) return;\n  emit(\"focus-value\", props.value);\n};\n</script>\n\n<template>\n  <label\n    class=\"pv-filter-panel-option-row pv-flex\"\n    :class=\"{ 'pv-filter-panel-option-row-disabled': disabled }\"\n    data-testid=\"pv-filter-panel-option-row\"\n    :style=\"rowStyle\"\n  >\n    <input\n      v-if=\"control === 'radio'\"\n      class=\"pv-radio\"\n      type=\"radio\"\n      :aria-label=\"ariaLabel || label\"\n      :checked=\"selected\"\n      :disabled=\"disabled\"\n      :name=\"name\"\n      @change=\"handleRadioChange\"\n    />\n    <PvCheckbox\n      v-else\n      :ariaLabel=\"ariaLabel || label\"\n      :disabled=\"disabled\"\n      :indeterminate=\"indeterminate\"\n      :modelValue=\"selected\"\n      @update:modelValue=\"handleToggleValue\"\n    />\n    <component v-if=\"renderer\" :is=\"renderer\" v-bind=\"rendererProps\" />\n    <span v-else class=\"pv-filter-panel-option-row-content pv-flex-vertical\">\n      <span class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-sm\">{{ label }}</span>\n      <span v-if=\"subduedText\" class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-xs pv-text-subdued\">\n        {{ subduedText }}\n      </span>\n      <span v-if=\"subText\" class=\"pv-filter-panel-option-row-line pv-line-clamp pv-text-body-xs pv-text-subdued\">\n        {{ subText }}\n      </span>\n    </span>\n    <span v-if=\"hasRightContent\" class=\"pv-filter-panel-option-row-right pv-text-body-xs pv-text-subdued\">\n      <slot name=\"result-count\">({{ resultCount }})</slot>\n    </span>\n    <div\n      v-if=\"showFocusAction\"\n      class=\"pv-filter-panel-option-row-focus-action\"\n      :class=\"{ 'pv-filter-panel-option-row-focus-action-always-visible': isFocused }\"\n      data-testid=\"pv-filter-panel-option-row-focus-action\"\n    >\n      <PvTooltipV2 :description=\"focusActionLabel\" position=\"top-right\" size=\"sm\">\n        <template #trigger>\n          <PvButton\n            :ariaLabel=\"focusActionLabel\"\n            :disabled=\"disabled || focusActionDisabled\"\n            :class=\"{ 'pv-text-brand': isFocused }\"\n            leftIcon=\"focus\"\n            size=\"md\"\n            variant=\"ghost\"\n            @click.stop.prevent=\"handleFocusValue\"\n          />\n        </template>\n      </PvTooltipV2>\n    </div>\n  </label>\n</template>\n\n<style scoped>\n.pv-filter-panel-option-row {\n  --flex-align: center;\n  --flex-gap: 0.5rem;\n  cursor: pointer;\n  min-width: 0;\n  padding-left: calc(var(--pv-filter-panel-option-row-depth) * 1.25rem);\n}\n\n.pv-filter-panel-option-row-content {\n  --flex-align: stretch;\n  --flex-gap: 0;\n  flex: 1 1 auto;\n  min-width: 0;\n}\n\n.pv-filter-panel-option-row-disabled {\n  cursor: not-allowed;\n  opacity: 0.6;\n}\n\n.pv-filter-panel-option-row-line {\n  --lines: 1;\n}\n\n.pv-filter-panel-option-row-right {\n  flex: 0 0 auto;\n  text-align: right;\n}\n\n.pv-filter-panel-option-row-focus-action {\n  opacity: 0;\n  pointer-events: none;\n}\n\n.pv-filter-panel-option-row:hover .pv-filter-panel-option-row-focus-action,\n.pv-filter-panel-option-row:focus-within .pv-filter-panel-option-row-focus-action,\n.pv-filter-panel-option-row-focus-action-always-visible {\n  opacity: 1;\n  pointer-events: auto;\n}\n</style>\n","import type { PvFilterPanelOption } from \"./types\";\n\nexport interface PvFilterPanelScopedValue {\n  field?: string;\n  pairs: Array<{ field: string; value: string }>;\n  value: string;\n}\n\nconst FILTER_PANEL_SCOPED_VALUE_PREFIX = \"__pv_filter_panel_scoped_value__\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n  return typeof value === \"object\" && value !== null;\n};\n\nconst parseScopedPayload = (payload: string): Array<{ field: string; value: string }> => {\n  try {\n    const parsed = JSON.parse(decodeURIComponent(payload)) as unknown;\n    if (!Array.isArray(parsed)) return [];\n    return parsed.flatMap((entry) => {\n      if (!Array.isArray(entry) || entry.length < 2) return [];\n      const [field, fieldValue] = entry;\n      return typeof field === \"string\" && typeof fieldValue === \"string\" ? [{ field, value: fieldValue }] : [];\n    });\n  } catch {\n    return [];\n  }\n};\n\nconst parseLegacyScopedValue = (value: string): PvFilterPanelScopedValue | null => {\n  if (!value.startsWith(\"__\")) return null;\n  const parts = value.slice(2).split(\"__\");\n  if (parts.length < 2 || !parts[0] || !parts[1]) return null;\n  const pairs = [{ field: parts[0], value: parts[1] }];\n  return { field: pairs[0].field, pairs, value: pairs[0].value };\n};\n\nexport const parseFilterPanelScopedValue = (value: string | null | undefined): PvFilterPanelScopedValue | null => {\n  if (value == null) return null;\n  if (!value.startsWith(FILTER_PANEL_SCOPED_VALUE_PREFIX)) return parseLegacyScopedValue(value) ?? { pairs: [], value };\n\n  const pairs = parseScopedPayload(value.slice(FILTER_PANEL_SCOPED_VALUE_PREFIX.length));\n\n  return {\n    field: pairs[0]?.field,\n    pairs,\n    value: pairs[0]?.value ?? value,\n  };\n};\n\nexport const createFilterPanelScopedValue = (field: string, value: string): string =>\n  `${FILTER_PANEL_SCOPED_VALUE_PREFIX}${encodeURIComponent(JSON.stringify([[field, value]]))}`;\n\nexport const getFilterPanelOptionRawValue = (option: PvFilterPanelOption | null | undefined): string | null => {\n  if (!option) return null;\n  if (option.rawValue !== null && option.rawValue !== undefined) return String(option.rawValue);\n  if (isRecord(option.metadata) && option.metadata.rawValue !== null && option.metadata.rawValue !== undefined) {\n    return String(option.metadata.rawValue);\n  }\n  if (option.matchedValue !== null && option.matchedValue !== undefined) return String(option.matchedValue);\n  return parseFilterPanelScopedValue(option.value)?.value ?? option.value;\n};\n\nexport const getFilterPanelOptionField = (\n  option: PvFilterPanelOption | null | undefined,\n  fallbackField: string,\n): string => {\n  if (option?.field) return option.field;\n  if (option?.colField) return option.colField;\n  return parseFilterPanelScopedValue(option?.value)?.field ?? fallbackField;\n};\n\nexport const flattenFilterPanelOptions = (options: PvFilterPanelOption[]): PvFilterPanelOption[] => {\n  return options.flatMap((option) => [\n    option,\n    ...(option.children?.length ? flattenFilterPanelOptions(option.children) : []),\n  ]);\n};\n\nexport const filterPanelOptionMatchesRawValue = (\n  option: PvFilterPanelOption,\n  field: string,\n  rawValue: string,\n  fallbackField: string,\n): boolean => {\n  return (\n    getFilterPanelOptionField(option, fallbackField) === field && getFilterPanelOptionRawValue(option) === rawValue\n  );\n};\n","import { parseFilterPanelScopedValue } from \"./filterOptionValue\";\nimport type { PvFilterPanelOption } from \"./types\";\n\nexport type PvFilterPanelDisplayResultCount = number | string;\nexport type FilterPanelDisplayResultCount = PvFilterPanelDisplayResultCount;\n\ninterface FilterOptionDisplaySource {\n  label?: string;\n  metadata?: unknown;\n  rawValue?: boolean | number | string | null;\n  resultCount?: unknown;\n  totalChildCount?: unknown;\n  value: string;\n}\n\ninterface FilterOptionColDefLike {\n  context?: {\n    filterValueFormatter?: ((params: never) => string) | string | null;\n    metadataDisplayFields?: string[];\n  } | null;\n  valueFormatter?: ((params: never) => string) | string | null;\n}\n\nconst RESULT_COUNT_METADATA_KEYS = [\"totalCount\", \"total_count\", \"resultCount\", \"result_count\", \"row_count\", \"count\"];\n\nconst compactNumberFormatter = new Intl.NumberFormat(\"en-US\", {\n  maximumFractionDigits: 1,\n  notation: \"compact\",\n});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n  return typeof value === \"object\" && value !== null;\n};\n\nconst formatResultCount = (value: unknown): PvFilterPanelDisplayResultCount | undefined => {\n  if (typeof value === \"number\" && Number.isFinite(value)) {\n    return compactNumberFormatter.format(value);\n  }\n\n  if (typeof value === \"string\") {\n    const trimmedValue = value.trim();\n    if (!trimmedValue) return undefined;\n\n    const parsed = Number(trimmedValue);\n    if (Number.isFinite(parsed)) return compactNumberFormatter.format(parsed);\n    return value;\n  }\n\n  return undefined;\n};\n\nconst getFractionDigits = (dataType?: string | null, valueDecimals?: number | null): number => {\n  if (valueDecimals !== null && valueDecimals !== undefined) return valueDecimals;\n  if (dataType === \"currency\" || dataType === \"integer\" || dataType === \"percent\") return 0;\n  return 2;\n};\n\nexport const formatFilterPanelScalarValue = (\n  value: number,\n  options: { dataType?: string | null; valueDecimals?: number | null } = {},\n): string => {\n  const fractionDigits = getFractionDigits(options.dataType, options.valueDecimals);\n\n  if (options.dataType === \"currency\") {\n    return new Intl.NumberFormat(\"en-US\", {\n      currency: \"USD\",\n      maximumFractionDigits: fractionDigits,\n      minimumFractionDigits: fractionDigits,\n      style: \"currency\",\n    }).format(value);\n  }\n\n  const formattedNumber = new Intl.NumberFormat(\"en-US\", {\n    maximumFractionDigits: fractionDigits,\n    minimumFractionDigits: fractionDigits,\n  }).format(value);\n\n  return options.dataType === \"percent\" ? `${formattedNumber}%` : formattedNumber;\n};\n\nexport const formatFilterPanelRangeValue = (\n  min: number | null,\n  max: number | null,\n  options: { dataType?: string | null; valueDecimals?: number | null } = {},\n): string => {\n  if (min !== null && max !== null) {\n    return `${formatFilterPanelScalarValue(min, options)}–${formatFilterPanelScalarValue(max, options)}`;\n  }\n\n  if (min !== null) return `${formatFilterPanelScalarValue(min, options)}+`;\n  if (max !== null) return `≤ ${formatFilterPanelScalarValue(max, options)}`;\n  return \"\";\n};\n\nconst getFormatterValue = (option: FilterOptionDisplaySource) => {\n  if (option.rawValue !== null && option.rawValue !== undefined) return option.rawValue;\n  if (isRecord(option.metadata) && option.metadata.rawValue !== null && option.metadata.rawValue !== undefined) {\n    return option.metadata.rawValue;\n  }\n  return option.value;\n};\n\nconst getMetadataLabel = (option: FilterOptionDisplaySource, colDef?: FilterOptionColDefLike) => {\n  const metadata = option.metadata;\n  if (!isRecord(metadata)) return null;\n\n  for (const field of colDef?.context?.metadataDisplayFields ?? []) {\n    const value = metadata[field];\n    if (value !== null && value !== undefined && String(value).trim()) return String(value);\n  }\n\n  return null;\n};\n\nconst callFormatter = (formatter: (params: never) => string, params: { context: unknown; value: unknown }) => {\n  try {\n    return formatter(params as never) || null;\n  } catch {\n    return null;\n  }\n};\n\n// Same params PvDataTable's set filter passes: the option is the context, with a metadata label\n// standing in unless the option already carries a label for a non-id value.\nconst formatWithFilterValueFormatter = (option: FilterOptionDisplaySource, colDef?: FilterOptionColDefLike) => {\n  const formatter = colDef?.context?.filterValueFormatter;\n  if (typeof formatter !== \"function\") return null;\n\n  const hasRawValue =\n    (option.rawValue !== null && option.rawValue !== undefined) ||\n    (isRecord(option.metadata) && option.metadata.rawValue !== null && option.metadata.rawValue !== undefined);\n  const label = option.label && !hasRawValue ? option.label : (getMetadataLabel(option, colDef) ?? option.label);\n  return callFormatter(formatter, { context: { ...option, label }, value: getFormatterValue(option) });\n};\n\nconst formatWithValueFormatter = (option: FilterOptionDisplaySource, colDef?: FilterOptionColDefLike) => {\n  if (typeof colDef?.valueFormatter !== \"function\") return null;\n  return callFormatter(colDef.valueFormatter, { context: option.metadata, value: getFormatterValue(option) });\n};\n\nexport const getFilterOptionLabel = (option: FilterOptionDisplaySource, colDef?: FilterOptionColDefLike) => {\n  return (\n    formatWithFilterValueFormatter(option, colDef) ||\n    option.label ||\n    getMetadataLabel(option, colDef) ||\n    formatWithValueFormatter(option, colDef) ||\n    option.value\n  );\n};\n\nconst getOptionIds = (option: PvFilterPanelOption) => {\n  const metadataRawValue = isRecord(option.metadata) ? option.metadata.rawValue : undefined;\n  return Array.from(\n    new Set(\n      [option.value, option.rawValue, metadataRawValue, parseFilterPanelScopedValue(option.value)?.value]\n        .filter((value) => value !== null && value !== undefined)\n        .map(String),\n    ),\n  );\n};\n\nconst isUnresolvedFilterOption = (option: PvFilterPanelOption, colDef?: FilterOptionColDefLike) => {\n  if (!colDef?.context?.metadataDisplayFields?.length) return false;\n  if (getMetadataLabel(option, colDef)) return false;\n  const label = option.label?.trim();\n  return !label || getOptionIds(option).includes(label);\n};\n\nconst indexKnownOptions = (options: PvFilterPanelOption[], colDef?: FilterOptionColDefLike) => {\n  const optionById = new Map<string, PvFilterPanelOption>();\n\n  const visit = (option: PvFilterPanelOption) => {\n    const unresolved = isUnresolvedFilterOption(option, colDef);\n    for (const id of getOptionIds(option)) {\n      const existing = optionById.get(id);\n      // The first named copy wins: callers list current options before cached ones.\n      if (!existing || (isUnresolvedFilterOption(existing, colDef) && !unresolved)) optionById.set(id, option);\n    }\n    option.children?.forEach(visit);\n  };\n\n  options.forEach(visit);\n  return optionById;\n};\n\nconst resolveOptionName = (\n  option: PvFilterPanelOption,\n  optionById: Map<string, PvFilterPanelOption>,\n  colDef?: FilterOptionColDefLike,\n) => {\n  const metadataLabel = getMetadataLabel(option, colDef);\n  const label = option.label?.trim();\n  if (metadataLabel && (!label || getOptionIds(option).includes(label))) return { ...option, label: metadataLabel };\n  if (!isUnresolvedFilterOption(option, colDef)) return option;\n\n  const named = getOptionIds(option)\n    .map((id) => optionById.get(id))\n    .find((candidate) => candidate && !isUnresolvedFilterOption(candidate, colDef));\n  if (!named) return null;\n\n  const namedLabel = getMetadataLabel(named, colDef) ?? named.label;\n  if (!namedLabel) return null;\n\n  // Keep all the named copy's metadata for formatters, with the row's own non-empty fields on top.\n  const ownMetadata = Object.entries(isRecord(option.metadata) ? option.metadata : {}).filter(\n    ([, value]) => value !== null && value !== undefined && value !== \"\",\n  );\n  const metadata = { ...(isRecord(named.metadata) ? named.metadata : {}), ...Object.fromEntries(ownMetadata) };\n\n  return { ...option, label: namedLabel, ...(Object.keys(metadata).length ? { metadata } : {}) };\n};\n\nexport const resolveFilterPanelOptions = (\n  options: PvFilterPanelOption[],\n  knownOptions: PvFilterPanelOption[],\n  colDef?: FilterOptionColDefLike,\n): PvFilterPanelOption[] => {\n  if (!colDef?.context?.metadataDisplayFields?.length) return options;\n  const optionById = indexKnownOptions(knownOptions, colDef);\n\n  const resolve = (rawOptions: PvFilterPanelOption[]): PvFilterPanelOption[] => {\n    return rawOptions.flatMap((rawOption) => {\n      const option = resolveOptionName(rawOption, optionById, colDef);\n      if (!option) return [];\n      if (!option.children?.length) return [option];\n\n      const children = resolve(option.children);\n      const totalChildCount =\n        option.totalChildCount !== undefined && option.children.length >= option.totalChildCount\n          ? children.length\n          : option.totalChildCount;\n      return [{ ...option, children, totalChildCount }];\n    });\n  };\n\n  return resolve(options);\n};\n\nexport const getFilterOptionResultCount = (option: FilterOptionDisplaySource | null | undefined) => {\n  const directResultCount = formatResultCount(option?.resultCount);\n  if (directResultCount !== undefined) return directResultCount;\n\n  const metadata = option?.metadata;\n  if (isRecord(metadata)) {\n    for (const key of RESULT_COUNT_METADATA_KEYS) {\n      const resultCount = formatResultCount(metadata[key]);\n      if (resultCount !== undefined) return resultCount;\n    }\n  }\n\n  return formatResultCount(option?.totalChildCount);\n};\n","import type { AdvancedFilterModel } from \"ag-grid-enterprise\";\nimport type { MultiSelectState, SelectionNode } from \"@/types\";\nimport {\n  createFilterPanelScopedValue,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n  parseFilterPanelScopedValue,\n} from \"./filterOptionValue\";\nimport type { PvFilterPanelAggregateFieldHierarchy, PvFilterPanelColDef, PvFilterPanelOption } from \"./types\";\n\ninterface LooseAdvancedFilterNode {\n  colId?: string;\n  conditions?: AdvancedFilterModel[];\n  filter?: boolean | number | string | null;\n  filterType?: string;\n  type?: string;\n}\n\nexport interface PvFilterPanelAggregateSelectionStatus {\n  indeterminate: boolean;\n  selected: boolean;\n}\n\nexport interface PvFilterPanelAggregateFieldValue {\n  field?: string;\n  value: string;\n}\n\nconst isAdvancedFilterJoin = (model: AdvancedFilterModel | null | undefined): model is AdvancedFilterModel => {\n  const node = model as LooseAdvancedFilterNode | null | undefined;\n  return node?.filterType === \"join\" && Array.isArray(node.conditions);\n};\n\nconst cloneAdvancedFilterNode = (model: AdvancedFilterModel): AdvancedFilterModel => {\n  const node = model as LooseAdvancedFilterNode;\n  if (!isAdvancedFilterJoin(model)) return { ...node } as AdvancedFilterModel;\n\n  return {\n    ...node,\n    conditions: (node.conditions ?? []).map(cloneAdvancedFilterNode),\n  } as AdvancedFilterModel;\n};\n\nexport const removeFilterPanelAggregateFieldsFromModel = (\n  model: AdvancedFilterModel | null | undefined,\n  fields: string[] | Set<string>,\n): AdvancedFilterModel | null => {\n  if (!model) return null;\n  const fieldSet = fields instanceof Set ? fields : new Set(fields);\n  if (!fieldSet.size) return cloneAdvancedFilterNode(model);\n\n  if (!isAdvancedFilterJoin(model)) {\n    const node = model as LooseAdvancedFilterNode;\n    return typeof node.colId === \"string\" && fieldSet.has(node.colId) ? null : cloneAdvancedFilterNode(model);\n  }\n\n  const node = model as LooseAdvancedFilterNode;\n  const conditions = (node.conditions ?? [])\n    .map((condition) => removeFilterPanelAggregateFieldsFromModel(condition, fieldSet))\n    .filter((condition): condition is AdvancedFilterModel => Boolean(condition));\n\n  if (!conditions.length) return null;\n  if (conditions.length === 1) return conditions[0];\n\n  return {\n    ...node,\n    conditions,\n  } as AdvancedFilterModel;\n};\n\nexport const flattenFilterPanelAggregateFieldHierarchy = (\n  hierarchy: PvFilterPanelAggregateFieldHierarchy | undefined,\n): string[] => {\n  if (!hierarchy) return [];\n  return [hierarchy.field, ...(hierarchy.children ?? []).flatMap(flattenFilterPanelAggregateFieldHierarchy)];\n};\n\nexport const getFilterPanelAggregateLeafFields = (\n  hierarchy: PvFilterPanelAggregateFieldHierarchy | undefined,\n): string[] => {\n  if (!hierarchy) return [];\n  if (!hierarchy.children?.length) return [hierarchy.field];\n  return hierarchy.children.flatMap(getFilterPanelAggregateLeafFields);\n};\n\nexport const getFilterPanelAggregateFields = (colDef: PvFilterPanelColDef | null | undefined): string[] => {\n  const context = colDef?.context ?? {};\n  return context.aggregateFieldHierarchy\n    ? flattenFilterPanelAggregateFieldHierarchy(context.aggregateFieldHierarchy)\n    : (context.aggregateFields ?? []);\n};\n\nexport const getFilterPanelAggregateRootField = (\n  colDef: PvFilterPanelColDef | null | undefined,\n): string | undefined => {\n  const context = colDef?.context ?? {};\n  if (context.aggregateFieldHierarchy) return context.aggregateFieldHierarchy.field;\n  return context.aggregateFields?.[context.aggregateFields.length - 1];\n};\n\nexport const isFilterPanelAggregateColDef = (colDef: PvFilterPanelColDef | null | undefined): boolean => {\n  return getFilterPanelAggregateFields(colDef).length > 0;\n};\n\nexport const findFilterPanelOptionByValue = (\n  options: (PvFilterPanelOption | null)[] | undefined,\n  value: string,\n): PvFilterPanelOption | undefined => {\n  for (const option of options ?? []) {\n    if (!option) continue;\n    if (option.value === value) return option;\n    const childMatch = findFilterPanelOptionByValue(option.children, value);\n    if (childMatch) return childMatch;\n  }\n  return undefined;\n};\n\nconst findFilterPanelOptionPathByValue = (\n  options: (PvFilterPanelOption | null)[] | undefined,\n  value: string,\n  path: PvFilterPanelOption[] = [],\n): PvFilterPanelOption[] | undefined => {\n  for (const option of options ?? []) {\n    if (!option) continue;\n    const nextPath = [...path, option];\n    if (option.value === value) return nextPath;\n    const childPath = findFilterPanelOptionPathByValue(option.children, value, nextPath);\n    if (childPath) return childPath;\n  }\n  return undefined;\n};\n\nexport const getFilterPanelAggregateFieldValue = (\n  optionId: string,\n  options?: (PvFilterPanelOption | null)[],\n): PvFilterPanelAggregateFieldValue => {\n  const option = findFilterPanelOptionByValue(options, optionId);\n  const optionField = option ? getFilterPanelOptionField(option, \"\") : undefined;\n  const optionRawValue = option ? getFilterPanelOptionRawValue(option) : null;\n  if (optionField && optionRawValue !== null) return { field: optionField, value: optionRawValue };\n\n  const parsed = parseFilterPanelScopedValue(optionId);\n  return {\n    field: parsed?.field,\n    value: parsed?.value ?? optionId,\n  };\n};\n\nexport const findFilterPanelAggregateOptionId = (\n  options: (PvFilterPanelOption | null)[] | undefined,\n  field: string,\n  rawValue: string,\n): string => {\n  const matches = (option: PvFilterPanelOption | null): string | undefined => {\n    if (!option) return undefined;\n    const optionField = getFilterPanelOptionField(option, \"\");\n    const optionRawValue = getFilterPanelOptionRawValue(option);\n    if (optionField === field && optionRawValue === rawValue) return option.value;\n\n    for (const child of option.children ?? []) {\n      const childMatch = matches(child);\n      if (childMatch) return childMatch;\n    }\n    return undefined;\n  };\n\n  for (const option of options ?? []) {\n    const match = matches(option);\n    if (match) return match;\n  }\n\n  return `__${field}__${rawValue}`;\n};\n\nconst collectDeselectedSelectionNodes = (nodes: SelectionNode[] | undefined): SelectionNode[] => {\n  return (nodes ?? []).flatMap((node) => [\n    ...(node.state === \"deselected\" ? [node] : []),\n    ...collectDeselectedSelectionNodes(node.children),\n  ]);\n};\n\nconst buildFilterPanelAggregateNodeCondition = (\n  node: SelectionNode,\n  options?: (PvFilterPanelOption | null)[],\n): AdvancedFilterModel | null => {\n  if (node.state !== \"selected\") return null;\n\n  const { field, value } = getFilterPanelAggregateFieldValue(node.id, options);\n  if (!field) return null;\n\n  const conditions: AdvancedFilterModel[] = [\n    {\n      colId: field,\n      filter: value,\n      filterType: \"text\",\n      type: \"equals\",\n    } as AdvancedFilterModel,\n  ];\n\n  for (const child of collectDeselectedSelectionNodes(node.children)) {\n    const childValue = getFilterPanelAggregateFieldValue(child.id, options);\n    if (!childValue.field) continue;\n    conditions.push({\n      colId: childValue.field,\n      filter: childValue.value,\n      filterType: \"text\",\n      type: \"notEqual\",\n    } as AdvancedFilterModel);\n  }\n\n  return conditions.length === 1\n    ? conditions[0]\n    : ({ conditions, filterType: \"join\", type: \"AND\" } as AdvancedFilterModel);\n};\n\nexport const buildFilterPanelAggregateModelFromSelectionState = (params: {\n  baseModel: AdvancedFilterModel | null | undefined;\n  colDef: PvFilterPanelColDef;\n  options?: (PvFilterPanelOption | null)[];\n  state: MultiSelectState;\n}): AdvancedFilterModel | null => {\n  const aggregateFields = getFilterPanelAggregateFields(params.colDef);\n  const baseModel = removeFilterPanelAggregateFieldsFromModel(params.baseModel, aggregateFields);\n  if (!aggregateFields.length) return baseModel;\n\n  const conditions = params.state\n    .map((node) => buildFilterPanelAggregateNodeCondition(node, params.options))\n    .filter((condition): condition is AdvancedFilterModel => Boolean(condition));\n\n  if (!conditions.length) return baseModel;\n\n  const aggregateCondition: AdvancedFilterModel =\n    conditions.length === 1 ? conditions[0] : ({ conditions, filterType: \"join\", type: \"OR\" } as AdvancedFilterModel);\n\n  if (!baseModel) return aggregateCondition;\n  return { conditions: [baseModel, aggregateCondition], filterType: \"join\", type: \"AND\" } as AdvancedFilterModel;\n};\n\nconst getFilterPanelAggregateColumnConditions = (\n  model: AdvancedFilterModel | null | undefined,\n  fields: Set<string>,\n  leafFields: Set<string>,\n): Array<{ colId: string; filter?: string; parentEquals?: { colId: string; filter?: string }; type?: string }> => {\n  if (!model) return [];\n  const node = model as LooseAdvancedFilterNode;\n\n  if (isAdvancedFilterJoin(model)) {\n    const conditions = node.conditions ?? [];\n    if (node.type === \"AND\") {\n      const directEquals = conditions.find((condition) => {\n        const conditionNode = condition as LooseAdvancedFilterNode;\n        return (\n          conditionNode.filterType !== \"join\" &&\n          typeof conditionNode.colId === \"string\" &&\n          fields.has(conditionNode.colId) &&\n          conditionNode.type === \"equals\" &&\n          !leafFields.has(conditionNode.colId)\n        );\n      }) as LooseAdvancedFilterNode | undefined;\n\n      return conditions.flatMap((condition) =>\n        getFilterPanelAggregateColumnConditions(condition, fields, leafFields).map((childCondition) => ({\n          ...childCondition,\n          parentEquals:\n            childCondition.parentEquals ||\n            (directEquals?.colId\n              ? {\n                  colId: directEquals.colId,\n                  filter: directEquals.filter == null ? undefined : String(directEquals.filter),\n                }\n              : undefined),\n        })),\n      );\n    }\n\n    return conditions.flatMap((condition) => getFilterPanelAggregateColumnConditions(condition, fields, leafFields));\n  }\n\n  if (node.colId && fields.has(node.colId)) {\n    return [\n      {\n        colId: node.colId,\n        filter: node.filter == null ? undefined : String(node.filter),\n        type: node.type,\n      },\n    ];\n  }\n\n  return [];\n};\n\nexport const seedFilterPanelAggregateSelectionState = (params: {\n  colDef: PvFilterPanelColDef;\n  model: AdvancedFilterModel | null | undefined;\n  options?: (PvFilterPanelOption | null)[];\n}): MultiSelectState => {\n  const aggregateFields = getFilterPanelAggregateFields(params.colDef);\n  if (!aggregateFields.length) return [];\n\n  const leafFields = new Set(getFilterPanelAggregateLeafFields(params.colDef.context?.aggregateFieldHierarchy));\n  const rootField = getFilterPanelAggregateRootField(params.colDef);\n  const conditions = getFilterPanelAggregateColumnConditions(params.model, new Set(aggregateFields), leafFields);\n  const nodeMap = new Map<string, SelectionNode>();\n\n  for (const condition of conditions) {\n    if (!condition.filter) continue;\n    const optionId = findFilterPanelAggregateOptionId(params.options, condition.colId, String(condition.filter));\n\n    if (condition.type === \"equals\") {\n      const existing = nodeMap.get(optionId);\n      nodeMap.set(optionId, { id: optionId, state: \"selected\", children: existing?.children });\n      continue;\n    }\n\n    if (condition.type === \"notEqual\" && condition.parentEquals?.filter && rootField) {\n      const parentId = findFilterPanelAggregateOptionId(\n        params.options,\n        condition.parentEquals.colId,\n        String(condition.parentEquals.filter),\n      );\n      const existing = nodeMap.get(parentId) ?? { children: [], id: parentId, state: \"selected\" as const };\n      existing.children = [...(existing.children ?? []), { id: optionId, state: \"deselected\" as const }];\n      nodeMap.set(parentId, existing);\n    }\n  }\n\n  return [...nodeMap.values()];\n};\n\nexport const getFilterPanelAggregateSelectedValuesByField = (params: {\n  colDef: PvFilterPanelColDef;\n  model: AdvancedFilterModel | null | undefined;\n  options?: (PvFilterPanelOption | null)[];\n}): Map<string, string[]> => {\n  const selectedValuesByField = new Map<string, string[]>();\n  const aggregateFields = getFilterPanelAggregateFields(params.colDef);\n  if (!aggregateFields.length) return selectedValuesByField;\n\n  const conditions = getFilterPanelAggregateColumnConditions(\n    params.model,\n    new Set(aggregateFields),\n    new Set(getFilterPanelAggregateLeafFields(params.colDef.context?.aggregateFieldHierarchy)),\n  );\n\n  for (const condition of conditions) {\n    if (condition.type !== \"equals\" || !condition.filter) continue;\n    const values = selectedValuesByField.get(condition.colId) ?? [];\n    if (!values.includes(condition.filter)) values.push(condition.filter);\n    selectedValuesByField.set(condition.colId, values);\n  }\n\n  return selectedValuesByField;\n};\n\nconst cloneSelectionState = (state: MultiSelectState): MultiSelectState =>\n  state.map((node) => ({\n    ...node,\n    children: node.children?.map((child) => ({\n      ...child,\n      children: child.children ? cloneSelectionState(child.children) : undefined,\n    })),\n  }));\n\nconst removeSelectionNodeById = (state: MultiSelectState, id: string): MultiSelectState => {\n  return state.flatMap((node) => {\n    if (node.id === id) return [];\n    const children = node.children ? removeSelectionNodeById(node.children, id) : undefined;\n    return [{ ...node, children: children?.length ? children : undefined }];\n  });\n};\n\nconst getSelectionNode = (state: MultiSelectState, id: string): SelectionNode | undefined => {\n  for (const node of state) {\n    if (node.id === id) return node;\n    const childMatch = node.children ? getSelectionNode(node.children, id) : undefined;\n    if (childMatch) return childMatch;\n  }\n  return undefined;\n};\n\nconst hasAggregateChildren = (option: PvFilterPanelOption) => {\n  return Boolean(option.children?.length) || (option.totalChildCount ?? 0) > 0;\n};\n\nconst upsertSelectionNode = (state: MultiSelectState, node: SelectionNode): MultiSelectState => {\n  const withoutExisting = removeSelectionNodeById(state, node.id);\n  return [...withoutExisting, node];\n};\n\nconst collectDescendantOptionIds = (option: PvFilterPanelOption): string[] => {\n  return (option.children ?? []).flatMap((child) => [child.value, ...collectDescendantOptionIds(child)]);\n};\n\nconst removeDescendantSelectionNodes = (state: MultiSelectState, option: PvFilterPanelOption): MultiSelectState => {\n  return collectDescendantOptionIds(option).reduce(\n    (nextState, descendantId) => removeSelectionNodeById(nextState, descendantId),\n    state,\n  );\n};\n\nconst removeSelectionNodeAndDescendants = (state: MultiSelectState, option: PvFilterPanelOption): MultiSelectState => {\n  return [option.value, ...collectDescendantOptionIds(option)].reduce(\n    (nextState, descendantId) => removeSelectionNodeById(nextState, descendantId),\n    state,\n  );\n};\n\nconst getNearestSelectedAncestor = (\n  state: MultiSelectState,\n  option: PvFilterPanelOption,\n  options?: (PvFilterPanelOption | null)[],\n): SelectionNode | undefined => {\n  const path = findFilterPanelOptionPathByValue(options, option.value) ?? [];\n  const ancestors = path.slice(0, -1).reverse();\n\n  for (const ancestor of ancestors) {\n    const selectedAncestor = getSelectionNode(state, ancestor.value);\n    if (selectedAncestor?.state === \"selected\") return selectedAncestor;\n  }\n\n  return undefined;\n};\n\nexport const updateFilterPanelAggregateSelectionState = (params: {\n  checked: boolean;\n  option: PvFilterPanelOption;\n  options?: (PvFilterPanelOption | null)[];\n  state: MultiSelectState;\n}): MultiSelectState => {\n  const nextState = cloneSelectionState(params.state);\n  const selectedAncestor = getNearestSelectedAncestor(nextState, params.option, params.options);\n\n  if (selectedAncestor) {\n    const existingDeselectedChildren = selectedAncestor.children ?? [];\n    selectedAncestor.children = params.checked\n      ? removeSelectionNodeAndDescendants(existingDeselectedChildren, params.option)\n      : [\n          ...removeSelectionNodeAndDescendants(existingDeselectedChildren, params.option),\n          { id: params.option.value, state: \"deselected\" as const },\n        ];\n    if (!selectedAncestor.children.length) delete selectedAncestor.children;\n    return nextState;\n  }\n\n  if (hasAggregateChildren(params.option)) {\n    return params.checked\n      ? upsertSelectionNode(removeDescendantSelectionNodes(nextState, params.option), {\n          id: params.option.value,\n          state: \"selected\",\n        })\n      : removeSelectionNodeById(nextState, params.option.value);\n  }\n\n  return params.checked\n    ? upsertSelectionNode(nextState, { id: params.option.value, state: \"selected\" })\n    : removeSelectionNodeById(nextState, params.option.value);\n};\n\nconst createSelectionNodeMap = (state: MultiSelectState) => {\n  const nodeMap = new Map<string, SelectionNode>();\n\n  const addNodes = (nodes: SelectionNode[] | undefined) => {\n    for (const node of nodes ?? []) {\n      nodeMap.set(node.id, node);\n      addNodes(node.children);\n    }\n  };\n\n  addNodes(state);\n  return nodeMap;\n};\n\nexport const createFilterPanelAggregateSelectionStatusMap = (params: {\n  options?: (PvFilterPanelOption | null)[];\n  state: MultiSelectState;\n}): Map<string, PvFilterPanelAggregateSelectionStatus> => {\n  const nodeMap = createSelectionNodeMap(params.state);\n  const statusMap = new Map<string, PvFilterPanelAggregateSelectionStatus>();\n\n  const visitOption = (\n    option: PvFilterPanelOption,\n    inheritedSelected: boolean,\n  ): PvFilterPanelAggregateSelectionStatus => {\n    const directNode = nodeMap.get(option.value);\n    const selected = directNode?.state === \"selected\" || (inheritedSelected && directNode?.state !== \"deselected\");\n\n    const childStatuses: PvFilterPanelAggregateSelectionStatus[] = (option.children ?? []).map((child) =>\n      visitOption(child, selected),\n    );\n    const hasSelectedChild = childStatuses.some((status) => status.selected || status.indeterminate);\n    const hasUnselectedChild = childStatuses.some((status) => !status.selected || status.indeterminate);\n    const hasDeselectedChildren = collectDeselectedSelectionNodes(directNode?.children).length > 0;\n    const status: PvFilterPanelAggregateSelectionStatus = {\n      indeterminate: hasDeselectedChildren || (!selected && hasSelectedChild) || (selected && hasUnselectedChild),\n      selected,\n    };\n\n    statusMap.set(option.value, status);\n    return status;\n  };\n\n  for (const option of params.options ?? []) {\n    if (option) visitOption(option, false);\n  }\n\n  return statusMap;\n};\n\nexport const getFilterPanelAggregateOptionSelectionStatus = (params: {\n  option: PvFilterPanelOption;\n  options?: (PvFilterPanelOption | null)[];\n  state: MultiSelectState;\n}): PvFilterPanelAggregateSelectionStatus => {\n  return (\n    createFilterPanelAggregateSelectionStatusMap(params).get(params.option.value) ??\n    createFilterPanelAggregateSelectionStatusMap({ options: [params.option], state: params.state }).get(\n      params.option.value,\n    ) ?? {\n      indeterminate: false,\n      selected: false,\n    }\n  );\n};\n\nexport const getFilterPanelAggregateSelectionOptions = (params: {\n  options?: (PvFilterPanelOption | null)[];\n  state: MultiSelectState;\n}): PvFilterPanelOption[] => {\n  return params.state.flatMap((node) => {\n    if (node.state !== \"selected\") return [];\n    const option = findFilterPanelOptionByValue(params.options, node.id);\n    if (option) return [option];\n\n    const { field, value } = getFilterPanelAggregateFieldValue(node.id, params.options);\n    return [\n      {\n        colField: field,\n        label: value,\n        metadata: { rawValue: value },\n        value: field ? createFilterPanelScopedValue(field, value) : node.id,\n      },\n    ];\n  });\n};\n\nexport const getFilterPanelAggregateSelectionCount = (state: MultiSelectState): number => {\n  return state.filter((node) => node.state === \"selected\").length;\n};\n","<script setup lang=\"ts\">\nimport { computed, ref, useId, watch, watchEffect } from \"vue\";\nimport { watchDebounced } from \"@vueuse/core\";\nimport type { MenuOption } from \"@/types\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvCounterBadge from \"@/components/base/PvCounterBadge/PvCounterBadge.vue\";\nimport PvCheckbox from \"@/components/base/PvCheckbox/PvCheckbox.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport PvRange from \"@/components/base/PvRange/PvRange.vue\";\nimport type { PvRangeValue } from \"@/components/base/PvRange/types\";\nimport PvFilterPanelOptionRow from \"./PvFilterPanelOptionRow.vue\";\nimport { getFilterOptionLabel, getFilterOptionResultCount } from \"./filterOptionDisplay\";\nimport {\n  createFilterPanelAggregateSelectionStatusMap,\n  getFilterPanelAggregateSelectionCount,\n  updateFilterPanelAggregateSelectionState,\n} from \"./aggregateFilterModel\";\nimport {\n  flattenFilterPanelOptions,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n} from \"./filterOptionValue\";\nimport type {\n  PvFilterPanelAccordionProps,\n  PvFilterPanelControlChange,\n  PvFilterPanelFilterType,\n  PvFilterPanelOption,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelAccordionProps>(), {\n  disableWhileLoading: true,\n});\n\nconst emit = defineEmits<{\n  \"focus-change\": [field: string, value: string, option: PvFilterPanelOption];\n  \"handle-settings-icon\": [field: string, colDef: PvFilterPanelAccordionProps[\"filter\"][\"colDef\"]];\n  \"load-more\": [query: string, parentId?: string];\n  \"open-change\": [open: boolean];\n  \"filter-change\": [change: PvFilterPanelControlChange];\n  \"search-change\": [query: string];\n}>();\n\nconst UNPINNED_PAGE_SIZE = 5;\nconst KNOWN_OPTION_MAP_MAX_SIZE = 500;\n\ninterface DisplayedFilterOptionRow {\n  depth: number;\n  /** Whether the row's top-level option is a preference, so children stay in its section after search or pinning. */\n  inPreferences: boolean;\n  kind: \"option\";\n  option: PvFilterPanelOption;\n}\n\ninterface DisplayedFilterChildLoadMoreRow {\n  depth: number;\n  inPreferences: boolean;\n  kind: \"child-load-more\";\n  parent: PvFilterPanelOption;\n}\n\ntype DisplayedFilterOption = DisplayedFilterOptionRow | DisplayedFilterChildLoadMoreRow;\n\nconst filterContent = ref<HTMLElement | null>(null);\nconst knownOptionMap = ref<Record<string, PvFilterPanelOption>>({});\nconst preservedContentHeight = ref(0);\nconst radioGroupName = useId();\n// Seeded once: the input owns its text after mount. Syncing from `searchQuery` would echo the trimmed\n// emitted query back into the input and drop a just-typed trailing space.\nconst searchText = ref(props.filter.searchQuery ?? \"\");\nconst visibleUnpinnedCount = ref(UNPINNED_PAGE_SIZE);\n\nconst existsLabel = computed(() => props.filter.existsLabel ?? `Has ${props.filter.label}`);\nconst falseLabel = computed(() => props.filter.valueLabels?.[\"false\"] ?? \"No\");\nconst filterOptions = computed(() => props.filter.options ?? []);\nconst focusText = computed(() => props.filter.focusText ?? \"Focus\");\nconst knownOptions = computed(() => [...(props.filter.knownOptions ?? []), ...filterOptions.value]);\nconst filterType = computed<PvFilterPanelFilterType>(() => props.filter.type ?? \"value\");\nconst isValueFilter = computed(() => filterType.value === \"value\");\nconst isAggregateFilter = computed(() => isValueFilter.value && props.filter.isAggregate === true);\nconst aggregateSelectionState = computed(() => props.filter.aggregateSelectionState ?? []);\nconst normalizedSearchText = computed(() => searchText.value.trim().toLowerCase());\nconst selectedValues = computed(() => props.filter.selectedValues ?? []);\nconst selectedValueSet = computed(() => new Set(selectedValues.value));\nconst currentOptionMap = computed(() =>\n  Object.fromEntries(flattenFilterPanelOptions(knownOptions.value).map((option) => [option.value, option])),\n);\nconst getKnownOption = (value: string) => {\n  if (!isAggregateFilter.value && props.filter.colDef.context?.metadataDisplayFields?.length) {\n    return currentOptionMap.value[value] ?? knownOptionMap.value[value];\n  }\n  return knownOptionMap.value[value];\n};\nconst trueLabel = computed(() => props.filter.valueLabels?.[\"true\"] ?? \"Yes\");\nconst optionsSortLabel = computed(() => props.filter.filterOptionsSortDescription || \"Suggested\");\nconst isInteractionDisabled = computed(\n  () => props.filter.disabled === true || (props.disableWhileLoading && props.filter.isLoading === true),\n);\n\n// A value labels map that declares only one boolean key means that column is only meaningful in\n// that direction, so we render just that button. Anything else keeps the full true/false pair.\nconst booleanChoices = computed<{ label: string; value: boolean }[]>(() => {\n  const valueLabels = props.filter.valueLabels;\n  const hasTrue = typeof valueLabels?.[\"true\"] === \"string\";\n  const hasFalse = typeof valueLabels?.[\"false\"] === \"string\";\n  if (hasTrue && !hasFalse) return [{ label: trueLabel.value, value: true }];\n  if (hasFalse && !hasTrue) return [{ label: falseLabel.value, value: false }];\n\n  return [\n    { label: trueLabel.value, value: true },\n    { label: falseLabel.value, value: false },\n  ];\n});\n\nconst getSearchableOptionText = (option: PvFilterPanelOption) => {\n  const metadataValues =\n    typeof option.metadata === \"object\" && option.metadata !== null ? Object.values(option.metadata) : [];\n  return [option.value, option.label, option.subText, option.subduedText, option.matchedValue, option.matchedField]\n    .concat(metadataValues.flatMap((value) => (value === null || value === undefined ? [] : [String(value)])))\n    .filter((value): value is string => Boolean(value))\n    .join(\" \")\n    .toLowerCase();\n};\n\nconst counter = computed(() => {\n  if (filterType.value === \"range\") {\n    return props.filter.rangeValue?.min !== null && props.filter.rangeValue?.min !== undefined\n      ? 1\n      : props.filter.rangeValue?.max !== null && props.filter.rangeValue?.max !== undefined\n        ? 1\n        : undefined;\n  }\n\n  if (filterType.value === \"boolean\") {\n    return props.filter.booleanValue !== null && props.filter.booleanValue !== undefined ? 1 : undefined;\n  }\n\n  if (filterType.value === \"exists\") return props.filter.existsValue ? 1 : undefined;\n  if (isAggregateFilter.value) return getFilterPanelAggregateSelectionCount(aggregateSelectionState.value) || undefined;\n  return selectedValues.value.length || undefined;\n});\n\nconst optionHasMoreChildren = (option: PvFilterPanelOption) => {\n  if (option.totalChildCount === null || option.totalChildCount === undefined) return false;\n  return option.totalChildCount > (option.children?.length ?? 0);\n};\n\nconst flattenOptions = (\n  options: PvFilterPanelOption[],\n  depth = 0,\n  parentInPreferences?: boolean,\n): DisplayedFilterOption[] => {\n  return options.flatMap((option) => {\n    const inPreferences = parentInPreferences ?? option.isPreference === true;\n    return [\n      { depth, inPreferences, kind: \"option\", option } as DisplayedFilterOptionRow,\n      ...(option.children?.length ? flattenOptions(option.children, depth + 1, inPreferences) : []),\n      ...(optionHasMoreChildren(option)\n        ? ([\n            { depth: depth + 1, inPreferences, kind: \"child-load-more\", parent: option },\n          ] as DisplayedFilterChildLoadMoreRow[])\n        : []),\n    ];\n  });\n};\n\nconst displayedOptions = computed<DisplayedFilterOption[]>(() => {\n  const flattenedOptions = flattenOptions(filterOptions.value);\n  const query = normalizedSearchText.value;\n  if (props.filter.clientFiltering === false || !query) return flattenedOptions;\n  return flattenedOptions.filter(\n    (item): item is DisplayedFilterOptionRow =>\n      item.kind === \"option\" && getSearchableOptionText(item.option).includes(query),\n  );\n});\n\nconst selectedOptions = computed(() =>\n  isAggregateFilter.value || props.filter.singleSelect\n    ? []\n    : selectedValues.value.map((value) => getKnownOption(value) ?? { label: value, value }),\n);\n\n// Selections are hoisted into the pinned block only when the section is (re-)displayed. Toggling a\n// checkbox inside an already-open section leaves the row exactly where it is, so nothing jumps out\n// from under the cursor; the next time the section is displayed the pinned set is re-snapshotted and\n// the selections come back to the top.\nconst pinnedValues = ref<string[]>([]);\nconst pinnedValueSet = computed(() => new Set(pinnedValues.value));\nconst pinnedOptions = computed(() =>\n  pinnedValues.value.map((value) => getKnownOption(value) ?? { label: value, value }),\n);\nconst hasLoadedValueOptions = computed(() => filterOptions.value.length > 0 || pinnedOptions.value.length > 0);\nconst isRefreshing = computed(\n  () => isValueFilter.value && props.filter.isOpen && props.filter.isLoading === true && hasLoadedValueOptions.value,\n);\n\nconst repinSelectedValues = () => {\n  pinnedValues.value = isAggregateFilter.value || props.filter.singleSelect ? [] : [...selectedValues.value];\n};\n\nrepinSelectedValues();\n\nconst unpinnedOptions = computed(() =>\n  isAggregateFilter.value || props.filter.singleSelect\n    ? displayedOptions.value\n    : displayedOptions.value.filter(\n        (item) => item.kind === \"child-load-more\" || !pinnedValueSet.value.has(item.option.value),\n      ),\n);\nconst hasMoreLocalUnpinned = computed(() => unpinnedOptions.value.length > visibleUnpinnedCount.value);\nconst showSeeMoreButton = computed(() => hasMoreLocalUnpinned.value || props.filter.hasMore);\nconst visibleUnpinnedOptions = computed(() => unpinnedOptions.value.slice(0, visibleUnpinnedCount.value));\n// Preference options (and their children) get their own section, like the table set filter's\n// \"Your Preferences\" group.\nconst optionSections = computed(() => {\n  const preferenceRows = visibleUnpinnedOptions.value.filter((item) => item.inPreferences);\n  const otherRows = visibleUnpinnedOptions.value.filter((item) => !item.inPreferences);\n  return [\n    { key: \"preferences\", rows: preferenceRows },\n    { key: \"options\", rows: otherRows },\n  ].filter((section) => section.rows.length);\n});\n\nconst aggregateSelectionStatusMap = computed(() =>\n  isAggregateFilter.value\n    ? createFilterPanelAggregateSelectionStatusMap({\n        options: knownOptions.value,\n        state: aggregateSelectionState.value,\n      })\n    : new Map<string, { indeterminate: boolean; selected: boolean }>(),\n);\n\nconst getOptionDisplayLabel = (option: PvFilterPanelOption) => getFilterOptionLabel(option, props.filter.colDef);\nconst getOptionDisplayResultCount = (option: PvFilterPanelOption) => getFilterOptionResultCount(option);\nconst getOptionSelectionStatus = (option: PvFilterPanelOption) => {\n  if (!isAggregateFilter.value) return { indeterminate: false, selected: selectedValueSet.value.has(option.value) };\n  return aggregateSelectionStatusMap.value.get(option.value) ?? { indeterminate: false, selected: false };\n};\nconst isOptionSelected = (option: PvFilterPanelOption) => getOptionSelectionStatus(option).selected;\nconst isOptionIndeterminate = (option: PvFilterPanelOption) => getOptionSelectionStatus(option).indeterminate;\n\nconst getOptionFilterValue = (option: PvFilterPanelOption) => getFilterPanelOptionRawValue(option) ?? option.value;\nconst getOptionFilterField = (option: PvFilterPanelOption) => getFilterPanelOptionField(option, props.filter.key);\n\nconst isOptionFocused = (option: PvFilterPanelOption) => {\n  const field = getOptionFilterField(option);\n  const rawValue = getOptionFilterValue(option);\n  return (\n    props.filter.focusedValuesByField?.[field]?.includes(rawValue) ||\n    (field === props.filter.key && props.filter.focusedValues?.includes(option.value)) ||\n    false\n  );\n};\n\nconst isOptionFocusable = (option: PvFilterPanelOption) => {\n  const fields = props.filter.focusableFields ?? [];\n  return !fields.length || fields.includes(getOptionFilterField(option));\n};\n\nconst isFocusActionDisabled = (option: PvFilterPanelOption) => {\n  return !isOptionFocusable(option) || (isOptionFocused(option) && props.filter.canRemoveFocus === false);\n};\n\nconst getFocusActionLabel = (option: PvFilterPanelOption) => {\n  const field = getOptionFilterField(option);\n  if (!isOptionFocusable(option)) {\n    return `Group by ${props.filter.focusFieldLabels?.[field] ?? field} to enable ${focusText.value}`;\n  }\n  if (isOptionFocused(option) && props.filter.canRemoveFocus === false) return `${focusText.value} (required)`;\n  return isOptionFocused(option) ? `Remove ${focusText.value}` : `Select as ${focusText.value}`;\n};\n\nconst toMenuOption = (option: PvFilterPanelOption): MenuOption<PvFilterPanelOption> => ({\n  ...(option.menuOption ?? {}),\n  children: option.children?.map(toMenuOption),\n  context: option,\n  disabled: isInteractionDisabled.value || option.isSelectable === false || option.menuOption?.disabled,\n  id: option.value,\n  searchText: getSearchableOptionText(option),\n  secondaryText: getOptionDisplayResultCount(option),\n  subText: option.subText,\n  subduedText: option.subduedText,\n  text: getOptionDisplayLabel(option),\n  totalChildCount: option.totalChildCount,\n});\n\nconst rendererOptions = computed(() => filterOptions.value.map(toMenuOption));\nconst rendererSelectedItems = computed(() => selectedOptions.value.map(toMenuOption));\nconst rendererSlotProps = computed(() => ({\n  colDef: props.filter.colDef,\n  disabled: isInteractionDisabled.value,\n  filter: props.filter,\n  isLoading: props.filter.isLoading,\n  isOpen: props.filter.isOpen,\n  options: rendererOptions.value,\n  searchInput: searchText.value,\n  selectedItems: rendererSelectedItems.value,\n  slotContext: {\n    colDef: props.filter.colDef,\n    rowsLoading: props.filter.isLoading,\n  },\n}));\n\nconst handleSeeMore = () => {\n  if (isInteractionDisabled.value) return;\n\n  if (hasMoreLocalUnpinned.value) {\n    visibleUnpinnedCount.value += UNPINNED_PAGE_SIZE;\n  } else if (props.filter.hasMore) {\n    emit(\"load-more\", searchText.value.trim());\n  }\n};\n\nconst handleSeeMoreChildren = (parent: PvFilterPanelOption) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"load-more\", searchText.value.trim(), parent.value);\n};\n\nconst handleToggle = (event: Event) => {\n  const detailsElement = event.target as HTMLDetailsElement;\n  emit(\"open-change\", detailsElement.open);\n};\n\nconst emitBooleanChange = (value: boolean | null) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"boolean\", value });\n};\n\nconst emitExistsChange = (value: boolean | undefined) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"exists\", value: value === true });\n};\n\nconst emitRangeChange = (value: PvRangeValue) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"range\", value });\n};\n\nconst handleToggleValue = (option: PvFilterPanelOption, checked: boolean) => {\n  if (isInteractionDisabled.value) return;\n\n  if (isAggregateFilter.value) {\n    emit(\"filter-change\", {\n      type: \"aggregate-selection\",\n      value: updateFilterPanelAggregateSelectionState({\n        checked,\n        option,\n        options: knownOptions.value,\n        state: aggregateSelectionState.value,\n      }),\n    });\n    return;\n  }\n\n  emit(\"filter-change\", {\n    checked,\n    field: getOptionFilterField(option),\n    type: \"value\",\n    value: getOptionFilterValue(option),\n  });\n};\n\nconst handleFocusValue = (option: PvFilterPanelOption) => {\n  if (isInteractionDisabled.value || isFocusActionDisabled(option)) return;\n  emit(\"focus-change\", getOptionFilterField(option), getOptionFilterValue(option), option);\n};\n\nconst handleGroupToggle = (field: string, isActive: boolean) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { field, type: \"boolean\", value: isActive ? null : true });\n};\n\nconst handleSettingsClick = () => {\n  if (isInteractionDisabled.value) return;\n  emit(\"handle-settings-icon\", props.filter.key, props.filter.colDef);\n};\n\nwatch([searchText, () => props.filter.key], () => {\n  visibleUnpinnedCount.value = UNPINNED_PAGE_SIZE;\n});\n\nconst syncKnownOptionMap = () => {\n  const flattenedOptions = flattenFilterPanelOptions(knownOptions.value);\n  const nextOptionMap = { ...knownOptionMap.value };\n  const entries = new Map(Object.entries(nextOptionMap));\n  for (const option of flattenedOptions) {\n    entries.delete(option.value);\n    entries.set(option.value, option);\n  }\n\n  knownOptionMap.value = Object.fromEntries(\n    [...entries.entries()].slice(Math.max(0, entries.size - KNOWN_OPTION_MAP_MAX_SIZE)),\n  );\n};\n\nwatch(\n  knownOptions,\n  () => {\n    if (props.filter.isOpen) syncKnownOptionMap();\n  },\n  { immediate: true },\n);\n\n// Hold the section at its pre-refresh height while options load so it does not collapse and jump\n// mid-search, then release it once loading finishes so the section fits the options that came back.\n// These watchers run before the DOM updates, so offsetHeight is still the height of the old rows.\nconst holdContentHeight = () => {\n  if (!props.filter.isOpen || !filterContent.value) return;\n  preservedContentHeight.value = Math.max(preservedContentHeight.value, filterContent.value.offsetHeight);\n};\n\nwatch(\n  () => props.filter.isLoading === true,\n  (isLoading) => {\n    if (isLoading) holdContentHeight();\n    else preservedContentHeight.value = 0;\n  },\n);\n\nwatch(filterOptions, () => {\n  if (props.filter.isLoading) holdContentHeight();\n});\n\nwatch(\n  () => props.filter.isOpen,\n  (isOpen) => {\n    if (isOpen) {\n      syncKnownOptionMap();\n      repinSelectedValues();\n    } else {\n      knownOptionMap.value = {};\n      preservedContentHeight.value = 0;\n    }\n  },\n);\n\n// A selection can drop out of the rendered rows without the section being re-displayed: the search\n// query stops matching it, or the consumer reloads options and returns a page that no longer\n// contains it. Those rows still have to be reachable so they can be unchecked, so they get pinned\n// rather than disappearing. Pinning only ever shortens the unpinned list, so this settles at once.\nwatchEffect(() => {\n  if (!props.filter.isOpen || isAggregateFilter.value || props.filter.singleSelect) return;\n\n  const renderedValues = new Set(\n    visibleUnpinnedOptions.value.flatMap((item) => (item.kind === \"option\" ? [item.option.value] : [])),\n  );\n  const stranded = selectedValues.value.filter(\n    (value) => !pinnedValueSet.value.has(value) && !renderedValues.has(value),\n  );\n  if (stranded.length) pinnedValues.value = [...pinnedValues.value, ...stranded];\n});\n\nwatchDebounced(\n  searchText,\n  (query) => {\n    if (!isValueFilter.value || props.filter.disabled === true) return;\n\n    const trimmedQuery = query.trim();\n    const currentPropQuery = (props.filter.searchQuery ?? \"\").trim();\n    if (trimmedQuery !== currentPropQuery) {\n      emit(\"search-change\", trimmedQuery);\n    }\n  },\n  { debounce: 300, maxWait: 1000 },\n);\n</script>\n\n<template>\n  <details class=\"pv-accordion\" data-testid=\"pv-filter-panel-accordion\" :open=\"filter.isOpen\" @toggle=\"handleToggle\">\n    <summary class=\"pv-flex pv-text-body-md\" style=\"--flex-align: center; --flex-gap: 0.5rem\">\n      <PvIcon aria-hidden=\"true\" class=\"pv-text-subdued\" :name=\"filter.isOpen ? 'chevron-down' : 'chevron-right'\" />\n      <span>{{ filter.label }}</span>\n      <PvCounterBadge v-if=\"counter\" :value=\"counter\" size=\"sm\" variant=\"secondary\" />\n      <span\n        v-if=\"isRefreshing\"\n        class=\"pv-filter-panel-refresh-status\"\n        data-testid=\"pv-filter-panel-refresh-status\"\n        role=\"status\"\n      >\n        <PvSpinner size=\"sm\" />\n        <span class=\"pv-visually-hidden\">{{ filter.loadingText || `Updating ${filter.label} options` }}</span>\n      </span>\n    </summary>\n\n    <div\n      ref=\"filterContent\"\n      class=\"pv-flex-vertical pv-inset-inline-24\"\n      :aria-busy=\"filter.isLoading || undefined\"\n      :style=\"{\n        '--flex-align': 'stretch',\n        minHeight: preservedContentHeight ? `${preservedContentHeight}px` : undefined,\n      }\"\n    >\n      <template v-if=\"isValueFilter\">\n        <div\n          v-if=\"filter.filterGroupOptions?.length || filter.filterHeaderRenderer\"\n          class=\"pv-flex-vertical\"\n          style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n        >\n          <div\n            v-if=\"filter.filterGroupOptions?.length\"\n            class=\"pv-flex-vertical\"\n            style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n            role=\"group\"\n            :aria-label=\"filter.filterGroupLabel\"\n          >\n            <p v-if=\"filter.filterGroupLabel\" class=\"pv-text-subdued pv-text-body-xxs\" data-testid=\"filter-group-label\">\n              {{ filter.filterGroupLabel }}\n            </p>\n            <div class=\"pv-flex\" style=\"--flex-gap: 0.5rem; --flex-wrap: wrap\">\n              <PvButton\n                v-for=\"groupOption in filter.filterGroupOptions\"\n                :key=\"groupOption.field\"\n                :disabled=\"isInteractionDisabled\"\n                :label=\"groupOption.label\"\n                size=\"md\"\n                :variant=\"groupOption.isActive ? 'primary' : 'secondary'\"\n                @click=\"handleGroupToggle(groupOption.field, groupOption.isActive)\"\n              />\n            </div>\n          </div>\n          <component v-if=\"filter.filterHeaderRenderer\" :is=\"filter.filterHeaderRenderer\" v-bind=\"rendererSlotProps\" />\n        </div>\n\n        <PvSearchInput\n          v-if=\"!filter.hideSearch\"\n          v-model=\"searchText\"\n          class=\"pv-full-width\"\n          :disabled=\"filter.disabled\"\n          :placeholder=\"filter.searchPlaceholder ?? 'Search'\"\n        />\n\n        <div v-if=\"pinnedOptions.length\" class=\"pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.5rem\">\n          <PvFilterPanelOptionRow\n            v-for=\"option in pinnedOptions\"\n            :key=\"option.value\"\n            :control=\"filter.singleSelect ? 'radio' : 'checkbox'\"\n            :disabled=\"isInteractionDisabled || option.isSelectable === false\"\n            :focus-action-disabled=\"isFocusActionDisabled(option)\"\n            :focus-action-label=\"getFocusActionLabel(option)\"\n            :focus-text=\"filter.focusText\"\n            :is-focused=\"isOptionFocused(option)\"\n            :indeterminate=\"isOptionIndeterminate(option)\"\n            :label=\"getOptionDisplayLabel(option)\"\n            :name=\"radioGroupName\"\n            :query-text=\"searchText\"\n            :renderer=\"filter.filterOptionsRenderer\"\n            :result-count=\"getOptionDisplayResultCount(option)\"\n            :selected=\"isOptionSelected(option)\"\n            :show-focus-action=\"filter.isFocusable\"\n            :sub-text=\"option.subText\"\n            :subdued-text=\"option.subduedText\"\n            :value=\"option.value\"\n            @focus-value=\"() => handleFocusValue(option)\"\n            @toggle-value=\"(_, checked) => handleToggleValue(option, checked)\"\n          />\n        </div>\n\n        <div v-if=\"filter.isLoading && !hasLoadedValueOptions\" class=\"pv-flex pv-text-body-xs pv-text-subdued\">\n          <PvSpinner size=\"sm\" />\n          <span v-if=\"filter.loadingText\">{{ filter.loadingText }}</span>\n        </div>\n        <template v-else>\n          <template\n            v-if=\"!normalizedSearchText && !filterOptions.length && !pinnedOptions.length && !showSeeMoreButton\"\n          >\n            <component\n              v-if=\"filter.emptyResultsRenderer\"\n              :is=\"filter.emptyResultsRenderer\"\n              v-bind=\"rendererSlotProps\"\n              empty-reason=\"no-values\"\n            />\n            <p v-else class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">No values available.</p>\n          </template>\n          <template v-else-if=\"!displayedOptions.length && !pinnedOptions.length && !showSeeMoreButton\">\n            <component\n              v-if=\"filter.emptyResultsRenderer\"\n              :is=\"filter.emptyResultsRenderer\"\n              v-bind=\"rendererSlotProps\"\n              empty-reason=\"no-matches\"\n            />\n            <p v-else class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">No matching values.</p>\n          </template>\n\n          <div\n            v-if=\"unpinnedOptions.length || showSeeMoreButton\"\n            class=\"pv-flex-vertical\"\n            style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n          >\n            <div\n              v-for=\"section in optionSections\"\n              :key=\"section.key\"\n              class=\"pv-flex-vertical\"\n              style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n              :data-testid=\"`filter-option-section-${section.key}`\"\n            >\n              <div\n                v-if=\"section.key === 'preferences'\"\n                class=\"pv-flex\"\n                style=\"--flex-justify: space-between; --flex-gap: 0.5rem\"\n                data-testid=\"filter-preferences-heading\"\n              >\n                <p class=\"pv-text-title-sm pv-text-subdued\" style=\"margin: 0\">Your Preferences</p>\n                <PvTooltipV2 v-if=\"filter.displayPreferencesIcon\" variant=\"dark\" size=\"sm\" :use-teleport=\"true\">\n                  <template #trigger>\n                    <PvButton\n                      ariaLabel=\"Open preferences\"\n                      :disabled=\"isInteractionDisabled\"\n                      rightIcon=\"sliders-horizontal\"\n                      size=\"md\"\n                      variant=\"ghost\"\n                      @click=\"handleSettingsClick\"\n                    />\n                  </template>\n                  <template #content>Open Preferences</template>\n                </PvTooltipV2>\n              </div>\n              <div v-else-if=\"section.key === 'options' && !filter.hideOptionsSortDescription\">\n                <PvTooltipV2\n                  v-if=\"filter.filterOptionsSortTooltip\"\n                  variant=\"dark\"\n                  :disableInteractive=\"true\"\n                  position=\"top-left\"\n                  size=\"sm\"\n                  :use-teleport=\"true\"\n                  style=\"--max-width: 200px\"\n                >\n                  <template #trigger>\n                    <p class=\"pv-text-title-sm pv-text-subdued suggested-title-label\" style=\"margin: 0\">\n                      {{ optionsSortLabel }}\n                    </p>\n                  </template>\n                  <template #content>\n                    {{ filter.filterOptionsSortTooltip }}\n                  </template>\n                </PvTooltipV2>\n                <p v-else class=\"pv-text-title-sm pv-text-subdued\" style=\"margin: 0\">{{ optionsSortLabel }}</p>\n              </div>\n              <template\n                v-for=\"item in section.rows\"\n                :key=\"item.kind === 'option' ? item.option.value : `${item.parent.value}-children-more`\"\n              >\n                <PvFilterPanelOptionRow\n                  v-if=\"item.kind === 'option'\"\n                  :control=\"filter.singleSelect ? 'radio' : 'checkbox'\"\n                  :depth=\"item.depth\"\n                  :disabled=\"isInteractionDisabled || item.option.isSelectable === false\"\n                  :focus-action-disabled=\"isFocusActionDisabled(item.option)\"\n                  :focus-action-label=\"getFocusActionLabel(item.option)\"\n                  :focus-text=\"filter.focusText\"\n                  :is-focused=\"isOptionFocused(item.option)\"\n                  :indeterminate=\"isOptionIndeterminate(item.option)\"\n                  :label=\"getOptionDisplayLabel(item.option)\"\n                  :name=\"radioGroupName\"\n                  :query-text=\"searchText\"\n                  :renderer=\"filter.filterOptionsRenderer\"\n                  :result-count=\"getOptionDisplayResultCount(item.option)\"\n                  :selected=\"isOptionSelected(item.option)\"\n                  :show-focus-action=\"filter.isFocusable\"\n                  :sub-text=\"item.option.subText\"\n                  :subdued-text=\"item.option.subduedText\"\n                  :value=\"item.option.value\"\n                  @focus-value=\"() => handleFocusValue(item.option)\"\n                  @toggle-value=\"(_, checked) => handleToggleValue(item.option, checked)\"\n                />\n                <PvButton\n                  v-else\n                  class=\"pv-text-brand\"\n                  :disabled=\"isInteractionDisabled || filter.isLoadingMore\"\n                  label=\"See more\"\n                  :style=\"{ marginLeft: `${item.depth * 1.25}rem`, width: 'fit-content' }\"\n                  variant=\"ghost\"\n                  @click=\"handleSeeMoreChildren(item.parent)\"\n                />\n              </template>\n            </div>\n            <PvButton\n              v-if=\"showSeeMoreButton\"\n              class=\"pv-text-brand\"\n              :disabled=\"isInteractionDisabled || filter.isLoadingMore\"\n              label=\"See more\"\n              style=\"width: fit-content\"\n              variant=\"ghost\"\n              @click=\"handleSeeMore\"\n            />\n          </div>\n          <component v-if=\"filter.filterFooterRenderer\" :is=\"filter.filterFooterRenderer\" v-bind=\"rendererSlotProps\" />\n        </template>\n      </template>\n\n      <PvRange\n        v-else-if=\"filterType === 'range' && filter.rangeMin !== null && filter.rangeMax !== null\"\n        mode=\"dual\"\n        :rangeValue=\"filter.rangeValue\"\n        :data-type=\"filter.dataType\"\n        :disabled=\"isInteractionDisabled\"\n        :input-icon=\"filter.rangeInputIcon\"\n        :label=\"filter.label\"\n        :max=\"filter.rangeMax\"\n        :min=\"filter.rangeMin\"\n        :scale=\"filter.rangeScale\"\n        :slider-step=\"filter.rangeSliderStep\"\n        :step=\"filter.rangeStep\"\n        :value-decimals=\"filter.valueDecimals\"\n        @update:rangeValue=\"emitRangeChange\"\n      />\n      <p v-else-if=\"filterType === 'range'\" class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">\n        Range filters require minimum and maximum bounds.\n      </p>\n      <div\n        v-else-if=\"filterType === 'boolean'\"\n        class=\"pv-flex-vertical\"\n        data-testid=\"pv-filter-panel-boolean-control\"\n        style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n      >\n        <div class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 0.5rem; --flex-wrap: wrap\">\n          <PvButton\n            v-for=\"choice in booleanChoices\"\n            :key=\"String(choice.value)\"\n            :disabled=\"isInteractionDisabled\"\n            :label=\"choice.label\"\n            :variant=\"filter.booleanValue === choice.value ? 'primary' : 'secondary'\"\n            @click=\"emitBooleanChange(filter.booleanValue === choice.value ? null : choice.value)\"\n          />\n        </div>\n        <PvButton\n          v-if=\"filter.booleanValue !== null && filter.booleanValue !== undefined\"\n          class=\"pv-text-brand\"\n          :disabled=\"isInteractionDisabled\"\n          label=\"Clear\"\n          variant=\"ghost\"\n          @click=\"emitBooleanChange(null)\"\n        />\n      </div>\n      <label\n        v-else-if=\"filterType === 'exists'\"\n        class=\"pv-flex\"\n        data-testid=\"pv-filter-panel-exists-control\"\n        style=\"--flex-align: center; --flex-gap: 0.5rem; cursor: pointer\"\n      >\n        <PvCheckbox\n          :disabled=\"isInteractionDisabled\"\n          :modelValue=\"filter.existsValue ?? false\"\n          @update:modelValue=\"emitExistsChange\"\n        />\n        <span class=\"pv-text-body-sm\">{{ existsLabel }}</span>\n      </label>\n    </div>\n  </details>\n</template>\n\n<style scoped>\nsummary {\n  background-image: none;\n  padding-right: 2px;\n}\n\n.suggested-title-label {\n  text-decoration: underline;\n  text-decoration-style: dotted;\n  text-underline-offset: 2px;\n}\n\n.pv-filter-panel-refresh-status {\n  display: inline-flex;\n  margin-left: auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, useId, watch, watchEffect } from \"vue\";\nimport { watchDebounced } from \"@vueuse/core\";\nimport type { MenuOption } from \"@/types\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvCounterBadge from \"@/components/base/PvCounterBadge/PvCounterBadge.vue\";\nimport PvCheckbox from \"@/components/base/PvCheckbox/PvCheckbox.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport PvRange from \"@/components/base/PvRange/PvRange.vue\";\nimport type { PvRangeValue } from \"@/components/base/PvRange/types\";\nimport PvFilterPanelOptionRow from \"./PvFilterPanelOptionRow.vue\";\nimport { getFilterOptionLabel, getFilterOptionResultCount } from \"./filterOptionDisplay\";\nimport {\n  createFilterPanelAggregateSelectionStatusMap,\n  getFilterPanelAggregateSelectionCount,\n  updateFilterPanelAggregateSelectionState,\n} from \"./aggregateFilterModel\";\nimport {\n  flattenFilterPanelOptions,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n} from \"./filterOptionValue\";\nimport type {\n  PvFilterPanelAccordionProps,\n  PvFilterPanelControlChange,\n  PvFilterPanelFilterType,\n  PvFilterPanelOption,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelAccordionProps>(), {\n  disableWhileLoading: true,\n});\n\nconst emit = defineEmits<{\n  \"focus-change\": [field: string, value: string, option: PvFilterPanelOption];\n  \"handle-settings-icon\": [field: string, colDef: PvFilterPanelAccordionProps[\"filter\"][\"colDef\"]];\n  \"load-more\": [query: string, parentId?: string];\n  \"open-change\": [open: boolean];\n  \"filter-change\": [change: PvFilterPanelControlChange];\n  \"search-change\": [query: string];\n}>();\n\nconst UNPINNED_PAGE_SIZE = 5;\nconst KNOWN_OPTION_MAP_MAX_SIZE = 500;\n\ninterface DisplayedFilterOptionRow {\n  depth: number;\n  /** Whether the row's top-level option is a preference, so children stay in its section after search or pinning. */\n  inPreferences: boolean;\n  kind: \"option\";\n  option: PvFilterPanelOption;\n}\n\ninterface DisplayedFilterChildLoadMoreRow {\n  depth: number;\n  inPreferences: boolean;\n  kind: \"child-load-more\";\n  parent: PvFilterPanelOption;\n}\n\ntype DisplayedFilterOption = DisplayedFilterOptionRow | DisplayedFilterChildLoadMoreRow;\n\nconst filterContent = ref<HTMLElement | null>(null);\nconst knownOptionMap = ref<Record<string, PvFilterPanelOption>>({});\nconst preservedContentHeight = ref(0);\nconst radioGroupName = useId();\n// Seeded once: the input owns its text after mount. Syncing from `searchQuery` would echo the trimmed\n// emitted query back into the input and drop a just-typed trailing space.\nconst searchText = ref(props.filter.searchQuery ?? \"\");\nconst visibleUnpinnedCount = ref(UNPINNED_PAGE_SIZE);\n\nconst existsLabel = computed(() => props.filter.existsLabel ?? `Has ${props.filter.label}`);\nconst falseLabel = computed(() => props.filter.valueLabels?.[\"false\"] ?? \"No\");\nconst filterOptions = computed(() => props.filter.options ?? []);\nconst focusText = computed(() => props.filter.focusText ?? \"Focus\");\nconst knownOptions = computed(() => [...(props.filter.knownOptions ?? []), ...filterOptions.value]);\nconst filterType = computed<PvFilterPanelFilterType>(() => props.filter.type ?? \"value\");\nconst isValueFilter = computed(() => filterType.value === \"value\");\nconst isAggregateFilter = computed(() => isValueFilter.value && props.filter.isAggregate === true);\nconst aggregateSelectionState = computed(() => props.filter.aggregateSelectionState ?? []);\nconst normalizedSearchText = computed(() => searchText.value.trim().toLowerCase());\nconst selectedValues = computed(() => props.filter.selectedValues ?? []);\nconst selectedValueSet = computed(() => new Set(selectedValues.value));\nconst currentOptionMap = computed(() =>\n  Object.fromEntries(flattenFilterPanelOptions(knownOptions.value).map((option) => [option.value, option])),\n);\nconst getKnownOption = (value: string) => {\n  if (!isAggregateFilter.value && props.filter.colDef.context?.metadataDisplayFields?.length) {\n    return currentOptionMap.value[value] ?? knownOptionMap.value[value];\n  }\n  return knownOptionMap.value[value];\n};\nconst trueLabel = computed(() => props.filter.valueLabels?.[\"true\"] ?? \"Yes\");\nconst optionsSortLabel = computed(() => props.filter.filterOptionsSortDescription || \"Suggested\");\nconst isInteractionDisabled = computed(\n  () => props.filter.disabled === true || (props.disableWhileLoading && props.filter.isLoading === true),\n);\n\n// A value labels map that declares only one boolean key means that column is only meaningful in\n// that direction, so we render just that button. Anything else keeps the full true/false pair.\nconst booleanChoices = computed<{ label: string; value: boolean }[]>(() => {\n  const valueLabels = props.filter.valueLabels;\n  const hasTrue = typeof valueLabels?.[\"true\"] === \"string\";\n  const hasFalse = typeof valueLabels?.[\"false\"] === \"string\";\n  if (hasTrue && !hasFalse) return [{ label: trueLabel.value, value: true }];\n  if (hasFalse && !hasTrue) return [{ label: falseLabel.value, value: false }];\n\n  return [\n    { label: trueLabel.value, value: true },\n    { label: falseLabel.value, value: false },\n  ];\n});\n\nconst getSearchableOptionText = (option: PvFilterPanelOption) => {\n  const metadataValues =\n    typeof option.metadata === \"object\" && option.metadata !== null ? Object.values(option.metadata) : [];\n  return [option.value, option.label, option.subText, option.subduedText, option.matchedValue, option.matchedField]\n    .concat(metadataValues.flatMap((value) => (value === null || value === undefined ? [] : [String(value)])))\n    .filter((value): value is string => Boolean(value))\n    .join(\" \")\n    .toLowerCase();\n};\n\nconst counter = computed(() => {\n  if (filterType.value === \"range\") {\n    return props.filter.rangeValue?.min !== null && props.filter.rangeValue?.min !== undefined\n      ? 1\n      : props.filter.rangeValue?.max !== null && props.filter.rangeValue?.max !== undefined\n        ? 1\n        : undefined;\n  }\n\n  if (filterType.value === \"boolean\") {\n    return props.filter.booleanValue !== null && props.filter.booleanValue !== undefined ? 1 : undefined;\n  }\n\n  if (filterType.value === \"exists\") return props.filter.existsValue ? 1 : undefined;\n  if (isAggregateFilter.value) return getFilterPanelAggregateSelectionCount(aggregateSelectionState.value) || undefined;\n  return selectedValues.value.length || undefined;\n});\n\nconst optionHasMoreChildren = (option: PvFilterPanelOption) => {\n  if (option.totalChildCount === null || option.totalChildCount === undefined) return false;\n  return option.totalChildCount > (option.children?.length ?? 0);\n};\n\nconst flattenOptions = (\n  options: PvFilterPanelOption[],\n  depth = 0,\n  parentInPreferences?: boolean,\n): DisplayedFilterOption[] => {\n  return options.flatMap((option) => {\n    const inPreferences = parentInPreferences ?? option.isPreference === true;\n    return [\n      { depth, inPreferences, kind: \"option\", option } as DisplayedFilterOptionRow,\n      ...(option.children?.length ? flattenOptions(option.children, depth + 1, inPreferences) : []),\n      ...(optionHasMoreChildren(option)\n        ? ([\n            { depth: depth + 1, inPreferences, kind: \"child-load-more\", parent: option },\n          ] as DisplayedFilterChildLoadMoreRow[])\n        : []),\n    ];\n  });\n};\n\nconst displayedOptions = computed<DisplayedFilterOption[]>(() => {\n  const flattenedOptions = flattenOptions(filterOptions.value);\n  const query = normalizedSearchText.value;\n  if (props.filter.clientFiltering === false || !query) return flattenedOptions;\n  return flattenedOptions.filter(\n    (item): item is DisplayedFilterOptionRow =>\n      item.kind === \"option\" && getSearchableOptionText(item.option).includes(query),\n  );\n});\n\nconst selectedOptions = computed(() =>\n  isAggregateFilter.value || props.filter.singleSelect\n    ? []\n    : selectedValues.value.map((value) => getKnownOption(value) ?? { label: value, value }),\n);\n\n// Selections are hoisted into the pinned block only when the section is (re-)displayed. Toggling a\n// checkbox inside an already-open section leaves the row exactly where it is, so nothing jumps out\n// from under the cursor; the next time the section is displayed the pinned set is re-snapshotted and\n// the selections come back to the top.\nconst pinnedValues = ref<string[]>([]);\nconst pinnedValueSet = computed(() => new Set(pinnedValues.value));\nconst pinnedOptions = computed(() =>\n  pinnedValues.value.map((value) => getKnownOption(value) ?? { label: value, value }),\n);\nconst hasLoadedValueOptions = computed(() => filterOptions.value.length > 0 || pinnedOptions.value.length > 0);\nconst isRefreshing = computed(\n  () => isValueFilter.value && props.filter.isOpen && props.filter.isLoading === true && hasLoadedValueOptions.value,\n);\n\nconst repinSelectedValues = () => {\n  pinnedValues.value = isAggregateFilter.value || props.filter.singleSelect ? [] : [...selectedValues.value];\n};\n\nrepinSelectedValues();\n\nconst unpinnedOptions = computed(() =>\n  isAggregateFilter.value || props.filter.singleSelect\n    ? displayedOptions.value\n    : displayedOptions.value.filter(\n        (item) => item.kind === \"child-load-more\" || !pinnedValueSet.value.has(item.option.value),\n      ),\n);\nconst hasMoreLocalUnpinned = computed(() => unpinnedOptions.value.length > visibleUnpinnedCount.value);\nconst showSeeMoreButton = computed(() => hasMoreLocalUnpinned.value || props.filter.hasMore);\nconst visibleUnpinnedOptions = computed(() => unpinnedOptions.value.slice(0, visibleUnpinnedCount.value));\n// Preference options (and their children) get their own section, like the table set filter's\n// \"Your Preferences\" group.\nconst optionSections = computed(() => {\n  const preferenceRows = visibleUnpinnedOptions.value.filter((item) => item.inPreferences);\n  const otherRows = visibleUnpinnedOptions.value.filter((item) => !item.inPreferences);\n  return [\n    { key: \"preferences\", rows: preferenceRows },\n    { key: \"options\", rows: otherRows },\n  ].filter((section) => section.rows.length);\n});\n\nconst aggregateSelectionStatusMap = computed(() =>\n  isAggregateFilter.value\n    ? createFilterPanelAggregateSelectionStatusMap({\n        options: knownOptions.value,\n        state: aggregateSelectionState.value,\n      })\n    : new Map<string, { indeterminate: boolean; selected: boolean }>(),\n);\n\nconst getOptionDisplayLabel = (option: PvFilterPanelOption) => getFilterOptionLabel(option, props.filter.colDef);\nconst getOptionDisplayResultCount = (option: PvFilterPanelOption) => getFilterOptionResultCount(option);\nconst getOptionSelectionStatus = (option: PvFilterPanelOption) => {\n  if (!isAggregateFilter.value) return { indeterminate: false, selected: selectedValueSet.value.has(option.value) };\n  return aggregateSelectionStatusMap.value.get(option.value) ?? { indeterminate: false, selected: false };\n};\nconst isOptionSelected = (option: PvFilterPanelOption) => getOptionSelectionStatus(option).selected;\nconst isOptionIndeterminate = (option: PvFilterPanelOption) => getOptionSelectionStatus(option).indeterminate;\n\nconst getOptionFilterValue = (option: PvFilterPanelOption) => getFilterPanelOptionRawValue(option) ?? option.value;\nconst getOptionFilterField = (option: PvFilterPanelOption) => getFilterPanelOptionField(option, props.filter.key);\n\nconst isOptionFocused = (option: PvFilterPanelOption) => {\n  const field = getOptionFilterField(option);\n  const rawValue = getOptionFilterValue(option);\n  return (\n    props.filter.focusedValuesByField?.[field]?.includes(rawValue) ||\n    (field === props.filter.key && props.filter.focusedValues?.includes(option.value)) ||\n    false\n  );\n};\n\nconst isOptionFocusable = (option: PvFilterPanelOption) => {\n  const fields = props.filter.focusableFields ?? [];\n  return !fields.length || fields.includes(getOptionFilterField(option));\n};\n\nconst isFocusActionDisabled = (option: PvFilterPanelOption) => {\n  return !isOptionFocusable(option) || (isOptionFocused(option) && props.filter.canRemoveFocus === false);\n};\n\nconst getFocusActionLabel = (option: PvFilterPanelOption) => {\n  const field = getOptionFilterField(option);\n  if (!isOptionFocusable(option)) {\n    return `Group by ${props.filter.focusFieldLabels?.[field] ?? field} to enable ${focusText.value}`;\n  }\n  if (isOptionFocused(option) && props.filter.canRemoveFocus === false) return `${focusText.value} (required)`;\n  return isOptionFocused(option) ? `Remove ${focusText.value}` : `Select as ${focusText.value}`;\n};\n\nconst toMenuOption = (option: PvFilterPanelOption): MenuOption<PvFilterPanelOption> => ({\n  ...(option.menuOption ?? {}),\n  children: option.children?.map(toMenuOption),\n  context: option,\n  disabled: isInteractionDisabled.value || option.isSelectable === false || option.menuOption?.disabled,\n  id: option.value,\n  searchText: getSearchableOptionText(option),\n  secondaryText: getOptionDisplayResultCount(option),\n  subText: option.subText,\n  subduedText: option.subduedText,\n  text: getOptionDisplayLabel(option),\n  totalChildCount: option.totalChildCount,\n});\n\nconst rendererOptions = computed(() => filterOptions.value.map(toMenuOption));\nconst rendererSelectedItems = computed(() => selectedOptions.value.map(toMenuOption));\nconst rendererSlotProps = computed(() => ({\n  colDef: props.filter.colDef,\n  disabled: isInteractionDisabled.value,\n  filter: props.filter,\n  isLoading: props.filter.isLoading,\n  isOpen: props.filter.isOpen,\n  options: rendererOptions.value,\n  searchInput: searchText.value,\n  selectedItems: rendererSelectedItems.value,\n  slotContext: {\n    colDef: props.filter.colDef,\n    rowsLoading: props.filter.isLoading,\n  },\n}));\n\nconst handleSeeMore = () => {\n  if (isInteractionDisabled.value) return;\n\n  if (hasMoreLocalUnpinned.value) {\n    visibleUnpinnedCount.value += UNPINNED_PAGE_SIZE;\n  } else if (props.filter.hasMore) {\n    emit(\"load-more\", searchText.value.trim());\n  }\n};\n\nconst handleSeeMoreChildren = (parent: PvFilterPanelOption) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"load-more\", searchText.value.trim(), parent.value);\n};\n\nconst handleToggle = (event: Event) => {\n  const detailsElement = event.target as HTMLDetailsElement;\n  emit(\"open-change\", detailsElement.open);\n};\n\nconst emitBooleanChange = (value: boolean | null) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"boolean\", value });\n};\n\nconst emitExistsChange = (value: boolean | undefined) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"exists\", value: value === true });\n};\n\nconst emitRangeChange = (value: PvRangeValue) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { type: \"range\", value });\n};\n\nconst handleToggleValue = (option: PvFilterPanelOption, checked: boolean) => {\n  if (isInteractionDisabled.value) return;\n\n  if (isAggregateFilter.value) {\n    emit(\"filter-change\", {\n      type: \"aggregate-selection\",\n      value: updateFilterPanelAggregateSelectionState({\n        checked,\n        option,\n        options: knownOptions.value,\n        state: aggregateSelectionState.value,\n      }),\n    });\n    return;\n  }\n\n  emit(\"filter-change\", {\n    checked,\n    field: getOptionFilterField(option),\n    type: \"value\",\n    value: getOptionFilterValue(option),\n  });\n};\n\nconst handleFocusValue = (option: PvFilterPanelOption) => {\n  if (isInteractionDisabled.value || isFocusActionDisabled(option)) return;\n  emit(\"focus-change\", getOptionFilterField(option), getOptionFilterValue(option), option);\n};\n\nconst handleGroupToggle = (field: string, isActive: boolean) => {\n  if (isInteractionDisabled.value) return;\n  emit(\"filter-change\", { field, type: \"boolean\", value: isActive ? null : true });\n};\n\nconst handleSettingsClick = () => {\n  if (isInteractionDisabled.value) return;\n  emit(\"handle-settings-icon\", props.filter.key, props.filter.colDef);\n};\n\nwatch([searchText, () => props.filter.key], () => {\n  visibleUnpinnedCount.value = UNPINNED_PAGE_SIZE;\n});\n\nconst syncKnownOptionMap = () => {\n  const flattenedOptions = flattenFilterPanelOptions(knownOptions.value);\n  const nextOptionMap = { ...knownOptionMap.value };\n  const entries = new Map(Object.entries(nextOptionMap));\n  for (const option of flattenedOptions) {\n    entries.delete(option.value);\n    entries.set(option.value, option);\n  }\n\n  knownOptionMap.value = Object.fromEntries(\n    [...entries.entries()].slice(Math.max(0, entries.size - KNOWN_OPTION_MAP_MAX_SIZE)),\n  );\n};\n\nwatch(\n  knownOptions,\n  () => {\n    if (props.filter.isOpen) syncKnownOptionMap();\n  },\n  { immediate: true },\n);\n\n// Hold the section at its pre-refresh height while options load so it does not collapse and jump\n// mid-search, then release it once loading finishes so the section fits the options that came back.\n// These watchers run before the DOM updates, so offsetHeight is still the height of the old rows.\nconst holdContentHeight = () => {\n  if (!props.filter.isOpen || !filterContent.value) return;\n  preservedContentHeight.value = Math.max(preservedContentHeight.value, filterContent.value.offsetHeight);\n};\n\nwatch(\n  () => props.filter.isLoading === true,\n  (isLoading) => {\n    if (isLoading) holdContentHeight();\n    else preservedContentHeight.value = 0;\n  },\n);\n\nwatch(filterOptions, () => {\n  if (props.filter.isLoading) holdContentHeight();\n});\n\nwatch(\n  () => props.filter.isOpen,\n  (isOpen) => {\n    if (isOpen) {\n      syncKnownOptionMap();\n      repinSelectedValues();\n    } else {\n      knownOptionMap.value = {};\n      preservedContentHeight.value = 0;\n    }\n  },\n);\n\n// A selection can drop out of the rendered rows without the section being re-displayed: the search\n// query stops matching it, or the consumer reloads options and returns a page that no longer\n// contains it. Those rows still have to be reachable so they can be unchecked, so they get pinned\n// rather than disappearing. Pinning only ever shortens the unpinned list, so this settles at once.\nwatchEffect(() => {\n  if (!props.filter.isOpen || isAggregateFilter.value || props.filter.singleSelect) return;\n\n  const renderedValues = new Set(\n    visibleUnpinnedOptions.value.flatMap((item) => (item.kind === \"option\" ? [item.option.value] : [])),\n  );\n  const stranded = selectedValues.value.filter(\n    (value) => !pinnedValueSet.value.has(value) && !renderedValues.has(value),\n  );\n  if (stranded.length) pinnedValues.value = [...pinnedValues.value, ...stranded];\n});\n\nwatchDebounced(\n  searchText,\n  (query) => {\n    if (!isValueFilter.value || props.filter.disabled === true) return;\n\n    const trimmedQuery = query.trim();\n    const currentPropQuery = (props.filter.searchQuery ?? \"\").trim();\n    if (trimmedQuery !== currentPropQuery) {\n      emit(\"search-change\", trimmedQuery);\n    }\n  },\n  { debounce: 300, maxWait: 1000 },\n);\n</script>\n\n<template>\n  <details class=\"pv-accordion\" data-testid=\"pv-filter-panel-accordion\" :open=\"filter.isOpen\" @toggle=\"handleToggle\">\n    <summary class=\"pv-flex pv-text-body-md\" style=\"--flex-align: center; --flex-gap: 0.5rem\">\n      <PvIcon aria-hidden=\"true\" class=\"pv-text-subdued\" :name=\"filter.isOpen ? 'chevron-down' : 'chevron-right'\" />\n      <span>{{ filter.label }}</span>\n      <PvCounterBadge v-if=\"counter\" :value=\"counter\" size=\"sm\" variant=\"secondary\" />\n      <span\n        v-if=\"isRefreshing\"\n        class=\"pv-filter-panel-refresh-status\"\n        data-testid=\"pv-filter-panel-refresh-status\"\n        role=\"status\"\n      >\n        <PvSpinner size=\"sm\" />\n        <span class=\"pv-visually-hidden\">{{ filter.loadingText || `Updating ${filter.label} options` }}</span>\n      </span>\n    </summary>\n\n    <div\n      ref=\"filterContent\"\n      class=\"pv-flex-vertical pv-inset-inline-24\"\n      :aria-busy=\"filter.isLoading || undefined\"\n      :style=\"{\n        '--flex-align': 'stretch',\n        minHeight: preservedContentHeight ? `${preservedContentHeight}px` : undefined,\n      }\"\n    >\n      <template v-if=\"isValueFilter\">\n        <div\n          v-if=\"filter.filterGroupOptions?.length || filter.filterHeaderRenderer\"\n          class=\"pv-flex-vertical\"\n          style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n        >\n          <div\n            v-if=\"filter.filterGroupOptions?.length\"\n            class=\"pv-flex-vertical\"\n            style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n            role=\"group\"\n            :aria-label=\"filter.filterGroupLabel\"\n          >\n            <p v-if=\"filter.filterGroupLabel\" class=\"pv-text-subdued pv-text-body-xxs\" data-testid=\"filter-group-label\">\n              {{ filter.filterGroupLabel }}\n            </p>\n            <div class=\"pv-flex\" style=\"--flex-gap: 0.5rem; --flex-wrap: wrap\">\n              <PvButton\n                v-for=\"groupOption in filter.filterGroupOptions\"\n                :key=\"groupOption.field\"\n                :disabled=\"isInteractionDisabled\"\n                :label=\"groupOption.label\"\n                size=\"md\"\n                :variant=\"groupOption.isActive ? 'primary' : 'secondary'\"\n                @click=\"handleGroupToggle(groupOption.field, groupOption.isActive)\"\n              />\n            </div>\n          </div>\n          <component v-if=\"filter.filterHeaderRenderer\" :is=\"filter.filterHeaderRenderer\" v-bind=\"rendererSlotProps\" />\n        </div>\n\n        <PvSearchInput\n          v-if=\"!filter.hideSearch\"\n          v-model=\"searchText\"\n          class=\"pv-full-width\"\n          :disabled=\"filter.disabled\"\n          :placeholder=\"filter.searchPlaceholder ?? 'Search'\"\n        />\n\n        <div v-if=\"pinnedOptions.length\" class=\"pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.5rem\">\n          <PvFilterPanelOptionRow\n            v-for=\"option in pinnedOptions\"\n            :key=\"option.value\"\n            :control=\"filter.singleSelect ? 'radio' : 'checkbox'\"\n            :disabled=\"isInteractionDisabled || option.isSelectable === false\"\n            :focus-action-disabled=\"isFocusActionDisabled(option)\"\n            :focus-action-label=\"getFocusActionLabel(option)\"\n            :focus-text=\"filter.focusText\"\n            :is-focused=\"isOptionFocused(option)\"\n            :indeterminate=\"isOptionIndeterminate(option)\"\n            :label=\"getOptionDisplayLabel(option)\"\n            :name=\"radioGroupName\"\n            :query-text=\"searchText\"\n            :renderer=\"filter.filterOptionsRenderer\"\n            :result-count=\"getOptionDisplayResultCount(option)\"\n            :selected=\"isOptionSelected(option)\"\n            :show-focus-action=\"filter.isFocusable\"\n            :sub-text=\"option.subText\"\n            :subdued-text=\"option.subduedText\"\n            :value=\"option.value\"\n            @focus-value=\"() => handleFocusValue(option)\"\n            @toggle-value=\"(_, checked) => handleToggleValue(option, checked)\"\n          />\n        </div>\n\n        <div v-if=\"filter.isLoading && !hasLoadedValueOptions\" class=\"pv-flex pv-text-body-xs pv-text-subdued\">\n          <PvSpinner size=\"sm\" />\n          <span v-if=\"filter.loadingText\">{{ filter.loadingText }}</span>\n        </div>\n        <template v-else>\n          <template\n            v-if=\"!normalizedSearchText && !filterOptions.length && !pinnedOptions.length && !showSeeMoreButton\"\n          >\n            <component\n              v-if=\"filter.emptyResultsRenderer\"\n              :is=\"filter.emptyResultsRenderer\"\n              v-bind=\"rendererSlotProps\"\n              empty-reason=\"no-values\"\n            />\n            <p v-else class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">No values available.</p>\n          </template>\n          <template v-else-if=\"!displayedOptions.length && !pinnedOptions.length && !showSeeMoreButton\">\n            <component\n              v-if=\"filter.emptyResultsRenderer\"\n              :is=\"filter.emptyResultsRenderer\"\n              v-bind=\"rendererSlotProps\"\n              empty-reason=\"no-matches\"\n            />\n            <p v-else class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">No matching values.</p>\n          </template>\n\n          <div\n            v-if=\"unpinnedOptions.length || showSeeMoreButton\"\n            class=\"pv-flex-vertical\"\n            style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n          >\n            <div\n              v-for=\"section in optionSections\"\n              :key=\"section.key\"\n              class=\"pv-flex-vertical\"\n              style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n              :data-testid=\"`filter-option-section-${section.key}`\"\n            >\n              <div\n                v-if=\"section.key === 'preferences'\"\n                class=\"pv-flex\"\n                style=\"--flex-justify: space-between; --flex-gap: 0.5rem\"\n                data-testid=\"filter-preferences-heading\"\n              >\n                <p class=\"pv-text-title-sm pv-text-subdued\" style=\"margin: 0\">Your Preferences</p>\n                <PvTooltipV2 v-if=\"filter.displayPreferencesIcon\" variant=\"dark\" size=\"sm\" :use-teleport=\"true\">\n                  <template #trigger>\n                    <PvButton\n                      ariaLabel=\"Open preferences\"\n                      :disabled=\"isInteractionDisabled\"\n                      rightIcon=\"sliders-horizontal\"\n                      size=\"md\"\n                      variant=\"ghost\"\n                      @click=\"handleSettingsClick\"\n                    />\n                  </template>\n                  <template #content>Open Preferences</template>\n                </PvTooltipV2>\n              </div>\n              <div v-else-if=\"section.key === 'options' && !filter.hideOptionsSortDescription\">\n                <PvTooltipV2\n                  v-if=\"filter.filterOptionsSortTooltip\"\n                  variant=\"dark\"\n                  :disableInteractive=\"true\"\n                  position=\"top-left\"\n                  size=\"sm\"\n                  :use-teleport=\"true\"\n                  style=\"--max-width: 200px\"\n                >\n                  <template #trigger>\n                    <p class=\"pv-text-title-sm pv-text-subdued suggested-title-label\" style=\"margin: 0\">\n                      {{ optionsSortLabel }}\n                    </p>\n                  </template>\n                  <template #content>\n                    {{ filter.filterOptionsSortTooltip }}\n                  </template>\n                </PvTooltipV2>\n                <p v-else class=\"pv-text-title-sm pv-text-subdued\" style=\"margin: 0\">{{ optionsSortLabel }}</p>\n              </div>\n              <template\n                v-for=\"item in section.rows\"\n                :key=\"item.kind === 'option' ? item.option.value : `${item.parent.value}-children-more`\"\n              >\n                <PvFilterPanelOptionRow\n                  v-if=\"item.kind === 'option'\"\n                  :control=\"filter.singleSelect ? 'radio' : 'checkbox'\"\n                  :depth=\"item.depth\"\n                  :disabled=\"isInteractionDisabled || item.option.isSelectable === false\"\n                  :focus-action-disabled=\"isFocusActionDisabled(item.option)\"\n                  :focus-action-label=\"getFocusActionLabel(item.option)\"\n                  :focus-text=\"filter.focusText\"\n                  :is-focused=\"isOptionFocused(item.option)\"\n                  :indeterminate=\"isOptionIndeterminate(item.option)\"\n                  :label=\"getOptionDisplayLabel(item.option)\"\n                  :name=\"radioGroupName\"\n                  :query-text=\"searchText\"\n                  :renderer=\"filter.filterOptionsRenderer\"\n                  :result-count=\"getOptionDisplayResultCount(item.option)\"\n                  :selected=\"isOptionSelected(item.option)\"\n                  :show-focus-action=\"filter.isFocusable\"\n                  :sub-text=\"item.option.subText\"\n                  :subdued-text=\"item.option.subduedText\"\n                  :value=\"item.option.value\"\n                  @focus-value=\"() => handleFocusValue(item.option)\"\n                  @toggle-value=\"(_, checked) => handleToggleValue(item.option, checked)\"\n                />\n                <PvButton\n                  v-else\n                  class=\"pv-text-brand\"\n                  :disabled=\"isInteractionDisabled || filter.isLoadingMore\"\n                  label=\"See more\"\n                  :style=\"{ marginLeft: `${item.depth * 1.25}rem`, width: 'fit-content' }\"\n                  variant=\"ghost\"\n                  @click=\"handleSeeMoreChildren(item.parent)\"\n                />\n              </template>\n            </div>\n            <PvButton\n              v-if=\"showSeeMoreButton\"\n              class=\"pv-text-brand\"\n              :disabled=\"isInteractionDisabled || filter.isLoadingMore\"\n              label=\"See more\"\n              style=\"width: fit-content\"\n              variant=\"ghost\"\n              @click=\"handleSeeMore\"\n            />\n          </div>\n          <component v-if=\"filter.filterFooterRenderer\" :is=\"filter.filterFooterRenderer\" v-bind=\"rendererSlotProps\" />\n        </template>\n      </template>\n\n      <PvRange\n        v-else-if=\"filterType === 'range' && filter.rangeMin !== null && filter.rangeMax !== null\"\n        mode=\"dual\"\n        :rangeValue=\"filter.rangeValue\"\n        :data-type=\"filter.dataType\"\n        :disabled=\"isInteractionDisabled\"\n        :input-icon=\"filter.rangeInputIcon\"\n        :label=\"filter.label\"\n        :max=\"filter.rangeMax\"\n        :min=\"filter.rangeMin\"\n        :scale=\"filter.rangeScale\"\n        :slider-step=\"filter.rangeSliderStep\"\n        :step=\"filter.rangeStep\"\n        :value-decimals=\"filter.valueDecimals\"\n        @update:rangeValue=\"emitRangeChange\"\n      />\n      <p v-else-if=\"filterType === 'range'\" class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">\n        Range filters require minimum and maximum bounds.\n      </p>\n      <div\n        v-else-if=\"filterType === 'boolean'\"\n        class=\"pv-flex-vertical\"\n        data-testid=\"pv-filter-panel-boolean-control\"\n        style=\"--flex-align: stretch; --flex-gap: 0.5rem\"\n      >\n        <div class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 0.5rem; --flex-wrap: wrap\">\n          <PvButton\n            v-for=\"choice in booleanChoices\"\n            :key=\"String(choice.value)\"\n            :disabled=\"isInteractionDisabled\"\n            :label=\"choice.label\"\n            :variant=\"filter.booleanValue === choice.value ? 'primary' : 'secondary'\"\n            @click=\"emitBooleanChange(filter.booleanValue === choice.value ? null : choice.value)\"\n          />\n        </div>\n        <PvButton\n          v-if=\"filter.booleanValue !== null && filter.booleanValue !== undefined\"\n          class=\"pv-text-brand\"\n          :disabled=\"isInteractionDisabled\"\n          label=\"Clear\"\n          variant=\"ghost\"\n          @click=\"emitBooleanChange(null)\"\n        />\n      </div>\n      <label\n        v-else-if=\"filterType === 'exists'\"\n        class=\"pv-flex\"\n        data-testid=\"pv-filter-panel-exists-control\"\n        style=\"--flex-align: center; --flex-gap: 0.5rem; cursor: pointer\"\n      >\n        <PvCheckbox\n          :disabled=\"isInteractionDisabled\"\n          :modelValue=\"filter.existsValue ?? false\"\n          @update:modelValue=\"emitExistsChange\"\n        />\n        <span class=\"pv-text-body-sm\">{{ existsLabel }}</span>\n      </label>\n    </div>\n  </details>\n</template>\n\n<style scoped>\nsummary {\n  background-image: none;\n  padding-right: 2px;\n}\n\n.suggested-title-label {\n  text-decoration: underline;\n  text-decoration-style: dotted;\n  text-underline-offset: 2px;\n}\n\n.pv-filter-panel-refresh-status {\n  display: inline-flex;\n  margin-left: auto;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport PvTag from \"@/components/base/PvTag/PvTag.vue\";\nimport type {\n  PvFilterPanelAppliedFiltersSectionProps,\n  PvFilterPanelAppliedValue,\n  PvFilterPanelExternalFilterGroup,\n  PvFilterPanelFilterType,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelAppliedFiltersSectionProps>(), {\n  appliedCount: 0,\n  appliedGroups: () => [],\n  externalFilters: () => [],\n  readOnly: false,\n});\n\nconst emit = defineEmits<{\n  \"remove-filter\": [filterKey: string, value: string, type?: PvFilterPanelFilterType];\n  \"remove-external-filter\": [key: string, value: string];\n}>();\n\n// External groups with no values are dropped here rather than by the owner, so a search bar can pass\n// a single group whose values empty out as the query is cleared.\nconst visibleExternalFilters = computed(() => props.externalFilters.filter((group) => group.values.length > 0));\nconst hasAnyFilters = computed(() => props.appliedCount > 0 || visibleExternalFilters.value.length > 0);\nconst isExternalRemovable = (group: PvFilterPanelExternalFilterGroup) => !props.readOnly && group.removable !== false;\n\nconst handleRemoveFilter = (filterKey: string, item: PvFilterPanelAppliedValue) => {\n  emit(\"remove-filter\", item.field ?? filterKey, item.value, item.type);\n};\n</script>\n\n<template>\n  <section\n    class=\"pv-flex-vertical pv-inset-square-8\"\n    data-testid=\"pv-filter-panel-applied-section\"\n    style=\"--flex-align: stretch; --flex-gap: 1rem\"\n  >\n    <div v-if=\"hasAnyFilters\" class=\"pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 1rem\">\n      <div\n        v-for=\"group in visibleExternalFilters\"\n        :key=\"`external-${group.key}`\"\n        class=\"pv-flex-vertical pv-border-bottom\"\n        data-testid=\"pv-filter-panel-external-filter-group\"\n        style=\"--flex-align: stretch; --flex-gap: 12px; padding-bottom: 12px\"\n      >\n        <span class=\"pv-text-title-md\">{{ group.label }}</span>\n        <div class=\"pv-flex\" style=\"--flex-gap: 0.375rem; --flex-wrap: wrap\">\n          <PvTag\n            v-for=\"item in group.values\"\n            :key=\"`${group.key}-${item.value}`\"\n            :label=\"item.label\"\n            :showClear=\"isExternalRemovable(group)\"\n            @handle-close=\"emit('remove-external-filter', group.key, item.value)\"\n          />\n        </div>\n      </div>\n      <div\n        v-for=\"group in appliedGroups\"\n        :key=\"group.key\"\n        class=\"pv-flex-vertical pv-border-bottom\"\n        style=\"--flex-align: stretch; --flex-gap: 12px; padding-bottom: 12px\"\n      >\n        <span class=\"pv-text-title-md\">{{ group.label }}</span>\n        <div class=\"pv-flex\" style=\"--flex-gap: 0.375rem; --flex-wrap: wrap\">\n          <PvTag\n            v-for=\"item in group.values\"\n            :key=\"`${item.field ?? group.key}-${item.type ?? 'value'}-${item.value}`\"\n            :label=\"item.label\"\n            :showClear=\"!readOnly\"\n            @handle-close=\"handleRemoveFilter(group.key, item)\"\n          />\n        </div>\n      </div>\n    </div>\n    <p v-else class=\"pv-text-body-sm pv-text-subdued\" style=\"margin: 0\">No filters applied yet.</p>\n  </section>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\nimport PvTag from \"@/components/base/PvTag/PvTag.vue\";\nimport type {\n  PvFilterPanelAppliedFiltersSectionProps,\n  PvFilterPanelAppliedValue,\n  PvFilterPanelExternalFilterGroup,\n  PvFilterPanelFilterType,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelAppliedFiltersSectionProps>(), {\n  appliedCount: 0,\n  appliedGroups: () => [],\n  externalFilters: () => [],\n  readOnly: false,\n});\n\nconst emit = defineEmits<{\n  \"remove-filter\": [filterKey: string, value: string, type?: PvFilterPanelFilterType];\n  \"remove-external-filter\": [key: string, value: string];\n}>();\n\n// External groups with no values are dropped here rather than by the owner, so a search bar can pass\n// a single group whose values empty out as the query is cleared.\nconst visibleExternalFilters = computed(() => props.externalFilters.filter((group) => group.values.length > 0));\nconst hasAnyFilters = computed(() => props.appliedCount > 0 || visibleExternalFilters.value.length > 0);\nconst isExternalRemovable = (group: PvFilterPanelExternalFilterGroup) => !props.readOnly && group.removable !== false;\n\nconst handleRemoveFilter = (filterKey: string, item: PvFilterPanelAppliedValue) => {\n  emit(\"remove-filter\", item.field ?? filterKey, item.value, item.type);\n};\n</script>\n\n<template>\n  <section\n    class=\"pv-flex-vertical pv-inset-square-8\"\n    data-testid=\"pv-filter-panel-applied-section\"\n    style=\"--flex-align: stretch; --flex-gap: 1rem\"\n  >\n    <div v-if=\"hasAnyFilters\" class=\"pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 1rem\">\n      <div\n        v-for=\"group in visibleExternalFilters\"\n        :key=\"`external-${group.key}`\"\n        class=\"pv-flex-vertical pv-border-bottom\"\n        data-testid=\"pv-filter-panel-external-filter-group\"\n        style=\"--flex-align: stretch; --flex-gap: 12px; padding-bottom: 12px\"\n      >\n        <span class=\"pv-text-title-md\">{{ group.label }}</span>\n        <div class=\"pv-flex\" style=\"--flex-gap: 0.375rem; --flex-wrap: wrap\">\n          <PvTag\n            v-for=\"item in group.values\"\n            :key=\"`${group.key}-${item.value}`\"\n            :label=\"item.label\"\n            :showClear=\"isExternalRemovable(group)\"\n            @handle-close=\"emit('remove-external-filter', group.key, item.value)\"\n          />\n        </div>\n      </div>\n      <div\n        v-for=\"group in appliedGroups\"\n        :key=\"group.key\"\n        class=\"pv-flex-vertical pv-border-bottom\"\n        style=\"--flex-align: stretch; --flex-gap: 12px; padding-bottom: 12px\"\n      >\n        <span class=\"pv-text-title-md\">{{ group.label }}</span>\n        <div class=\"pv-flex\" style=\"--flex-gap: 0.375rem; --flex-wrap: wrap\">\n          <PvTag\n            v-for=\"item in group.values\"\n            :key=\"`${item.field ?? group.key}-${item.type ?? 'value'}-${item.value}`\"\n            :label=\"item.label\"\n            :showClear=\"!readOnly\"\n            @handle-close=\"handleRemoveFilter(group.key, item)\"\n          />\n        </div>\n      </div>\n    </div>\n    <p v-else class=\"pv-text-body-sm pv-text-subdued\" style=\"margin: 0\">No filters applied yet.</p>\n  </section>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport type { PvHorizontalScrollerProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvHorizontalScrollerProps>(), {\n  ariaLabel: \"Scrollable content\",\n  buttonSize: \"md\",\n  buttonVariant: \"secondary\",\n  hideScrollbar: false,\n  leftAriaLabel: \"Scroll left\",\n  rightAriaLabel: \"Scroll right\",\n  scrollBehavior: \"smooth\",\n  scrollFraction: 0.8,\n  showFades: false,\n});\n\nconst SCROLL_EPSILON = 1;\n\nconst canScrollLeft = ref(false);\nconst canScrollRight = ref(false);\nconst contentContainer = ref<HTMLElement | null>(null);\nconst scrollContainer = ref<HTMLElement | null>(null);\n\nlet resizeObserver: ResizeObserver | null = null;\nlet usingWindowResizeFallback = false;\n\nconst normalizedScrollFraction = computed(() => Math.max(0, props.scrollFraction));\n\nconst updateScrollState = () => {\n  const el = scrollContainer.value;\n  if (!el) return;\n\n  const maxScrollLeft = Math.max(0, el.scrollWidth - el.clientWidth);\n  canScrollLeft.value = el.scrollLeft > SCROLL_EPSILON;\n  canScrollRight.value = el.scrollLeft < maxScrollLeft - SCROLL_EPSILON;\n};\n\nconst observeResizeTargets = () => {\n  if (!resizeObserver) return;\n\n  resizeObserver.disconnect();\n  if (scrollContainer.value) resizeObserver.observe(scrollContainer.value);\n  if (contentContainer.value) resizeObserver.observe(contentContainer.value);\n};\n\nconst queueScrollStateUpdate = () => {\n  void nextTick(updateScrollState);\n};\n\nconst scrollByDirection = (direction: 1 | -1) => {\n  const el = scrollContainer.value;\n  if (!el) return;\n\n  const left = direction * el.clientWidth * normalizedScrollFraction.value;\n  if (typeof el.scrollBy === \"function\") {\n    el.scrollBy({ behavior: props.scrollBehavior, left });\n  } else {\n    el.scrollLeft += left;\n  }\n\n  updateScrollState();\n  if (typeof window.requestAnimationFrame === \"function\") {\n    window.requestAnimationFrame(updateScrollState);\n  }\n};\n\nonMounted(() => {\n  scrollContainer.value?.addEventListener(\"scroll\", updateScrollState, { passive: true });\n\n  if (typeof ResizeObserver !== \"undefined\") {\n    resizeObserver = new ResizeObserver(() => updateScrollState());\n    observeResizeTargets();\n  } else {\n    usingWindowResizeFallback = true;\n    window.addEventListener(\"resize\", updateScrollState);\n  }\n\n  queueScrollStateUpdate();\n});\n\nonUpdated(() => {\n  observeResizeTargets();\n  queueScrollStateUpdate();\n});\n\nonBeforeUnmount(() => {\n  scrollContainer.value?.removeEventListener(\"scroll\", updateScrollState);\n  resizeObserver?.disconnect();\n\n  if (usingWindowResizeFallback) {\n    window.removeEventListener(\"resize\", updateScrollState);\n  }\n});\n</script>\n\n<template>\n  <div class=\"pv-horizontal-scroller\">\n    <div\n      ref=\"scrollContainer\"\n      class=\"pv-horizontal-scroller-scroll\"\n      :class=\"{ 'pv-horizontal-scroller-scroll-hidden-scrollbar': hideScrollbar }\"\n      role=\"region\"\n      :aria-label=\"ariaLabel\"\n    >\n      <div ref=\"contentContainer\" class=\"pv-horizontal-scroller-content\">\n        <slot />\n      </div>\n    </div>\n\n    <div\n      class=\"pv-horizontal-scroller-control pv-horizontal-scroller-control-left\"\n      :class=\"{\n        'pv-horizontal-scroller-control-hidden': !canScrollLeft,\n        'pv-horizontal-scroller-control-left-fade': showFades,\n      }\"\n    >\n      <PvButton\n        v-if=\"canScrollLeft\"\n        :ariaLabel=\"leftAriaLabel\"\n        leftIcon=\"chevron-left\"\n        :size=\"buttonSize\"\n        :variant=\"buttonVariant\"\n        @click=\"scrollByDirection(-1)\"\n      />\n    </div>\n\n    <div\n      class=\"pv-horizontal-scroller-control pv-horizontal-scroller-control-right\"\n      :class=\"{\n        'pv-horizontal-scroller-control-hidden': !canScrollRight,\n        'pv-horizontal-scroller-control-right-fade': showFades,\n      }\"\n    >\n      <PvButton\n        v-if=\"canScrollRight\"\n        :ariaLabel=\"rightAriaLabel\"\n        leftIcon=\"chevron-right\"\n        :size=\"buttonSize\"\n        :variant=\"buttonVariant\"\n        @click=\"scrollByDirection(1)\"\n      />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport type { PvHorizontalScrollerProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvHorizontalScrollerProps>(), {\n  ariaLabel: \"Scrollable content\",\n  buttonSize: \"md\",\n  buttonVariant: \"secondary\",\n  hideScrollbar: false,\n  leftAriaLabel: \"Scroll left\",\n  rightAriaLabel: \"Scroll right\",\n  scrollBehavior: \"smooth\",\n  scrollFraction: 0.8,\n  showFades: false,\n});\n\nconst SCROLL_EPSILON = 1;\n\nconst canScrollLeft = ref(false);\nconst canScrollRight = ref(false);\nconst contentContainer = ref<HTMLElement | null>(null);\nconst scrollContainer = ref<HTMLElement | null>(null);\n\nlet resizeObserver: ResizeObserver | null = null;\nlet usingWindowResizeFallback = false;\n\nconst normalizedScrollFraction = computed(() => Math.max(0, props.scrollFraction));\n\nconst updateScrollState = () => {\n  const el = scrollContainer.value;\n  if (!el) return;\n\n  const maxScrollLeft = Math.max(0, el.scrollWidth - el.clientWidth);\n  canScrollLeft.value = el.scrollLeft > SCROLL_EPSILON;\n  canScrollRight.value = el.scrollLeft < maxScrollLeft - SCROLL_EPSILON;\n};\n\nconst observeResizeTargets = () => {\n  if (!resizeObserver) return;\n\n  resizeObserver.disconnect();\n  if (scrollContainer.value) resizeObserver.observe(scrollContainer.value);\n  if (contentContainer.value) resizeObserver.observe(contentContainer.value);\n};\n\nconst queueScrollStateUpdate = () => {\n  void nextTick(updateScrollState);\n};\n\nconst scrollByDirection = (direction: 1 | -1) => {\n  const el = scrollContainer.value;\n  if (!el) return;\n\n  const left = direction * el.clientWidth * normalizedScrollFraction.value;\n  if (typeof el.scrollBy === \"function\") {\n    el.scrollBy({ behavior: props.scrollBehavior, left });\n  } else {\n    el.scrollLeft += left;\n  }\n\n  updateScrollState();\n  if (typeof window.requestAnimationFrame === \"function\") {\n    window.requestAnimationFrame(updateScrollState);\n  }\n};\n\nonMounted(() => {\n  scrollContainer.value?.addEventListener(\"scroll\", updateScrollState, { passive: true });\n\n  if (typeof ResizeObserver !== \"undefined\") {\n    resizeObserver = new ResizeObserver(() => updateScrollState());\n    observeResizeTargets();\n  } else {\n    usingWindowResizeFallback = true;\n    window.addEventListener(\"resize\", updateScrollState);\n  }\n\n  queueScrollStateUpdate();\n});\n\nonUpdated(() => {\n  observeResizeTargets();\n  queueScrollStateUpdate();\n});\n\nonBeforeUnmount(() => {\n  scrollContainer.value?.removeEventListener(\"scroll\", updateScrollState);\n  resizeObserver?.disconnect();\n\n  if (usingWindowResizeFallback) {\n    window.removeEventListener(\"resize\", updateScrollState);\n  }\n});\n</script>\n\n<template>\n  <div class=\"pv-horizontal-scroller\">\n    <div\n      ref=\"scrollContainer\"\n      class=\"pv-horizontal-scroller-scroll\"\n      :class=\"{ 'pv-horizontal-scroller-scroll-hidden-scrollbar': hideScrollbar }\"\n      role=\"region\"\n      :aria-label=\"ariaLabel\"\n    >\n      <div ref=\"contentContainer\" class=\"pv-horizontal-scroller-content\">\n        <slot />\n      </div>\n    </div>\n\n    <div\n      class=\"pv-horizontal-scroller-control pv-horizontal-scroller-control-left\"\n      :class=\"{\n        'pv-horizontal-scroller-control-hidden': !canScrollLeft,\n        'pv-horizontal-scroller-control-left-fade': showFades,\n      }\"\n    >\n      <PvButton\n        v-if=\"canScrollLeft\"\n        :ariaLabel=\"leftAriaLabel\"\n        leftIcon=\"chevron-left\"\n        :size=\"buttonSize\"\n        :variant=\"buttonVariant\"\n        @click=\"scrollByDirection(-1)\"\n      />\n    </div>\n\n    <div\n      class=\"pv-horizontal-scroller-control pv-horizontal-scroller-control-right\"\n      :class=\"{\n        'pv-horizontal-scroller-control-hidden': !canScrollRight,\n        'pv-horizontal-scroller-control-right-fade': showFades,\n      }\"\n    >\n      <PvButton\n        v-if=\"canScrollRight\"\n        :ariaLabel=\"rightAriaLabel\"\n        leftIcon=\"chevron-right\"\n        :size=\"buttonSize\"\n        :variant=\"buttonVariant\"\n        @click=\"scrollByDirection(1)\"\n      />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvHorizontalScroller from \"@/components/base/PvHorizontalScroller/PvHorizontalScroller.vue\";\nimport type { PvFilterPanelCategory, PvFilterPanelCategoryButtonRowProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelCategoryButtonRowProps>(), {\n  allCategoriesLabel: \"All\",\n  filters: () => [],\n});\n\nconst selectedCategory = defineModel<PvFilterPanelCategory | null>({ default: null });\n\nconst availableCategories = computed<PvFilterPanelCategory[]>(() => {\n  const present = new Set<PvFilterPanelCategory>();\n  const encountered: PvFilterPanelCategory[] = [];\n\n  for (const filter of props.filters) {\n    if (!filter.category) continue;\n    present.add(filter.category);\n    if (!encountered.includes(filter.category)) encountered.push(filter.category);\n  }\n\n  const orderedCategories = (props.categoryOrder ?? []).filter((category) => present.has(category));\n  const orderedCategorySet = new Set(orderedCategories);\n  const unorderedCategories = encountered.filter((category) => !orderedCategorySet.has(category));\n  return [...orderedCategories, ...unorderedCategories];\n});\n\nconst selectCategory = (category: PvFilterPanelCategory | null) => {\n  selectedCategory.value = category;\n};\n\nconst variantFor = (category: PvFilterPanelCategory | null) =>\n  selectedCategory.value === category ? \"secondary\" : \"ghost\";\n\nwatch(\n  availableCategories,\n  (categories) => {\n    if (selectedCategory.value !== null && !categories.includes(selectedCategory.value)) {\n      selectedCategory.value = null;\n    }\n  },\n  { immediate: true },\n);\n</script>\n\n<template>\n  <div v-if=\"availableCategories.length\" class=\"pv-border-bottom\" data-testid=\"pv-filter-panel-category-row\">\n    <PvHorizontalScroller\n      ariaLabel=\"Filter categories\"\n      buttonSize=\"lg\"\n      buttonVariant=\"ghost\"\n      hideScrollbar\n      leftAriaLabel=\"Scroll filter categories left\"\n      rightAriaLabel=\"Scroll filter categories right\"\n      showFades\n    >\n      <div class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 8px; padding: 8px 12px\">\n        <PvButton :label=\"allCategoriesLabel\" :variant=\"variantFor(null)\" @click=\"selectCategory(null)\" />\n        <PvButton\n          v-for=\"category in availableCategories\"\n          :key=\"category\"\n          :label=\"category\"\n          :variant=\"variantFor(category)\"\n          @click=\"selectCategory(category)\"\n        />\n      </div>\n    </PvHorizontalScroller>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvHorizontalScroller from \"@/components/base/PvHorizontalScroller/PvHorizontalScroller.vue\";\nimport type { PvFilterPanelCategory, PvFilterPanelCategoryButtonRowProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterPanelCategoryButtonRowProps>(), {\n  allCategoriesLabel: \"All\",\n  filters: () => [],\n});\n\nconst selectedCategory = defineModel<PvFilterPanelCategory | null>({ default: null });\n\nconst availableCategories = computed<PvFilterPanelCategory[]>(() => {\n  const present = new Set<PvFilterPanelCategory>();\n  const encountered: PvFilterPanelCategory[] = [];\n\n  for (const filter of props.filters) {\n    if (!filter.category) continue;\n    present.add(filter.category);\n    if (!encountered.includes(filter.category)) encountered.push(filter.category);\n  }\n\n  const orderedCategories = (props.categoryOrder ?? []).filter((category) => present.has(category));\n  const orderedCategorySet = new Set(orderedCategories);\n  const unorderedCategories = encountered.filter((category) => !orderedCategorySet.has(category));\n  return [...orderedCategories, ...unorderedCategories];\n});\n\nconst selectCategory = (category: PvFilterPanelCategory | null) => {\n  selectedCategory.value = category;\n};\n\nconst variantFor = (category: PvFilterPanelCategory | null) =>\n  selectedCategory.value === category ? \"secondary\" : \"ghost\";\n\nwatch(\n  availableCategories,\n  (categories) => {\n    if (selectedCategory.value !== null && !categories.includes(selectedCategory.value)) {\n      selectedCategory.value = null;\n    }\n  },\n  { immediate: true },\n);\n</script>\n\n<template>\n  <div v-if=\"availableCategories.length\" class=\"pv-border-bottom\" data-testid=\"pv-filter-panel-category-row\">\n    <PvHorizontalScroller\n      ariaLabel=\"Filter categories\"\n      buttonSize=\"lg\"\n      buttonVariant=\"ghost\"\n      hideScrollbar\n      leftAriaLabel=\"Scroll filter categories left\"\n      rightAriaLabel=\"Scroll filter categories right\"\n      showFades\n    >\n      <div class=\"pv-flex\" style=\"--flex-align: center; --flex-gap: 8px; padding: 8px 12px\">\n        <PvButton :label=\"allCategoriesLabel\" :variant=\"variantFor(null)\" @click=\"selectCategory(null)\" />\n        <PvButton\n          v-for=\"category in availableCategories\"\n          :key=\"category\"\n          :label=\"category\"\n          :variant=\"variantFor(category)\"\n          @click=\"selectCategory(category)\"\n        />\n      </div>\n    </PvHorizontalScroller>\n  </div>\n</template>\n","export const buildFilterSearchPlaceholder = (\n  currentField: string | undefined,\n  queryColIds: (string | null | undefined)[] | undefined,\n  getDisplayName: (field: string) => string | null | undefined,\n) => {\n  const searchableFields = [currentField, ...(queryColIds ?? [])].filter((field): field is string => Boolean(field));\n  if (searchableFields.length <= 1) return \"Search\";\n\n  const seenFields = new Set<string>();\n  const labels = searchableFields.flatMap((field) => {\n    if (seenFields.has(field)) return [];\n    seenFields.add(field);\n    return [getDisplayName(field) || field];\n  });\n\n  return labels.length ? `Search ${labels.join(\", \")}` : \"Search\";\n};\n\nconst normalizeFilterSearchText = (value: string | null | undefined) =>\n  String(value ?? \"\")\n    .trim()\n    .replace(/\\s+/g, \" \")\n    .toLocaleLowerCase();\n\nexport const formatSearchMatchSubText = ({\n  fallbackSubText,\n  getDisplayName,\n  matchedField,\n  matchedValue,\n  primaryText,\n  showPrefix = true,\n}: {\n  fallbackSubText?: string;\n  getDisplayName: (field: string) => string | null | undefined;\n  matchedField?: string;\n  matchedValue?: string;\n  primaryText?: string | null;\n  showPrefix?: boolean;\n}) => {\n  if (!matchedValue) return fallbackSubText;\n  if (normalizeFilterSearchText(primaryText) === normalizeFilterSearchText(matchedValue)) return fallbackSubText;\n  if (!showPrefix || !matchedField) return matchedValue;\n\n  const matchedFieldLabel = getDisplayName(matchedField);\n  return matchedFieldLabel ? `${matchedFieldLabel}: ${matchedValue}` : matchedValue;\n};\n","import type { AdvancedFilterModel } from \"ag-grid-enterprise\";\nimport type { PvFilterPanelColDef, PvFilterPanelFilterModelType } from \"./types\";\n\nexport interface PvFilterPanelRangeValue {\n  max: number | null;\n  min: number | null;\n}\n\ntype RegularFilterModel = Record<string, RegularFilterCondition>;\n\ntype RegularFilterConditionMatcher = (condition: RegularFilterCondition) => boolean;\n\ninterface RegularFilterCondition {\n  filter?: boolean | number | string | null;\n  filterModels?: Array<RegularFilterCondition | null | undefined>;\n  filterTo?: number | null;\n  filterType?: string;\n  type?: string;\n  values?: unknown[];\n}\n\nexport type PvAdvancedFilterColumnType =\n  | \"date\"\n  | \"dateString\"\n  | \"dateTime\"\n  | \"dateTimeString\"\n  | \"number\"\n  | \"object\"\n  | \"text\";\n\ninterface AdvancedFilterCondition {\n  colId: string;\n  filter?: boolean | number | string;\n  filterType: string;\n  type: string;\n  values?: string[];\n}\n\ninterface AdvancedFilterJoin {\n  conditions: AdvancedFilterNode[];\n  filterType: \"join\";\n  type: \"AND\" | \"OR\";\n}\n\ntype AdvancedFilterNode = AdvancedFilterCondition | AdvancedFilterJoin;\n\nexport interface PvFilterPanelModelIndexEntry {\n  booleanValue: boolean | null;\n  existsValue: boolean;\n  rangeValue: PvFilterPanelRangeValue;\n  values: string[];\n}\n\nexport type PvFilterPanelModelIndex = Map<string, PvFilterPanelModelIndexEntry>;\n\nconst createIndexEntry = (): PvFilterPanelModelIndexEntry => ({\n  booleanValue: null,\n  existsValue: false,\n  rangeValue: { max: null, min: null },\n  values: [],\n});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n  return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\nconst isConditionNode = (model: unknown): model is AdvancedFilterCondition => {\n  return (\n    isRecord(model) &&\n    typeof model.colId === \"string\" &&\n    typeof model.filterType === \"string\" &&\n    typeof model.type === \"string\"\n  );\n};\n\nconst isJoinNode = (model: unknown): model is AdvancedFilterJoin => {\n  return isRecord(model) && model.filterType === \"join\" && Array.isArray(model.conditions);\n};\n\nconst asAdvancedFilterModel = (node: AdvancedFilterNode | null): AdvancedFilterModel | null => {\n  return node as AdvancedFilterModel | null;\n};\n\nconst cloneNode = (node: AdvancedFilterNode): AdvancedFilterNode => {\n  if (isJoinNode(node)) {\n    return {\n      conditions: node.conditions.map(cloneNode),\n      filterType: \"join\",\n      type: node.type,\n    };\n  }\n\n  return { ...node };\n};\n\nconst normalizeModel = (model: AdvancedFilterModel | null | unknown): AdvancedFilterNode | null => {\n  if (!isRecord(model)) return null;\n\n  if (isJoinNode(model)) {\n    const conditions = model.conditions.flatMap((condition) => {\n      const normalized = normalizeModel(condition);\n      return normalized ? [normalized] : [];\n    });\n\n    if (!conditions.length) return null;\n    return { conditions, filterType: \"join\", type: model.type === \"OR\" ? \"OR\" : \"AND\" };\n  }\n\n  if (isConditionNode(model)) {\n    return { ...(model as AdvancedFilterCondition) };\n  }\n\n  return null;\n};\n\nconst toFiniteNumber = (value: number | null): number | null => {\n  return typeof value === \"number\" && Number.isFinite(value) ? value : null;\n};\n\nconst isRegularFilterModel = (model: unknown): model is RegularFilterModel => {\n  return isRecord(model) && !isJoinNode(model) && !isConditionNode(model);\n};\n\nconst isRegularMultiFilter = (\n  condition: RegularFilterCondition | null | undefined,\n): condition is RegularFilterCondition & { filterModels: Array<RegularFilterCondition | null | undefined> } => {\n  return condition?.filterType === \"multi\" && Array.isArray(condition.filterModels);\n};\n\nconst regularMultiFilterNameByConditionType: Record<string, string> = {\n  number: \"agNumberColumnFilter\",\n  set: \"agSetColumnFilter\",\n  text: \"agTextColumnFilter\",\n};\n\nconst getColDefMultiFilterDefs = (colDef?: PvFilterPanelColDef): unknown[] => {\n  if (colDef?.filter !== \"agMultiColumnFilter\") return [];\n  const filterParams = colDef.filterParams as { filters?: unknown[] } | undefined;\n  return Array.isArray(filterParams?.filters) ? filterParams.filters : [];\n};\n\nconst getColDefMultiFilterIndex = (colDef: PvFilterPanelColDef | undefined, condition: RegularFilterCondition) => {\n  const filterDefs = getColDefMultiFilterDefs(colDef);\n  const expectedFilter = condition.filterType ? regularMultiFilterNameByConditionType[condition.filterType] : undefined;\n  if (!expectedFilter) return -1;\n\n  return filterDefs.findIndex((filterDef) => {\n    return isRecord(filterDef) && filterDef.filter === expectedFilter;\n  });\n};\n\nconst createRegularMultiCondition = (\n  colDef: PvFilterPanelColDef | undefined,\n  condition: RegularFilterCondition,\n): RegularFilterCondition | null => {\n  const filterDefs = getColDefMultiFilterDefs(colDef);\n  if (!filterDefs.length) return null;\n\n  const filterModels = Array<RegularFilterCondition | null>(filterDefs.length).fill(null);\n  const index = getColDefMultiFilterIndex(colDef, condition);\n  if (index < 0) return null;\n  filterModels[index] = condition;\n  return { filterModels, filterType: \"multi\" };\n};\n\nconst getRegularCondition = (model: unknown, colId: string): RegularFilterCondition | null => {\n  if (!isRegularFilterModel(model)) return null;\n  const condition = model[colId];\n  return isRecord(condition) ? (condition as RegularFilterCondition) : null;\n};\n\nconst getRegularLeafConditions = (condition: RegularFilterCondition | null): RegularFilterCondition[] => {\n  if (!condition) return [];\n  if (!isRegularMultiFilter(condition)) return [condition];\n  return condition.filterModels!.filter((filterModel): filterModel is RegularFilterCondition => isRecord(filterModel));\n};\n\nconst cloneRegularModel = (model: AdvancedFilterModel | null | unknown): RegularFilterModel => {\n  return isRegularFilterModel(model) ? { ...model } : {};\n};\n\nconst cloneRegularCondition = (condition: RegularFilterCondition): RegularFilterCondition => {\n  if (!isRegularMultiFilter(condition)) return { ...condition };\n  return {\n    ...condition,\n    filterModels: condition.filterModels!.map((filterModel) => (filterModel ? { ...filterModel } : filterModel)),\n  };\n};\n\nconst removeRegularColumnFilter = (\n  model: AdvancedFilterModel | null | unknown,\n  colId: string,\n): RegularFilterModel | null => {\n  const nextModel = cloneRegularModel(model);\n  delete nextModel[colId];\n  return Object.keys(nextModel).length ? nextModel : null;\n};\n\nconst warnedRegularMultiFilterOverwrites = new Set<string>();\n\nconst warnRegularMultiFilterOverwrite = (colId: string, filterType: string | undefined) => {\n  const key = `${colId}:${filterType ?? \"unknown\"}`;\n  if (warnedRegularMultiFilterOverwrites.has(key)) return;\n  console.warn(\n    `PvFilterPanel: overwriting an occupied regular multi-filter slot for \"${colId}\" because the target slot was occupied or no empty slot was available.`,\n  );\n  warnedRegularMultiFilterOverwrites.add(key);\n};\n\nconst updateRegularColumnFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  condition: RegularFilterCondition | null,\n  matchesCondition?: RegularFilterConditionMatcher,\n  colDef?: PvFilterPanelColDef,\n): AdvancedFilterModel | null => {\n  const existingCondition = getRegularCondition(model, colId);\n\n  if (isRegularMultiFilter(existingCondition) && matchesCondition) {\n    const nextModel = cloneRegularModel(model);\n    const nextCondition = cloneRegularCondition(existingCondition);\n    const filterModels = [...(nextCondition.filterModels ?? [])];\n    const matchingIndexes = filterModels.flatMap((filterModel, index) =>\n      filterModel && matchesCondition(filterModel) ? [index] : [],\n    );\n\n    if (!condition) {\n      for (const index of matchingIndexes) filterModels[index] = null;\n      if (filterModels.some(Boolean)) {\n        nextModel[colId] = { ...nextCondition, filterModels };\n      } else {\n        delete nextModel[colId];\n      }\n      return Object.keys(nextModel).length ? (nextModel as unknown as AdvancedFilterModel) : null;\n    }\n\n    if (matchingIndexes.length) {\n      const [firstIndex, ...extraIndexes] = matchingIndexes;\n      filterModels[firstIndex] = condition;\n      for (const index of extraIndexes) filterModels[index] = null;\n    } else {\n      const colDefIndex = getColDefMultiFilterIndex(colDef, condition);\n      const emptyIndex = filterModels.findIndex((filterModel) => !filterModel);\n      const hasMultiFilterDefs = getColDefMultiFilterDefs(colDef).length > 0;\n      if (colDefIndex >= 0) {\n        while (filterModels.length <= colDefIndex) filterModels.push(null);\n        if (filterModels[colDefIndex]) warnRegularMultiFilterOverwrite(colId, condition.filterType);\n        filterModels[colDefIndex] = condition;\n      } else if (emptyIndex >= 0) {\n        filterModels[emptyIndex] = condition;\n      } else if (!hasMultiFilterDefs) {\n        filterModels.push(condition);\n      } else {\n        const replacementIndex = Math.max(0, filterModels.length - 1);\n        warnRegularMultiFilterOverwrite(colId, condition.filterType);\n        filterModels[replacementIndex] = condition;\n      }\n    }\n\n    nextModel[colId] = { ...nextCondition, filterModels };\n    return nextModel as unknown as AdvancedFilterModel;\n  }\n\n  if (!condition) return removeRegularColumnFilter(model, colId) as AdvancedFilterModel | null;\n  const nextModel = cloneRegularModel(model);\n  nextModel[colId] = createRegularMultiCondition(colDef, condition) ?? condition;\n  return nextModel as unknown as AdvancedFilterModel;\n};\n\nconst walkConditions = (model: AdvancedFilterNode | null, visit: (condition: AdvancedFilterCondition) => void) => {\n  if (!model) return;\n\n  if (isJoinNode(model)) {\n    model.conditions.forEach((condition) => walkConditions(condition, visit));\n    return;\n  }\n\n  visit(model);\n};\n\nconst nodeReferencesOnlyColumn = (model: AdvancedFilterNode, colId: string): boolean => {\n  if (isJoinNode(model)) {\n    return (\n      model.conditions.length > 0 && model.conditions.every((condition) => nodeReferencesOnlyColumn(condition, colId))\n    );\n  }\n\n  return model.colId === colId;\n};\n\nconst getOnlyReferencedColumn = (model: AdvancedFilterNode): string | null => {\n  if (!isJoinNode(model)) return model.colId;\n\n  const columnIds = new Set<string>();\n  walkConditions(model, (condition) => columnIds.add(condition.colId));\n  return columnIds.size === 1 ? [...columnIds][0] : null;\n};\n\nconst filterOutColumn = (model: AdvancedFilterNode | null, colId: string): AdvancedFilterNode | null => {\n  if (!model) return null;\n  if (nodeReferencesOnlyColumn(model, colId)) return null;\n  if (!isJoinNode(model) || model.type !== \"AND\") return cloneNode(model);\n\n  const conditions = model.conditions.flatMap((condition) =>\n    nodeReferencesOnlyColumn(condition, colId) ? [] : [cloneNode(condition)],\n  );\n\n  if (!conditions.length) return null;\n  if (conditions.length === 1) return conditions[0];\n  return { conditions, filterType: model.filterType, type: model.type };\n};\n\nconst appendColumnFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  replacement: AdvancedFilterNode | null,\n): AdvancedFilterModel | null => {\n  const base = filterOutColumn(normalizeModel(model), colId);\n  if (!replacement) return asAdvancedFilterModel(base);\n  if (!base) return asAdvancedFilterModel(replacement);\n\n  if (isJoinNode(base) && base.type === \"AND\") {\n    return asAdvancedFilterModel({ ...base, conditions: [...base.conditions, replacement] });\n  }\n\n  return asAdvancedFilterModel({\n    conditions: [base, replacement],\n    filterType: \"join\",\n    type: \"AND\",\n  });\n};\n\nconst addUniqueValue = (values: string[], value: string) => {\n  if (!values.includes(value)) values.push(value);\n};\n\nconst isTextBooleanCondition = (condition: RegularFilterCondition | AdvancedFilterCondition) => {\n  if (condition.filterType !== \"text\" || condition.type !== \"equals\" || condition.filter === undefined) return false;\n  const stringValue = String(condition.filter);\n  return stringValue === \"true\" || stringValue === \"false\";\n};\n\nconst isRegularBooleanCondition = (condition: RegularFilterCondition) => {\n  return condition.filterType === \"boolean\" || isTextBooleanCondition(condition);\n};\n\nconst readRegularConditionIntoEntry = (condition: RegularFilterCondition, entry: PvFilterPanelModelIndexEntry) => {\n  if (condition.filterType === \"set\" && Array.isArray(condition.values)) {\n    condition.values.forEach((value) => addUniqueValue(entry.values, String(value)));\n    return;\n  }\n\n  if (condition.filterType === \"text\" && condition.type === \"equals\" && condition.filter !== undefined) {\n    const stringValue = String(condition.filter);\n    if (stringValue === \"true\") entry.booleanValue = true;\n    else if (stringValue === \"false\") entry.booleanValue = false;\n    addUniqueValue(entry.values, stringValue);\n    return;\n  }\n\n  if (condition.filterType === \"boolean\") {\n    if (condition.type === \"true\" || condition.filter === true) entry.booleanValue = true;\n    if (condition.type === \"false\" || condition.filter === false) entry.booleanValue = false;\n    return;\n  }\n\n  if (condition.type === \"notBlank\") {\n    entry.existsValue = true;\n    return;\n  }\n\n  if (condition.filterType !== \"number\" || typeof condition.filter !== \"number\") return;\n  if (condition.type === \"equals\") {\n    entry.rangeValue = { max: condition.filter, min: condition.filter };\n  }\n  if (condition.type === \"inRange\") {\n    entry.rangeValue = {\n      max: typeof condition.filterTo === \"number\" ? condition.filterTo : null,\n      min: condition.filter,\n    };\n  }\n  if (condition.type === \"greaterThan\" || condition.type === \"greaterThanOrEqual\") {\n    entry.rangeValue = { ...entry.rangeValue, min: condition.filter };\n  }\n  if (condition.type === \"lessThan\" || condition.type === \"lessThanOrEqual\") {\n    entry.rangeValue = { ...entry.rangeValue, max: condition.filter };\n  }\n};\n\nconst readAdvancedConditionIntoEntry = (condition: AdvancedFilterCondition, entry: PvFilterPanelModelIndexEntry) => {\n  if (condition.type === \"notBlank\") {\n    entry.existsValue = true;\n    return;\n  }\n\n  if (condition.filterType === \"boolean\") {\n    if (condition.type === \"true\" || condition.filter === true) entry.booleanValue = true;\n    if (condition.type === \"false\" || condition.filter === false) entry.booleanValue = false;\n    return;\n  }\n\n  if (condition.filterType === \"set\" && Array.isArray(condition.values)) {\n    condition.values.forEach((value) => addUniqueValue(entry.values, String(value)));\n    return;\n  }\n\n  if (condition.filterType === \"text\" && condition.type === \"equals\" && condition.filter !== undefined) {\n    const stringValue = String(condition.filter);\n    if (stringValue === \"true\") entry.booleanValue = true;\n    else if (stringValue === \"false\") entry.booleanValue = false;\n    addUniqueValue(entry.values, stringValue);\n    return;\n  }\n\n  if (condition.filterType !== \"number\" || typeof condition.filter !== \"number\") return;\n  if (condition.type === \"equals\") {\n    entry.rangeValue = { max: condition.filter, min: condition.filter };\n  }\n  if (condition.type === \"greaterThan\" || condition.type === \"greaterThanOrEqual\") {\n    entry.rangeValue = { ...entry.rangeValue, min: condition.filter };\n  }\n  if (condition.type === \"lessThan\" || condition.type === \"lessThanOrEqual\") {\n    entry.rangeValue = { ...entry.rangeValue, max: condition.filter };\n  }\n};\n\nexport const createFilterPanelModelIndex = (\n  model: AdvancedFilterModel | null | undefined | unknown,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): PvFilterPanelModelIndex => {\n  const index: PvFilterPanelModelIndex = new Map();\n\n  if (modelType === \"regular\") {\n    if (!isRegularFilterModel(model)) return index;\n    for (const [colId, condition] of Object.entries(model)) {\n      const entry = createIndexEntry();\n      getRegularLeafConditions(condition).forEach((leafCondition) =>\n        readRegularConditionIntoEntry(leafCondition, entry),\n      );\n      if (\n        entry.values.length ||\n        entry.booleanValue !== null ||\n        entry.existsValue ||\n        entry.rangeValue.min !== null ||\n        entry.rangeValue.max !== null\n      ) {\n        index.set(colId, entry);\n      }\n    }\n    return index;\n  }\n\n  const normalizedModel = normalizeModel(model);\n  if (!normalizedModel) return index;\n  const panelOwnedNodes =\n    isJoinNode(normalizedModel) && normalizedModel.type === \"AND\" ? normalizedModel.conditions : [normalizedModel];\n\n  for (const node of panelOwnedNodes) {\n    const colId = getOnlyReferencedColumn(node);\n    if (!colId) continue;\n    const entry = index.get(colId) ?? createIndexEntry();\n    walkConditions(node, (condition) => {\n      if (condition.colId === colId) readAdvancedConditionIntoEntry(condition, entry);\n    });\n    if (\n      entry.values.length ||\n      entry.booleanValue !== null ||\n      entry.existsValue ||\n      entry.rangeValue.min !== null ||\n      entry.rangeValue.max !== null\n    ) {\n      index.set(colId, entry);\n    }\n  }\n\n  return index;\n};\n\nexport const advancedFilterHasConditions = (\n  model: AdvancedFilterModel | null | undefined | unknown,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): boolean => {\n  if (modelType === \"regular\") return isRegularFilterModel(model) && Object.keys(model).length > 0;\n  return normalizeModel(model) !== null;\n};\n\nexport const getBooleanFilter = (\n  model: AdvancedFilterModel | null | unknown,\n  colId: string,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): boolean | null => {\n  return createFilterPanelModelIndex(model, modelType).get(colId)?.booleanValue ?? null;\n};\n\nexport const getExistsFilter = (\n  model: AdvancedFilterModel | null | unknown,\n  colId: string,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): boolean => {\n  return createFilterPanelModelIndex(model, modelType).get(colId)?.existsValue ?? false;\n};\n\nexport const getRangeFilter = (\n  model: AdvancedFilterModel | null | unknown,\n  colId: string,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): PvFilterPanelRangeValue => {\n  return createFilterPanelModelIndex(model, modelType).get(colId)?.rangeValue ?? { max: null, min: null };\n};\n\nexport const getAdvancedFilterTypeForDataType = (dataType?: string | null): PvAdvancedFilterColumnType => {\n  if (\n    dataType === \"currency\" ||\n    dataType === \"formula\" ||\n    dataType === \"integer\" ||\n    dataType === \"number\" ||\n    dataType === \"percent\"\n  ) {\n    return \"number\";\n  }\n\n  if (dataType === \"date\") return \"date\";\n  return \"text\";\n};\n\nexport const getValueSelections = (\n  model: AdvancedFilterModel | null | unknown,\n  colId: string,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): string[] => {\n  return createFilterPanelModelIndex(model, modelType).get(colId)?.values ?? [];\n};\n\nexport const removeColumnFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n): AdvancedFilterModel | null => {\n  if (modelType === \"regular\") return removeRegularColumnFilter(model, colId) as AdvancedFilterModel | null;\n  return asAdvancedFilterModel(filterOutColumn(normalizeModel(model), colId));\n};\n\nexport const updateBooleanFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  value: boolean | null,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n  advancedFilterType: \"boolean\" | \"text\" = \"boolean\",\n  colDef?: PvFilterPanelColDef,\n): AdvancedFilterModel | null => {\n  if (value === null) {\n    if (modelType === \"regular\") {\n      return updateRegularColumnFilter(model, colId, null, isRegularBooleanCondition, colDef);\n    }\n    return removeColumnFilter(model, colId, modelType);\n  }\n\n  if (modelType === \"regular\") {\n    return updateRegularColumnFilter(\n      model,\n      colId,\n      advancedFilterType === \"text\"\n        ? {\n            filter: String(value),\n            filterType: \"text\",\n            type: \"equals\",\n          }\n        : {\n            filter: value,\n            filterType: \"boolean\",\n            type: value ? \"true\" : \"false\",\n          },\n      isRegularBooleanCondition,\n      colDef,\n    );\n  }\n\n  if (advancedFilterType === \"text\") {\n    return appendColumnFilter(model, colId, {\n      colId,\n      filter: String(value),\n      filterType: \"text\",\n      type: \"equals\",\n    });\n  }\n\n  return appendColumnFilter(model, colId, {\n    colId,\n    filterType: \"boolean\",\n    type: value ? \"true\" : \"false\",\n  });\n};\n\nexport const updateExistsFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  value: boolean,\n  filterType: PvAdvancedFilterColumnType = \"text\",\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n  colDef?: PvFilterPanelColDef,\n): AdvancedFilterModel | null => {\n  if (!value) {\n    if (modelType === \"regular\") {\n      return updateRegularColumnFilter(\n        model,\n        colId,\n        null,\n        (condition) => condition.filterType === filterType && condition.type === \"notBlank\",\n        colDef,\n      );\n    }\n    return removeColumnFilter(model, colId, modelType);\n  }\n\n  if (modelType === \"regular\") {\n    return updateRegularColumnFilter(\n      model,\n      colId,\n      {\n        filterType,\n        type: \"notBlank\",\n      },\n      (condition) => condition.filterType === filterType && condition.type === \"notBlank\",\n      colDef,\n    );\n  }\n\n  return appendColumnFilter(model, colId, {\n    colId,\n    filterType,\n    type: \"notBlank\",\n  });\n};\n\nexport const updateRangeFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  minValue: number | null,\n  maxValue: number | null,\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n  colDef?: PvFilterPanelColDef,\n): AdvancedFilterModel | null => {\n  const min = toFiniteNumber(minValue);\n  const max = toFiniteNumber(maxValue);\n\n  if (modelType === \"regular\") {\n    if (min === null && max === null) {\n      return updateRegularColumnFilter(model, colId, null, (condition) => condition.filterType === \"number\", colDef);\n    }\n    if (min !== null && max !== null) {\n      return updateRegularColumnFilter(\n        model,\n        colId,\n        {\n          filter: min,\n          filterTo: max,\n          filterType: \"number\",\n          type: \"inRange\",\n        },\n        (condition) => condition.filterType === \"number\",\n        colDef,\n      );\n    }\n    return updateRegularColumnFilter(\n      model,\n      colId,\n      {\n        filter: min ?? max,\n        filterType: \"number\",\n        type: min !== null ? \"greaterThanOrEqual\" : \"lessThanOrEqual\",\n      },\n      (condition) => condition.filterType === \"number\",\n      colDef,\n    );\n  }\n\n  const conditions: AdvancedFilterNode[] = [];\n\n  if (min !== null) {\n    conditions.push({ colId, filter: min, filterType: \"number\", type: \"greaterThanOrEqual\" });\n  }\n\n  if (max !== null) {\n    conditions.push({ colId, filter: max, filterType: \"number\", type: \"lessThanOrEqual\" });\n  }\n\n  if (!conditions.length) return removeColumnFilter(model, colId);\n\n  const replacement =\n    conditions.length === 1 ? conditions[0] : ({ conditions, filterType: \"join\", type: \"AND\" } as AdvancedFilterJoin);\n  return appendColumnFilter(model, colId, replacement);\n};\n\nexport const updateValueFilter = (\n  model: AdvancedFilterModel | null,\n  colId: string,\n  values: string[],\n  modelType: PvFilterPanelFilterModelType = \"advanced\",\n  colDef?: PvFilterPanelColDef,\n): AdvancedFilterModel | null => {\n  const uniqueValues = Array.from(new Set(values));\n\n  if (modelType === \"regular\") {\n    if (!uniqueValues.length) {\n      return updateRegularColumnFilter(model, colId, null, (condition) => condition.filterType === \"set\", colDef);\n    }\n    return updateRegularColumnFilter(\n      model,\n      colId,\n      {\n        filterType: \"set\",\n        values: uniqueValues,\n      },\n      (condition) => condition.filterType === \"set\",\n      colDef,\n    );\n  }\n\n  const conditions: AdvancedFilterNode[] = uniqueValues.map((value) => ({\n    colId,\n    filter: value,\n    filterType: \"text\",\n    type: \"equals\",\n  }));\n\n  if (!conditions.length) return removeColumnFilter(model, colId);\n\n  const replacement =\n    conditions.length === 1 ? conditions[0] : ({ conditions, filterType: \"join\", type: \"OR\" } as AdvancedFilterJoin);\n  return appendColumnFilter(model, colId, replacement);\n};\n","import { inject, provide, ref, type InjectionKey } from \"vue\";\n\nimport { filterPanelOptionMatchesRawValue, getFilterPanelOptionRawValue } from \"./filterOptionValue\";\nimport type {\n  PvFilterPanelOption,\n  PvFilterPanelOptionsHandler,\n  PvFilterPanelOptionsResponse,\n  PvFilterStore,\n  PvFilterStoreFetchOptionsParams,\n} from \"./types\";\n\nconst PvFilterStoreKey: InjectionKey<PvFilterStore> = Symbol(\"PvFilterStore\");\n\nconst normalizeOptionsResponse = (\n  response: PvFilterPanelOptionsResponse | (PvFilterPanelOption | null)[] | undefined,\n) => {\n  if (!response) return { values: [] } satisfies PvFilterPanelOptionsResponse;\n  return Array.isArray(response) ? ({ values: response } satisfies PvFilterPanelOptionsResponse) : response;\n};\n\nconst mergeTotalChildCount = (existing?: number, incoming?: number) => incoming ?? existing;\n\nconst cloneOptionMap = <T>(map: Record<string, T[]>) => {\n  return Object.fromEntries(Object.entries(map).map(([field, values]) => [field, [...values]]));\n};\n\nconst mergeOptions = (options: (PvFilterPanelOption | null)[]) => {\n  const optionsByValue = new Map<string, PvFilterPanelOption>();\n\n  for (const option of options) {\n    if (!option) continue;\n    const existing = optionsByValue.get(option.value);\n    if (!existing) {\n      optionsByValue.set(option.value, option);\n      continue;\n    }\n\n    optionsByValue.set(option.value, {\n      ...existing,\n      ...option,\n      children: mergeOptions([...(existing.children ?? []), ...(option.children ?? [])]),\n      totalChildCount: mergeTotalChildCount(existing.totalChildCount, option.totalChildCount),\n    });\n  }\n\n  return [...optionsByValue.values()];\n};\n\nconst findOptionByValue = (\n  options: (PvFilterPanelOption | null)[] | undefined,\n  value: string,\n): PvFilterPanelOption | undefined => {\n  for (const option of options ?? []) {\n    if (!option) continue;\n    if (option.value === value) return option;\n    const childMatch = findOptionByValue(option.children, value);\n    if (childMatch) return childMatch;\n  }\n  return undefined;\n};\n\nconst optionMatchesSelectedValue = (\n  option: PvFilterPanelOption | null | undefined,\n  selectedValue: string | null,\n  fallbackField: string,\n): boolean => {\n  if (!option || selectedValue === null) return false;\n  if (option.value === selectedValue) return true;\n  const rawValue = getFilterPanelOptionRawValue(option);\n  if (rawValue !== null && rawValue === selectedValue) return true;\n  if (filterPanelOptionMatchesRawValue(option, option.colField ?? fallbackField, selectedValue, fallbackField))\n    return true;\n  return option.children?.some((child) => optionMatchesSelectedValue(child, selectedValue, fallbackField)) ?? false;\n};\n\nconst mergeChildOptions = (\n  options: (PvFilterPanelOption | null)[],\n  parentId: string,\n  incomingOptions: (PvFilterPanelOption | null)[],\n): (PvFilterPanelOption | null)[] => {\n  const incomingParent = findOptionByValue(incomingOptions, parentId) ?? null;\n  const incomingChildren = incomingParent?.children ?? incomingOptions.filter(Boolean);\n\n  return options.map((option) => {\n    if (!option) return option;\n\n    if (option.value === parentId) {\n      return {\n        ...option,\n        children: mergeOptions([...(option.children ?? []), ...incomingChildren]),\n        totalChildCount: mergeTotalChildCount(option.totalChildCount, incomingParent?.totalChildCount),\n      };\n    }\n\n    if (!option.children?.length) return option;\n\n    return {\n      ...option,\n      children: mergeChildOptions(option.children, parentId, incomingOptions).filter(\n        (child): child is PvFilterPanelOption => Boolean(child),\n      ),\n    };\n  });\n};\n\nconst getChildPaginationKey = (field: string, parentId: string) => `${field}::${parentId}`;\n\nexport const createPvFilterStore = (): PvFilterStore => {\n  const filterModel = ref<PvFilterStore[\"filterModel\"][\"value\"]>(null);\n  const stagedFilterModel = ref<PvFilterStore[\"stagedFilterModel\"][\"value\"]>(null);\n  const filterModelType = ref<PvFilterStore[\"filterModelType\"][\"value\"]>();\n  const filterOptionsMap = ref<Record<string, (PvFilterPanelOption | null)[]>>({});\n  const filterSelectedValueMap = ref<Record<string, (string | null)[]>>({});\n  const filterSelectedMetadataMap = ref<Record<string, (PvFilterPanelOption | null)[]>>({});\n  const stagedFilterSelectedValueMap = ref<Record<string, (string | null)[]>>({});\n  const stagedFilterSelectedMetadataMap = ref<Record<string, (PvFilterPanelOption | null)[]>>({});\n  const filterSearchQueries = ref<Record<string, string | null | undefined>>({});\n  const filterFacetSelectionMap = ref<Record<string, Record<string, string[]>>>({});\n  const filterLoadingMap = ref<Record<string, boolean | undefined>>({});\n  const filterLoadingMoreMap = ref<Record<string, boolean | undefined>>({});\n  const filterHasMoreMap = ref<Record<string, boolean | undefined>>({});\n  const filterTotalCountMap = ref<Record<string, number | undefined>>({});\n  const filterChildHasMoreMap = ref<Record<string, boolean | undefined>>({});\n  const filterChildTotalCountMap = ref<Record<string, number | undefined>>({});\n  const filterRequestIdMap = ref<Record<string, number | undefined>>({});\n  const filterStaleMap = ref<Record<string, boolean | undefined>>({});\n  const filterOptionsHandler = ref<PvFilterPanelOptionsHandler | undefined>();\n  const loadingRequestCountMap = ref<Record<string, number | undefined>>({});\n\n  const setFilterOptionsHandler = (handler?: PvFilterPanelOptionsHandler) => {\n    filterOptionsHandler.value = handler;\n  };\n\n  const getFilterOptions = (field: string) => filterOptionsMap.value[field] ?? [];\n\n  const setFilterOptions = (field: string, options: (PvFilterPanelOption | null)[]) => {\n    filterOptionsMap.value[field] = options;\n  };\n\n  const getFilterSelectedValues = (field: string, staged = false) => {\n    const selectedValueMap = staged ? stagedFilterSelectedValueMap : filterSelectedValueMap;\n    return selectedValueMap.value[field] ?? [];\n  };\n\n  const setFilterSelectedValues = (field: string, values: (string | null)[], staged = false) => {\n    const selectedValueMap = staged ? stagedFilterSelectedValueMap : filterSelectedValueMap;\n    selectedValueMap.value[field] = values;\n  };\n\n  const initStagedFilterSelections = () => {\n    stagedFilterSelectedValueMap.value = cloneOptionMap(filterSelectedValueMap.value);\n    stagedFilterSelectedMetadataMap.value = cloneOptionMap(filterSelectedMetadataMap.value);\n  };\n\n  const clearStagedFilterSelections = () => {\n    stagedFilterSelectedValueMap.value = {};\n    stagedFilterSelectedMetadataMap.value = {};\n  };\n\n  const commitStagedFilterSelections = () => {\n    filterSelectedValueMap.value = cloneOptionMap(stagedFilterSelectedValueMap.value);\n    filterSelectedMetadataMap.value = cloneOptionMap(stagedFilterSelectedMetadataMap.value);\n    clearStagedFilterSelections();\n  };\n\n  const setFilterSearchQuery = (field: string, query: string | null | undefined) => {\n    filterSearchQueries.value[field] = query;\n  };\n\n  const setFilterFacetSelections = (field: string, facets: Record<string, string[]>) => {\n    filterFacetSelectionMap.value[field] = facets;\n  };\n\n  const getLoadingRequestCountKey = (field: string, isAppend: boolean) =>\n    `${isAppend ? \"append\" : \"initial\"}::${field}`;\n\n  const startLoading = (field: string, isAppend: boolean) => {\n    const loadingMap = isAppend ? filterLoadingMoreMap : filterLoadingMap;\n    const loadingKey = getLoadingRequestCountKey(field, isAppend);\n    loadingRequestCountMap.value[loadingKey] = (loadingRequestCountMap.value[loadingKey] ?? 0) + 1;\n    loadingMap.value[field] = true;\n    return loadingKey;\n  };\n\n  const stopLoading = (field: string, isAppend: boolean, loadingKey: string) => {\n    const loadingMap = isAppend ? filterLoadingMoreMap : filterLoadingMap;\n    const nextCount = Math.max(0, (loadingRequestCountMap.value[loadingKey] ?? 1) - 1);\n    if (nextCount > 0) {\n      loadingRequestCountMap.value[loadingKey] = nextCount;\n      return;\n    }\n\n    delete loadingRequestCountMap.value[loadingKey];\n    loadingMap.value[field] = false;\n  };\n\n  const fetchFilterOptions = async (params: PvFilterStoreFetchOptionsParams) => {\n    const handler = filterOptionsHandler.value;\n    if (!handler) return [];\n\n    const query = params.query ?? filterSearchQueries.value[params.field] ?? undefined;\n    filterSearchQueries.value[params.field] = query;\n\n    const parentOption = params.parentId\n      ? findOptionByValue(filterOptionsMap.value[params.field], params.parentId)\n      : undefined;\n    const offset =\n      params.offset ??\n      (params.parentId\n        ? (parentOption?.children?.length ?? 0)\n        : params.reason === \"load-more\"\n          ? (filterOptionsMap.value[params.field] ?? []).filter(Boolean).length\n          : 0);\n    const isAppend = params.reason === \"load-more\" || params.reason === \"child-load-more\";\n    const loadingKey = startLoading(params.field, isAppend);\n    const requestKey = params.parentId ? getChildPaginationKey(params.field, params.parentId) : params.field;\n    const requestId = (filterRequestIdMap.value[requestKey] ?? 0) + 1;\n    filterRequestIdMap.value[requestKey] = requestId;\n\n    try {\n      const rawResponse = await handler({\n        ...params,\n        facets: params.facets ?? filterFacetSelectionMap.value[params.field],\n        filterModel: params.filterModel ?? stagedFilterModel.value ?? filterModel.value,\n        offset,\n        query,\n        selectedValues: params.selectedValues ?? filterSelectedValueMap.value[params.field] ?? [],\n      });\n\n      if (filterRequestIdMap.value[requestKey] !== requestId) return [];\n\n      const response = normalizeOptionsResponse(rawResponse);\n      if (params.parentId) {\n        const childPaginationKey = getChildPaginationKey(params.field, params.parentId);\n        filterChildHasMoreMap.value[childPaginationKey] = response.hasMore;\n        filterChildTotalCountMap.value[childPaginationKey] = response.totalCount;\n      } else {\n        filterHasMoreMap.value[params.field] = response.hasMore;\n        filterTotalCountMap.value[params.field] = response.totalCount;\n      }\n\n      const selectedMetadata = filterSelectedMetadataMap.value[params.field] ?? [];\n      let nextOptions: (PvFilterPanelOption | null)[];\n\n      if (params.parentId) {\n        nextOptions = mergeChildOptions(filterOptionsMap.value[params.field] ?? [], params.parentId, response.values);\n      } else if (isAppend) {\n        nextOptions = mergeOptions([...(filterOptionsMap.value[params.field] ?? []), ...response.values]);\n      } else {\n        nextOptions = response.values;\n      }\n\n      for (const selectedOption of selectedMetadata) {\n        if (!selectedOption) continue;\n        const selectedValue = getFilterPanelOptionRawValue(selectedOption) ?? selectedOption.value;\n        const alreadyPresent = nextOptions.some((option) =>\n          optionMatchesSelectedValue(option, selectedValue, params.field),\n        );\n        if (!alreadyPresent) nextOptions.push(selectedOption);\n      }\n\n      filterOptionsMap.value[params.field] = nextOptions;\n      filterStaleMap.value[params.field] = false;\n      return nextOptions\n        .filter((option): option is PvFilterPanelOption => Boolean(option))\n        .map((option) => option.value);\n    } finally {\n      stopLoading(params.field, isAppend, loadingKey);\n    }\n  };\n\n  return {\n    clearStagedFilterSelections,\n    commitStagedFilterSelections,\n    fetchFilterOptions,\n    filterChildHasMoreMap,\n    filterChildTotalCountMap,\n    filterFacetSelectionMap,\n    filterHasMoreMap,\n    filterLoadingMap,\n    filterLoadingMoreMap,\n    filterModel,\n    filterModelType,\n    filterOptionsHandler,\n    filterOptionsMap,\n    filterRequestIdMap,\n    filterSearchQueries,\n    filterSelectedMetadataMap,\n    filterSelectedValueMap,\n    filterStaleMap,\n    filterTotalCountMap,\n    getFilterOptions,\n    getFilterSelectedValues,\n    initStagedFilterSelections,\n    setFilterFacetSelections,\n    setFilterOptions,\n    setFilterOptionsHandler,\n    setFilterSearchQuery,\n    setFilterSelectedValues,\n    stagedFilterModel,\n    stagedFilterSelectedMetadataMap,\n    stagedFilterSelectedValueMap,\n  };\n};\n\nexport const providePvFilterStore = (filterStore: PvFilterStore) => {\n  provide(PvFilterStoreKey, filterStore);\n};\n\nexport const useOptionalPvFilterStore = () => {\n  return inject(PvFilterStoreKey, null);\n};\n\nexport const usePvFilterStore = () => {\n  return useOptionalPvFilterStore() ?? createPvFilterStore();\n};\n","import {\n  computed,\n  getCurrentInstance,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  shallowReactive,\n  watch,\n  watchEffect,\n  type Ref,\n} from \"vue\";\nimport type { AdvancedFilterModel } from \"ag-grid-enterprise\";\nimport { isEqual } from \"es-toolkit\";\n\nimport { buildFilterSearchPlaceholder, formatSearchMatchSubText } from \"@/functions/filterSearchDisplay\";\nimport {\n  advancedFilterHasConditions,\n  createFilterPanelModelIndex,\n  getAdvancedFilterTypeForDataType,\n  updateBooleanFilter,\n  updateExistsFilter,\n  updateRangeFilter,\n  updateValueFilter,\n} from \"./advancedFilterModel\";\nimport {\n  buildFilterPanelAggregateModelFromSelectionState,\n  findFilterPanelOptionByValue,\n  getFilterPanelAggregateOptionSelectionStatus,\n  getFilterPanelAggregateSelectedValuesByField,\n  getFilterPanelAggregateSelectionOptions,\n  isFilterPanelAggregateColDef,\n  seedFilterPanelAggregateSelectionState,\n  updateFilterPanelAggregateSelectionState,\n} from \"./aggregateFilterModel\";\nimport {\n  formatFilterPanelRangeValue,\n  getFilterOptionLabel,\n  getFilterOptionResultCount,\n  resolveFilterPanelOptions,\n} from \"./filterOptionDisplay\";\nimport {\n  createFilterPanelScopedValue,\n  filterPanelOptionMatchesRawValue,\n  flattenFilterPanelOptions,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n} from \"./filterOptionValue\";\nimport { createPvFilterStore, useOptionalPvFilterStore } from \"./usePvFilterStore\";\nimport type {\n  PvFilterPanelAppliedGroup,\n  PvFilterPanelAppliedValue,\n  PvFilterPanelColDef,\n  PvFilterPanelControlChange,\n  PvFilterPanelCoreProps,\n  PvFilterPanelEmitFn,\n  PvFilterPanelFilterChangeReason,\n  PvFilterPanelFilterModel,\n  PvFilterPanelFilterType,\n  PvFilterPanelOption,\n  PvFilterPanelOptionsHandlerReason,\n  PvFilterPanelResolvedFilter,\n  PvFilterPanelSuggestion,\n  PvFilterStore,\n} from \"./types\";\nimport type { PvRangeValue } from \"@/components/base/PvRange/types\";\n\ntype StoreWithApplyFilterModel = PvFilterStore & {\n  applyFilterModel?: (model: PvFilterPanelFilterModel) => void;\n};\n\nconst RANGE_APPLIED_VALUE = \"__range__\";\nconst BOOLEAN_APPLIED_VALUE = \"__boolean__\";\nconst EXISTS_APPLIED_VALUE = \"__exists__\";\nconst FILTER_PANEL_TYPES = new Set<PvFilterPanelFilterType>([\"value\", \"range\", \"boolean\", \"exists\"]);\n\n/**\n * View-agnostic \"brain\" for filter panel presentations. Owns option/store wiring, the resolved filter\n * model, applied-filter derivation, and all mutation handlers. Presentation components (`PvFilterPanel`\n * drawer, `PvFilterModal`) consume this and supply their own layout + local view state.\n */\nexport function usePvFilterPanel(\n  props: PvFilterPanelCoreProps,\n  filterModel: Ref<PvFilterPanelFilterModel>,\n  emit: PvFilterPanelEmitFn,\n) {\n  const instance = getCurrentInstance();\n  const stagedFilterModel = ref<PvFilterPanelFilterModel>(filterModel.value);\n  const internalFilterStore = createPvFilterStore();\n  const injectedFilterStore = useOptionalPvFilterStore();\n  const warnedIgnoredStoreProps = new Set<string>();\n  const warnedFilterModelTypeIssues = new Set<string>();\n  /**\n   * Reactive so a debounced bound edit renders optimistically. Without it the panel would hand the\n   * range back its committed model, and editing the second bound before the timer fires would send\n   * a value built on a stale first bound.\n   */\n  const pendingRangeChanges = shallowReactive(\n    new Map<string, { colDef?: PvFilterPanelColDef; timer: number; value: PvRangeValue }>(),\n  );\n\n  const hasExternalFilterStore = computed(() => Boolean(props.filterStore ?? injectedFilterStore));\n  const isHandlerBackedInternalStore = computed(\n    () => !hasExternalFilterStore.value && Boolean(props.filterOptionsHandler),\n  );\n  const effectiveFilterStore = computed(() => props.filterStore ?? injectedFilterStore ?? internalFilterStore);\n  const usesInternalFilterStore = computed(() => effectiveFilterStore.value === internalFilterStore);\n  const isStoreMode = computed(() => hasExternalFilterStore.value || isHandlerBackedInternalStore.value);\n  const explicitFilterModelType = computed(\n    () => props.filterModelType ?? effectiveFilterStore.value?.filterModelType.value,\n  );\n  const effectiveFilterModelType = computed(() => explicitFilterModelType.value ?? \"advanced\");\n  const activeFilterModel = computed(() => {\n    const store = effectiveFilterStore.value;\n    if (store) return props.staged ? store.stagedFilterModel.value : store.filterModel.value;\n    return props.staged ? stagedFilterModel.value : filterModel.value;\n  });\n  const filterModelIndex = computed(() =>\n    createFilterPanelModelIndex(activeFilterModel.value, effectiveFilterModelType.value),\n  );\n\n  const applyCommittedFilterModelToStore = (store: PvFilterStore, nextFilterModel: PvFilterPanelFilterModel) => {\n    const applyFilterModel = (store as StoreWithApplyFilterModel).applyFilterModel;\n    if (typeof applyFilterModel === \"function\") {\n      applyFilterModel(nextFilterModel);\n      return;\n    }\n\n    store.filterModel.value = nextFilterModel;\n  };\n\n  const setActiveFilterModelInStore = (store: PvFilterStore, nextFilterModel: PvFilterPanelFilterModel) => {\n    if (props.staged) {\n      store.stagedFilterModel.value = nextFilterModel;\n      return;\n    }\n\n    applyCommittedFilterModelToStore(store, nextFilterModel);\n  };\n\n  watch(\n    () => props.filterOptionsHandler,\n    (handler) => {\n      internalFilterStore.setFilterOptionsHandler(handler);\n    },\n    { immediate: true },\n  );\n\n  watch(\n    [() => props.filterOptions, usesInternalFilterStore, () => props.filterOptionsHandler],\n    ([filterOptions, usesInternalStore, handler]) => {\n      if (!usesInternalStore || handler) return;\n      internalFilterStore.filterOptionsMap.value = Object.fromEntries(\n        Object.entries(filterOptions).map(([field, options]) => [field, [...options]]),\n      );\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [() => props.filterHasMoreMap, usesInternalFilterStore, () => props.filterOptionsHandler],\n    ([filterHasMoreMap, usesInternalStore, handler]) => {\n      if (usesInternalStore && !handler) internalFilterStore.filterHasMoreMap.value = { ...filterHasMoreMap };\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [() => props.filterLoadingMap, usesInternalFilterStore, () => props.filterOptionsHandler],\n    ([filterLoadingMap, usesInternalStore, handler]) => {\n      if (usesInternalStore && !handler) internalFilterStore.filterLoadingMap.value = { ...filterLoadingMap };\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [() => props.filterLoadingMoreMap, usesInternalFilterStore, () => props.filterOptionsHandler],\n    ([filterLoadingMoreMap, usesInternalStore, handler]) => {\n      if (usesInternalStore && !handler) {\n        internalFilterStore.filterLoadingMoreMap.value = { ...filterLoadingMoreMap };\n      }\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [() => props.filterSearchQueries, usesInternalFilterStore, () => props.filterOptionsHandler],\n    ([filterSearchQueries, usesInternalStore, handler]) => {\n      if (usesInternalStore && !handler) internalFilterStore.filterSearchQueries.value = { ...filterSearchQueries };\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [filterModel, usesInternalFilterStore, () => props.staged],\n    ([nextFilterModel, usesInternalStore]) => {\n      if (!usesInternalStore) return;\n      if (props.staged) stagedFilterModel.value = nextFilterModel;\n      internalFilterStore.filterModel.value = nextFilterModel;\n      if (props.staged) internalFilterStore.stagedFilterModel.value = nextFilterModel;\n    },\n    { deep: true, immediate: true },\n  );\n\n  watch(\n    [() => props.staged, effectiveFilterStore],\n    ([isStaged]) => {\n      if (isStaged) {\n        stagedFilterModel.value = filterModel.value;\n        const store = effectiveFilterStore.value;\n        if (store) {\n          store.stagedFilterModel.value = store.filterModel.value;\n          store.initStagedFilterSelections();\n        }\n      }\n    },\n    { immediate: true },\n  );\n\n  const warnIgnoredStoreProp = (propName: string, shouldWarn: boolean) => {\n    if (!isStoreMode.value || !shouldWarn || warnedIgnoredStoreProps.has(propName)) return;\n    console.warn(`PvFilterPanel: \"${propName}\" is ignored when filterStore/filterOptionsHandler store mode is active.`);\n    warnedIgnoredStoreProps.add(propName);\n  };\n\n  const warnFilterModelTypeIssue = (key: string, message: string) => {\n    if (warnedFilterModelTypeIssues.has(key)) return;\n    console.warn(message);\n    warnedFilterModelTypeIssues.add(key);\n  };\n\n  const hasProvidedFilterModelProp = () => {\n    const vnodeProps = instance?.vnode.props ?? {};\n    return (\n      Object.prototype.hasOwnProperty.call(vnodeProps, \"filterModel\") ||\n      Object.prototype.hasOwnProperty.call(vnodeProps, \"filter-model\")\n    );\n  };\n\n  const isAdvancedFilterModelShape = (model: PvFilterPanelFilterModel) => {\n    return Boolean(model && typeof model === \"object\" && \"filterType\" in model);\n  };\n\n  const warnIfModelShapeMismatchesType = (model: PvFilterPanelFilterModel) => {\n    if (!model) return;\n    const isAdvancedShape = isAdvancedFilterModelShape(model);\n    if (effectiveFilterModelType.value === \"advanced\" && !isAdvancedShape) {\n      warnFilterModelTypeIssue(\n        \"regular-model-in-advanced-mode\",\n        'PvFilterPanel: produced a regular FilterModel while filterModelType is \"advanced\".',\n      );\n    }\n    if (effectiveFilterModelType.value === \"regular\" && isAdvancedShape) {\n      warnFilterModelTypeIssue(\n        \"advanced-model-in-regular-mode\",\n        'PvFilterPanel: produced an AdvancedFilterModel while filterModelType is \"regular\".',\n      );\n    }\n  };\n\n  watchEffect(() => {\n    warnIgnoredStoreProp(\n      \"filterModel\",\n      Boolean((props.filterStore || injectedFilterStore) && filterModel.value !== null),\n    );\n    warnIgnoredStoreProp(\"filterOptions\", Object.keys(props.filterOptions).length > 0);\n    warnIgnoredStoreProp(\"filterLoadingMap\", Object.keys(props.filterLoadingMap).length > 0);\n    warnIgnoredStoreProp(\"filterLoadingMoreMap\", Object.keys(props.filterLoadingMoreMap).length > 0);\n    warnIgnoredStoreProp(\"filterHasMoreMap\", Object.keys(props.filterHasMoreMap).length > 0);\n    warnIgnoredStoreProp(\"filterSearchQueries\", Object.keys(props.filterSearchQueries).length > 0);\n    warnIgnoredStoreProp(\"filterOptionsHandler\", Boolean(props.filterStore && props.filterOptionsHandler));\n\n    const hasExternalAmbiguousModel = Boolean(\n      (props.filterStore || injectedFilterStore) && activeFilterModel.value !== null,\n    );\n    if (\n      (import.meta as ImportMeta & { env?: { DEV?: boolean } }).env?.DEV &&\n      !explicitFilterModelType.value &&\n      activeFilterModel.value !== null &&\n      !isAdvancedFilterModelShape(activeFilterModel.value) &&\n      (hasProvidedFilterModelProp() || hasExternalAmbiguousModel)\n    ) {\n      warnFilterModelTypeIssue(\n        \"missing-filter-model-type\",\n        'PvFilterPanel: filterModelType was not provided by props or filterStore; defaulting to \"advanced\".',\n      );\n    }\n  });\n\n  const getColDefContext = (colDef: PvFilterPanelColDef) => colDef.context ?? {};\n  const getColDefKey = (colDef: PvFilterPanelColDef) => colDef.colId || colDef.field || \"\";\n  const getFiniteNumber = (value: unknown) => (typeof value === \"number\" && Number.isFinite(value) ? value : null);\n\n  const inferFilterType = (colDef: PvFilterPanelColDef): PvFilterPanelFilterType | undefined => {\n    const context = getColDefContext(colDef);\n    const filterType = context.filterPanelType;\n    if (filterType && FILTER_PANEL_TYPES.has(filterType)) return filterType;\n    if (context.filterPanelRange) return \"range\";\n    if (context.dataType === \"boolean\") return \"boolean\";\n    if (colDef.filter) return \"value\";\n    return undefined;\n  };\n\n  const getFilterType = (colDef: PvFilterPanelColDef): PvFilterPanelFilterType => inferFilterType(colDef) ?? \"value\";\n\n  const getFilterCategory = (colDef: PvFilterPanelColDef) => {\n    return getColDefContext(colDef).filterPanelCategory ?? null;\n  };\n\n  const getValueLabels = (colDef: PvFilterPanelColDef): Record<string, string> | null => {\n    const valueLabels = getColDefContext(colDef).filterPanelValueLabels;\n    if (typeof valueLabels !== \"object\" || valueLabels === null || Array.isArray(valueLabels)) return null;\n\n    return Object.fromEntries(\n      Object.entries(valueLabels).flatMap(([key, value]) => (typeof value === \"string\" ? [[key, value]] : [])),\n    );\n  };\n\n  const isFilterableColumn = (colDef: PvFilterPanelColDef) => {\n    const context = getColDefContext(colDef);\n    const key = getColDefKey(colDef);\n    if (!key || context.filterPanelHidden === true) return false;\n    if (context.devOnly && !props.devMode) return false;\n    if (\n      props.autoHideRelatedFilterFields !== false &&\n      context.filterPanelHidden !== false &&\n      autoHiddenFilterFields.value.has(key)\n    ) {\n      return false;\n    }\n    return Boolean(inferFilterType(colDef));\n  };\n\n  const filterOptionsFor = (field: string) => {\n    return (effectiveFilterStore.value.filterOptionsMap.value[field] ?? []).filter(\n      (option): option is PvFilterPanelOption => Boolean(option),\n    );\n  };\n\n  const selectedMetadataOptionsFor = (field: string) => {\n    const store = effectiveFilterStore.value;\n    const metadataMap = props.staged ? store.stagedFilterSelectedMetadataMap : store.filterSelectedMetadataMap;\n    return (metadataMap.value[field] ?? []).filter((option): option is PvFilterPanelOption => Boolean(option));\n  };\n\n  const filterHasMoreFor = (field: string) => effectiveFilterStore.value.filterHasMoreMap.value[field] ?? false;\n  const filterLoadingFor = (field: string) => effectiveFilterStore.value.filterLoadingMap.value[field] ?? false;\n  const filterLoadingMoreFor = (field: string) => effectiveFilterStore.value.filterLoadingMoreMap.value[field] ?? false;\n  const filterSearchQueryFor = (field: string) => effectiveFilterStore.value.filterSearchQueries.value[field] ?? \"\";\n\n  const suggestionOptionsFor = (field: string): PvFilterPanelOption[] => {\n    return props.filterSuggestions.flatMap((suggestion) => {\n      if (suggestion.field !== field || suggestion.filter.type !== \"value\") return [];\n      return [suggestion.option ?? { label: suggestion.label, value: suggestion.filter.value }];\n    });\n  };\n\n  const knownOptionsFor = (field: string) => [\n    ...suggestionOptionsFor(field),\n    ...filterOptionsFor(field),\n    ...selectedMetadataOptionsFor(field),\n  ];\n\n  const flattenAggregateFieldHierarchy = (hierarchy: unknown): string[] => {\n    if (typeof hierarchy !== \"object\" || hierarchy === null || !(\"field\" in hierarchy)) return [];\n    const node = hierarchy as { children?: unknown[]; field?: unknown };\n    const field = typeof node.field === \"string\" ? node.field : null;\n    const children = Array.isArray(node.children) ? node.children.flatMap(flattenAggregateFieldHierarchy) : [];\n    return field ? [field, ...children] : children;\n  };\n\n  const autoHiddenFilterFields = computed(() => {\n    const fields = new Set<string>();\n    for (const colDef of props.colDefs) {\n      const context = getColDefContext(colDef);\n      for (const field of Array.isArray(context.aggregateFields) ? context.aggregateFields : []) {\n        if (field) fields.add(field);\n      }\n      for (const field of flattenAggregateFieldHierarchy(context.aggregateFieldHierarchy)) {\n        if (field) fields.add(field);\n      }\n      for (const field of context.filterGroup?.fields ?? []) {\n        if (field) fields.add(field);\n      }\n    }\n    return fields;\n  });\n\n  const getRepresentedFields = (colDef: PvFilterPanelColDef) => {\n    const field = getColDefKey(colDef);\n    const context = getColDefContext(colDef);\n    const aggregateFields = Array.isArray(context.aggregateFields) ? context.aggregateFields.filter(Boolean) : [];\n    const hierarchyFields = flattenAggregateFieldHierarchy(context.aggregateFieldHierarchy);\n    return Array.from(new Set([field, ...aggregateFields, ...hierarchyFields].filter(Boolean)));\n  };\n\n  const isAggregateValueFilter = (colDef: PvFilterPanelColDef) => {\n    return effectiveFilterModelType.value === \"advanced\" && isFilterPanelAggregateColDef(colDef);\n  };\n\n  const getSelectedRawValuesByField = (colDef: PvFilterPanelColDef, options?: (PvFilterPanelOption | null)[]) => {\n    if (isAggregateValueFilter(colDef)) {\n      return getFilterPanelAggregateSelectedValuesByField({\n        colDef,\n        model: activeFilterModel.value as AdvancedFilterModel | null,\n        options,\n      });\n    }\n\n    return new Map(\n      getRepresentedFields(colDef).map((representedField) => [\n        representedField,\n        filterModelIndex.value.get(representedField)?.values ?? [],\n      ]),\n    );\n  };\n\n  const getSelectedFallbackOptions = (\n    field: string,\n    colDef: PvFilterPanelColDef,\n    selectedRawValuesByField: Map<string, string[]>,\n    options: PvFilterPanelOption[],\n  ): PvFilterPanelOption[] => {\n    const matchedSelections = new Set<string>();\n\n    for (const option of flattenFilterPanelOptions(options)) {\n      for (const [representedField, rawValues] of selectedRawValuesByField) {\n        for (const rawValue of rawValues) {\n          if (filterPanelOptionMatchesRawValue(option, representedField, rawValue, field)) {\n            matchedSelections.add(`${representedField}:${rawValue}`);\n          }\n        }\n      }\n    }\n\n    return [...selectedRawValuesByField.entries()].flatMap(([representedField, rawValues]) =>\n      rawValues.flatMap((rawValue) => {\n        if (matchedSelections.has(`${representedField}:${rawValue}`)) return [];\n        return [\n          {\n            colField: representedField === field ? undefined : representedField,\n            label: rawValue,\n            metadata: { rawValue },\n            value: representedField === field ? rawValue : createFilterPanelScopedValue(representedField, rawValue),\n          } satisfies PvFilterPanelOption,\n        ];\n      }),\n    );\n  };\n\n  const getSelectedValuesForFilter = (\n    field: string,\n    selectedRawValuesByField: Map<string, string[]>,\n    options: PvFilterPanelOption[],\n  ) => {\n    const selectedValues = new Set<string>();\n\n    for (const option of flattenFilterPanelOptions(options)) {\n      const targetField = getFilterPanelOptionField(option, field);\n      const rawValue = getFilterPanelOptionRawValue(option);\n      if (rawValue !== null && selectedRawValuesByField.get(targetField)?.includes(rawValue)) {\n        selectedValues.add(option.value);\n      }\n    }\n\n    return Array.from(selectedValues);\n  };\n\n  const getFocusedValuesByField = (colDef: PvFilterPanelColDef) => {\n    return Object.fromEntries(getRepresentedFields(colDef).map((field) => [field, props.focusedValues[field] ?? []]));\n  };\n\n  const findColDef = (field: string) =>\n    props.colDefs.find((colDef) => getColDefKey(colDef) === field || colDef.field === field || colDef.colId === field);\n\n  const getColDefDisplayName = (field: string) => findColDef(field)?.headerName ?? field;\n\n  const getFilterSearchPlaceholder = (colDef: PvFilterPanelColDef) => {\n    const context = getColDefContext(colDef);\n    if (typeof context.filterPanelSearchPlaceholder === \"string\") return context.filterPanelSearchPlaceholder;\n\n    return buildFilterSearchPlaceholder(getColDefKey(colDef), context.queryColIds, getColDefDisplayName);\n  };\n\n  const getSearchMatchSubText = (option: PvFilterPanelOption, colDef: PvFilterPanelColDef) =>\n    formatSearchMatchSubText({\n      fallbackSubText: option.subText,\n      getDisplayName: getColDefDisplayName,\n      matchedField: option.matchedField,\n      matchedValue: option.matchedValue,\n      primaryText: option.label,\n      showPrefix: getColDefContext(colDef).showSearchMatchSubTextPrefix !== false,\n    });\n\n  const decorateSearchMatchSubText = (\n    options: PvFilterPanelOption[],\n    colDef: PvFilterPanelColDef,\n  ): PvFilterPanelOption[] => {\n    return options.map((option) => ({\n      ...option,\n      children: option.children?.length ? decorateSearchMatchSubText(option.children, colDef) : option.children,\n      subText: getSearchMatchSubText(option, colDef),\n    }));\n  };\n\n  const getFilterGroupOptions = (colDef: PvFilterPanelColDef) => {\n    const filterGroup = getColDefContext(colDef).filterGroup;\n    if (!filterGroup?.fields.length) return undefined;\n\n    return filterGroup.fields.map((field) => ({\n      field,\n      isActive: filterModelIndex.value.get(field)?.booleanValue === true,\n      label: findColDef(field)?.headerName ?? field,\n    }));\n  };\n\n  const findResolvedFilter = (field: string) =>\n    resolvedFilters.value.find((filter) => filter.key === field) ??\n    resolvedFilters.value.find((filter) => getRepresentedFields(filter.colDef).includes(field));\n\n  const findKnownOptionForValue = (filterKey: string, field: string, value: string) => {\n    const filter = findResolvedFilter(filterKey);\n    return flattenFilterPanelOptions(filter?.knownOptions ?? []).find((option) => {\n      return option.value === value || filterPanelOptionMatchesRawValue(option, field, value, filterKey);\n    });\n  };\n\n  const resolvedFilters = computed<PvFilterPanelResolvedFilter[]>(() => {\n    return props.colDefs.filter(isFilterableColumn).map((colDef) => {\n      const field = getColDefKey(colDef);\n      const context = getColDefContext(colDef);\n      const type = getFilterType(colDef);\n      const rawFilterOptions = decorateSearchMatchSubText(filterOptionsFor(field), colDef);\n      const baseKnownOptions = decorateSearchMatchSubText(knownOptionsFor(field), colDef);\n      const baseFilter = {\n        canRemoveFocus: props.canRemoveFocus,\n        category: getFilterCategory(colDef),\n        clientFiltering: context.filterOptionsClientFiltering !== false,\n        colDef,\n        controlled: context.filterPanelControlled === true,\n        dataType: context.dataType ?? null,\n        disabled: props.readOnly,\n        displayPreferencesIcon: props.displayPreferencesIcon,\n        emptyResultsRenderer: context.emptyFilterResultsRenderer,\n        existsLabel: context.filterPanelExistsLabel,\n        filterFooterRenderer: context.filterFooterRenderer,\n        filterGroupLabel: context.filterGroup?.label,\n        filterGroupOptions: getFilterGroupOptions(colDef),\n        filterHeaderRenderer: context.filterHeaderRenderer,\n        filterOptionsRenderer: context.filterOptionsRenderer,\n        filterSectionHeaderRenderer: context.filterSectionHeaderRenderer,\n        filterSectionDefs: context.filterSectionDefs,\n        filterOptionsSortDescription: context.filterOptionsSortDescription,\n        filterOptionsSortTooltip: context.filterOptionsSortTooltip,\n        focusFieldLabels: Object.fromEntries(\n          getRepresentedFields(colDef).map((focusField) => [focusField, getColDefDisplayName(focusField)]),\n        ),\n        focusableFields: props.focusableFields,\n        focusText: props.focusText,\n        hideOptionsSortDescription: context.filterPanelHideOptionsSortDescription,\n        hideSearch: context.filterPanelHideSearch,\n        focusedValues: props.focusedValues[field] ?? [],\n        focusedValuesByField: getFocusedValuesByField(colDef),\n        hasMore: filterHasMoreFor(field),\n        isAggregate: isAggregateValueFilter(colDef),\n        isFocusable:\n          props.enableFocusView &&\n          (!props.focusableFields.length ||\n            getRepresentedFields(colDef).some((focusField) => props.focusableFields.includes(focusField))),\n        isLoading: filterLoadingFor(field),\n        isLoadingMore: filterLoadingMoreFor(field),\n        isOpen: false,\n        key: field,\n        knownOptions: baseKnownOptions,\n        label: colDef.headerName || field,\n        loadingText: context.filterOptionsLoadingText,\n        rangeInputIcon: context.filterPanelRange?.inputIcon ?? null,\n        rangeMax: getFiniteNumber(context.filterPanelRange?.max),\n        rangeMin: getFiniteNumber(context.filterPanelRange?.min),\n        rangeScale: context.filterPanelRange?.scale,\n        rangeSliderStep: getFiniteNumber(context.filterPanelRange?.sliderStep),\n        rangeStep: getFiniteNumber(context.filterPanelRange?.step),\n        searchPlaceholder: getFilterSearchPlaceholder(colDef),\n        searchQuery: filterSearchQueryFor(field) ?? \"\",\n        singleSelect: context.filterPanelSingleSelect === true,\n        type,\n        valueDecimals: context.valueDecimals ?? null,\n        valueLabels: getValueLabels(colDef),\n      } satisfies PvFilterPanelResolvedFilter;\n\n      if (type === \"range\") {\n        return {\n          ...baseFilter,\n          rangeValue: pendingRangeChanges.get(field)?.value ??\n            filterModelIndex.value.get(field)?.rangeValue ?? { max: null, min: null },\n        };\n      }\n\n      if (type === \"boolean\") {\n        return {\n          ...baseFilter,\n          booleanValue: filterModelIndex.value.get(field)?.booleanValue ?? null,\n        };\n      }\n\n      if (type === \"exists\") {\n        return {\n          ...baseFilter,\n          existsValue: filterModelIndex.value.get(field)?.existsValue ?? false,\n        };\n      }\n\n      const controlledValues = props.controlledValues[field] ?? [];\n      const selectedRawValuesByField = baseFilter.controlled\n        ? new Map([[field, controlledValues]])\n        : getSelectedRawValuesByField(colDef, baseKnownOptions);\n      const fallbackOptions = getSelectedFallbackOptions(field, colDef, selectedRawValuesByField, baseKnownOptions);\n      const rawKnownOptions = [...baseKnownOptions, ...fallbackOptions];\n      const knownOptions = baseFilter.isAggregate\n        ? rawKnownOptions\n        : resolveFilterPanelOptions(rawKnownOptions, rawKnownOptions, colDef);\n      const filterOptions = baseFilter.isAggregate\n        ? rawFilterOptions\n        : resolveFilterPanelOptions(rawFilterOptions, rawKnownOptions, colDef);\n      const aggregateSelectionState = isAggregateValueFilter(colDef)\n        ? seedFilterPanelAggregateSelectionState({\n            colDef,\n            model: activeFilterModel.value as AdvancedFilterModel | null,\n            options: knownOptions,\n          })\n        : undefined;\n\n      return {\n        ...baseFilter,\n        aggregateSelectionState,\n        knownOptions,\n        options: filterOptions,\n        selectedValues: baseFilter.controlled\n          ? controlledValues\n          : aggregateSelectionState\n            ? aggregateSelectionState.flatMap((node) => (node.state === \"selected\" ? [node.id] : []))\n            : getSelectedValuesForFilter(field, selectedRawValuesByField, knownOptions),\n      };\n    });\n  });\n\n  watch(\n    resolvedFilters,\n    (filters) => {\n      const store = effectiveFilterStore.value;\n      const selectedMetadataMap = props.staged\n        ? store.stagedFilterSelectedMetadataMap\n        : store.filterSelectedMetadataMap;\n      let nextMap = selectedMetadataMap.value;\n\n      const namedValueFilters = filters.filter(\n        (filter) =>\n          filter.type === \"value\" &&\n          !filter.controlled &&\n          !filter.isAggregate &&\n          Boolean(filter.colDef.context?.metadataDisplayFields?.length),\n      );\n      for (const filter of namedValueFilters) {\n        const selectedValueSet = new Set(filter.selectedValues ?? []);\n        // The first copy wins: known options list current options before cached selections.\n        const selectedOptionByValue = new Map<string, PvFilterPanelOption>();\n        for (const option of flattenFilterPanelOptions(filter.knownOptions ?? [])) {\n          if (selectedValueSet.has(option.value) && !selectedOptionByValue.has(option.value)) {\n            selectedOptionByValue.set(option.value, option);\n          }\n        }\n        const nextMetadata = [...selectedOptionByValue.values()];\n        if (!isEqual(selectedMetadataMap.value[filter.key] ?? [], nextMetadata)) {\n          if (nextMap === selectedMetadataMap.value) nextMap = { ...nextMap };\n          nextMap[filter.key] = nextMetadata;\n        }\n      }\n\n      if (nextMap !== selectedMetadataMap.value) selectedMetadataMap.value = nextMap;\n    },\n    { immediate: true },\n  );\n\n  const appliedGroups = computed<PvFilterPanelAppliedGroup[]>(() => {\n    return resolvedFilters.value.flatMap((filter) => {\n      if (filter.controlled) return [];\n      const values = getAppliedValues(filter);\n      if (!values.length) return [];\n      return [\n        {\n          key: filter.key,\n          label: filter.label,\n          values,\n        },\n      ];\n    });\n  });\n  const appliedCount = computed(() => appliedGroups.value.reduce((sum, group) => sum + group.values.length, 0));\n  const hasActiveFilters = computed(() =>\n    advancedFilterHasConditions(activeFilterModel.value, effectiveFilterModelType.value),\n  );\n  const showClearAll = computed(() => hasActiveFilters.value || appliedCount.value > 0);\n\n  const isSuggestionActive = (suggestion: PvFilterPanelSuggestion) => {\n    const filter = findResolvedFilter(suggestion.field);\n    if (!filter || filter.type !== suggestion.filter.type) return true;\n\n    if (suggestion.filter.type === \"value\") {\n      if (filter.isAggregate && suggestion.option) {\n        const { selected } = getFilterPanelAggregateOptionSelectionStatus({\n          option: suggestion.option,\n          options: filter.knownOptions ?? [],\n          state: filter.aggregateSelectionState ?? [],\n        });\n        return suggestion.filter.checked ? selected : !selected;\n      }\n\n      const selectedValueSet = new Set(filter.selectedValues ?? []);\n      const optionValue = suggestion.option?.value ?? suggestion.filter.value;\n      const rawValue = suggestion.option ? getFilterPanelOptionRawValue(suggestion.option) : suggestion.filter.value;\n      const isSelected = selectedValueSet.has(optionValue) || (rawValue !== null && selectedValueSet.has(rawValue));\n      return suggestion.filter.checked ? isSelected : !isSelected;\n    }\n\n    if (suggestion.filter.type === \"range\") {\n      return (\n        filter.rangeValue?.min === suggestion.filter.value.min && filter.rangeValue?.max === suggestion.filter.value.max\n      );\n    }\n\n    if (suggestion.filter.type === \"boolean\") {\n      return filter.booleanValue === suggestion.filter.value;\n    }\n\n    return (filter.existsValue ?? false) === suggestion.filter.value;\n  };\n\n  const visibleSuggestions = computed(() =>\n    props.filterSuggestions.filter((suggestion) => !isSuggestionActive(suggestion)),\n  );\n\n  const getSuggestionKey = (suggestion: PvFilterPanelSuggestion) => {\n    if (suggestion.key) return suggestion.key;\n\n    const filterValue = \"value\" in suggestion.filter ? suggestion.filter.value : \"\";\n    return `${suggestion.field}-${suggestion.filter.type}-${JSON.stringify(filterValue)}`;\n  };\n\n  const updateStoreSelectedValues = (\n    filterKey: string,\n    field: string,\n    nextValues: string[],\n    selectedOption?: PvFilterPanelOption,\n  ) => {\n    const store = effectiveFilterStore.value;\n    if (!store) return;\n\n    store.setFilterSelectedValues(field, nextValues, props.staged);\n\n    const selectedMetadataMap = props.staged ? store.stagedFilterSelectedMetadataMap : store.filterSelectedMetadataMap;\n    const selectedMetadata = selectedMetadataMap.value[filterKey] ?? [];\n    const nextSelectedValueSet = new Set(nextValues);\n    const nextMetadata = selectedMetadata.filter((option): option is PvFilterPanelOption => {\n      if (!option) return false;\n      const optionField = getFilterPanelOptionField(option, filterKey);\n      const optionValue = getFilterPanelOptionRawValue(option) ?? option.value;\n      return optionField !== field || nextSelectedValueSet.has(optionValue);\n    });\n\n    if (selectedOption) {\n      const selectedOptionValue = getFilterPanelOptionRawValue(selectedOption) ?? selectedOption.value;\n      const selectedOptionField = getFilterPanelOptionField(selectedOption, filterKey);\n      const existingIndex = nextMetadata.findIndex((option) => {\n        const optionValue = getFilterPanelOptionRawValue(option) ?? option.value;\n        return (\n          getFilterPanelOptionField(option, filterKey) === selectedOptionField && optionValue === selectedOptionValue\n        );\n      });\n      if (existingIndex === -1) nextMetadata.push(selectedOption);\n      else nextMetadata[existingIndex] = selectedOption;\n    }\n\n    selectedMetadataMap.value[filterKey] = nextMetadata;\n  };\n\n  const updateStoreAggregateSelections = (\n    filter: PvFilterPanelResolvedFilter,\n    state = filter.aggregateSelectionState ?? [],\n  ) => {\n    const store = effectiveFilterStore.value;\n    if (!store || !filter.isAggregate) return;\n\n    const selectedIds = state.flatMap((node) => (node.state === \"selected\" ? [node.id] : []));\n    store.setFilterSelectedValues(filter.key, selectedIds, props.staged);\n\n    const selectedMetadataMap = props.staged ? store.stagedFilterSelectedMetadataMap : store.filterSelectedMetadataMap;\n    selectedMetadataMap.value[filter.key] = getFilterPanelAggregateSelectionOptions({\n      options: filter.knownOptions ?? [],\n      state,\n    });\n  };\n\n  const markStoreValueFiltersStale = (changedField?: string) => {\n    if (!isStoreMode.value) return;\n\n    const store = effectiveFilterStore.value;\n    const changedFields = new Set<string>();\n\n    if (changedField) {\n      changedFields.add(changedField);\n      const changedFilter = findResolvedFilter(changedField);\n      if (changedFilter) {\n        changedFields.add(changedFilter.key);\n        getRepresentedFields(changedFilter.colDef).forEach((field) => changedFields.add(field));\n      }\n    }\n\n    for (const filter of resolvedFilters.value) {\n      if (filter.type !== \"value\") continue;\n\n      const isChangedFilter = changedField\n        ? changedFields.has(filter.key) || getRepresentedFields(filter.colDef).some((field) => changedFields.has(field))\n        : false;\n\n      if (!isChangedFilter) store.filterStaleMap.value[filter.key] = true;\n    }\n  };\n\n  const emitFilterChange = (\n    nextFilterModel: PvFilterPanelFilterModel,\n    reason: PvFilterPanelFilterChangeReason,\n    field?: string,\n    type?: PvFilterPanelFilterType,\n  ) => {\n    warnIfModelShapeMismatchesType(nextFilterModel);\n\n    const previousFilterModel = activeFilterModel.value;\n    const store = effectiveFilterStore.value;\n    if (store) {\n      setActiveFilterModelInStore(store, nextFilterModel);\n      if (nextFilterModel === null) {\n        if (props.staged) {\n          store.stagedFilterSelectedValueMap.value = {};\n          store.stagedFilterSelectedMetadataMap.value = {};\n        } else {\n          store.filterSelectedValueMap.value = {};\n          store.filterSelectedMetadataMap.value = {};\n        }\n      }\n    } else if (props.staged) {\n      stagedFilterModel.value = nextFilterModel;\n    }\n\n    if (!props.filterStore && !injectedFilterStore && !props.staged) filterModel.value = nextFilterModel;\n    markStoreValueFiltersStale(field);\n    const filter = field ? findResolvedFilter(field) : undefined;\n    emit(\"filter-change\", {\n      colDef: filter?.colDef,\n      field,\n      filterModel: nextFilterModel,\n      previousFilterModel,\n      reason,\n      type,\n    });\n  };\n\n  const getAppliedBooleanValue = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    const value = filter.booleanValue ?? null;\n    if (value === null) return [];\n\n    return [\n      {\n        label: filter.valueLabels?.[String(value)] ?? (value ? \"Yes\" : \"No\"),\n        type: \"boolean\",\n        value: BOOLEAN_APPLIED_VALUE,\n      },\n    ];\n  };\n\n  const getAppliedExistsValue = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    if (!filter.existsValue) return [];\n\n    return [\n      {\n        label: filter.existsLabel ?? `Has ${filter.label}`,\n        type: \"exists\",\n        value: EXISTS_APPLIED_VALUE,\n      },\n    ];\n  };\n\n  const getAppliedRangeValue = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    const rangeValue = filter.rangeValue ?? { max: null, min: null };\n    if (rangeValue.min === null && rangeValue.max === null) return [];\n\n    return [\n      {\n        label: formatFilterPanelRangeValue(rangeValue.min, rangeValue.max, {\n          dataType: filter.dataType,\n          valueDecimals: filter.valueDecimals,\n        }),\n        type: \"range\",\n        value: RANGE_APPLIED_VALUE,\n      },\n    ];\n  };\n\n  const getAppliedValueFilterValue = (\n    filter: PvFilterPanelResolvedFilter,\n    value: string,\n    optionByValue: Map<string, PvFilterPanelOption>,\n  ): PvFilterPanelAppliedValue => {\n    const option = optionByValue.get(value) ?? null;\n\n    return {\n      field: option ? getFilterPanelOptionField(option, filter.key) : undefined,\n      label: option ? getFilterOptionLabel(option, filter.colDef) : value,\n      resultCount: getFilterOptionResultCount(option),\n      subText: option?.subText,\n      subduedText: option?.subduedText,\n      type: \"value\",\n      value: option ? (getFilterPanelOptionRawValue(option) ?? option.value) : value,\n    };\n  };\n\n  const getAppliedFilterGroupValues = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    return (filter.filterGroupOptions ?? []).flatMap((groupOption) => {\n      if (!groupOption.isActive) return [];\n      return [\n        {\n          field: groupOption.field,\n          label: groupOption.label,\n          type: \"boolean\" as const,\n          value: BOOLEAN_APPLIED_VALUE,\n        },\n      ];\n    });\n  };\n\n  const getAppliedAggregateValues = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    return getFilterPanelAggregateSelectionOptions({\n      options: filter.knownOptions ?? [],\n      state: filter.aggregateSelectionState ?? [],\n    }).map((option) => ({\n      field: filter.key,\n      label: getFilterOptionLabel(option, filter.colDef),\n      resultCount: getFilterOptionResultCount(option),\n      subText: option.subText,\n      subduedText: option.subduedText,\n      type: \"value\" as const,\n      value: option.value,\n    }));\n  };\n\n  const getAppliedValues = (filter: PvFilterPanelResolvedFilter): PvFilterPanelAppliedValue[] => {\n    if (filter.controlled) return [];\n    if (filter.type === \"range\") return getAppliedRangeValue(filter);\n    if (filter.type === \"boolean\") return getAppliedBooleanValue(filter);\n    if (filter.type === \"exists\") return getAppliedExistsValue(filter);\n    if (filter.isAggregate) return [...getAppliedAggregateValues(filter), ...getAppliedFilterGroupValues(filter)];\n\n    const optionByValue = new Map(\n      flattenFilterPanelOptions(filter.knownOptions ?? []).map((option) => [option.value, option]),\n    );\n    return [\n      ...(filter.selectedValues ?? []).map((value) => getAppliedValueFilterValue(filter, value, optionByValue)),\n      ...getAppliedFilterGroupValues(filter),\n    ];\n  };\n\n  const clearAllFilters = () => {\n    cancelPendingRangeChanges();\n    emitFilterChange(null, \"clear-all\");\n  };\n\n  const applyStagedFilters = () => {\n    flushPendingRangeChanges();\n    const store = effectiveFilterStore.value;\n    const nextFilterModel = store ? store.stagedFilterModel.value : stagedFilterModel.value;\n    if (store) {\n      applyCommittedFilterModelToStore(store, nextFilterModel);\n      store.commitStagedFilterSelections();\n      store.initStagedFilterSelections();\n    }\n    if (!props.filterStore && !injectedFilterStore) filterModel.value = nextFilterModel;\n    emit(\"apply\", nextFilterModel);\n  };\n\n  const cancelStagedFilters = () => {\n    cancelPendingRangeChanges();\n    const store = effectiveFilterStore.value;\n    if (store) {\n      store.stagedFilterModel.value = store.filterModel.value;\n      store.initStagedFilterSelections();\n    }\n    stagedFilterModel.value = filterModel.value;\n    emit(\"cancel\");\n  };\n\n  const getExistsAdvancedFilterType = (field: string) => {\n    return getAdvancedFilterTypeForDataType(findResolvedFilter(field)?.dataType);\n  };\n\n  const handleAggregateSelectionChange = (\n    filterKey: string,\n    state: NonNullable<PvFilterPanelResolvedFilter[\"aggregateSelectionState\"]>,\n    reason: PvFilterPanelFilterChangeReason = \"value-toggle\",\n  ) => {\n    const filter = findResolvedFilter(filterKey);\n    if (!filter?.isAggregate) return;\n\n    updateStoreAggregateSelections(filter, state);\n    emitFilterChange(\n      buildFilterPanelAggregateModelFromSelectionState({\n        baseModel: activeFilterModel.value as AdvancedFilterModel | null,\n        colDef: filter.colDef,\n        options: filter.knownOptions ?? [],\n        state,\n      }),\n      reason,\n      filter.key,\n      \"value\",\n    );\n  };\n\n  const handleControlChange = (field: string, change: PvFilterPanelControlChange) => {\n    if (change.type === \"aggregate-selection\") {\n      handleAggregateSelectionChange(field, change.value);\n      return;\n    }\n\n    const targetField = change.field ?? field;\n    const targetColDef = findColDef(targetField) ?? findResolvedFilter(field)?.colDef;\n\n    if (change.type === \"value\") {\n      const filter = findResolvedFilter(field);\n      const option = findKnownOptionForValue(field, targetField, change.value);\n      if (filter?.isAggregate && option) {\n        handleAggregateSelectionChange(\n          field,\n          updateFilterPanelAggregateSelectionState({\n            checked: change.checked,\n            option,\n            options: filter.knownOptions ?? [],\n            state: filter.aggregateSelectionState ?? [],\n          }),\n        );\n        return;\n      }\n\n      handleToggleValue(field, targetField, change.value, change.checked, option);\n      return;\n    }\n\n    if (change.type === \"range\") {\n      handleRangeChange(targetField, change.value, targetColDef);\n      return;\n    }\n\n    if (change.type === \"boolean\") {\n      emitFilterChange(\n        updateBooleanFilter(\n          activeFilterModel.value as AdvancedFilterModel | null,\n          targetField,\n          change.value,\n          effectiveFilterModelType.value,\n          change.field ? \"text\" : \"boolean\",\n          targetColDef,\n        ),\n        \"boolean-change\",\n        targetField,\n        \"boolean\",\n      );\n      return;\n    }\n\n    emitFilterChange(\n      updateExistsFilter(\n        activeFilterModel.value as AdvancedFilterModel | null,\n        targetField,\n        change.value,\n        getExistsAdvancedFilterType(targetField),\n        effectiveFilterModelType.value,\n        targetColDef,\n      ),\n      \"exists-change\",\n      targetField,\n      \"exists\",\n    );\n  };\n\n  const shouldFetchStoreOptions = (\n    filter: PvFilterPanelResolvedFilter,\n    query: string,\n    reason: PvFilterPanelOptionsHandlerReason,\n    parentId?: string,\n  ) => {\n    const store = effectiveFilterStore.value;\n    if (!store || filter.type !== \"value\") return false;\n    if (reason !== \"open\") return true;\n    if (parentId) return true;\n    if (store.filterLoadingMap.value[filter.key]) return false;\n    if (store.filterStaleMap.value[filter.key]) return true;\n\n    const loadedOptions = store.filterOptionsMap.value[filter.key] ?? [];\n    if (!loadedOptions.length) return true;\n    return (store.filterSearchQueries.value[filter.key] ?? \"\") !== query;\n  };\n\n  /** Selected values per field that no known option names, for filters whose values need a display name. */\n  const getIdOnlySelections = (filter: PvFilterPanelResolvedFilter) => {\n    const idOnlySelections = new Map<string, string[]>();\n    if (filter.type !== \"value\" || filter.controlled || filter.isAggregate) return idOnlySelections;\n    if (!filter.colDef.context?.metadataDisplayFields?.length) return idOnlySelections;\n    // The request sends raw values without their field, so with several fields it cannot say which one went unnamed.\n    if (getRepresentedFields(filter.colDef).length !== 1) return idOnlySelections;\n\n    const namedOptions = flattenFilterPanelOptions(filter.knownOptions ?? []);\n    for (const [field, rawValues] of getSelectedRawValuesByField(filter.colDef, filter.knownOptions ?? [])) {\n      const idOnlyValues = rawValues.filter(\n        (rawValue) =>\n          !namedOptions.some((option) => filterPanelOptionMatchesRawValue(option, field, rawValue, filter.key)),\n      );\n      if (idOnlyValues.length) idOnlySelections.set(field, idOnlyValues);\n    }\n    return idOnlySelections;\n  };\n\n  /**\n   * Remove selected values that still have no display name after a fetch that asked for them.\n   *\n   * The options handler receives the selected values, so a value it sent back without a name (or not at\n   * all) can never be shown. Keeping it would filter the data by something the user cannot see or clear.\n   */\n  const dropIdOnlySelections = (filterKey: string, requestedValues: string[]) => {\n    const filter = findResolvedFilter(filterKey);\n    if (!filter) return;\n\n    const requestedValueSet = new Set(requestedValues);\n    for (const [field, idOnlyValues] of getIdOnlySelections(filter)) {\n      const droppedValues = idOnlyValues.filter((rawValue) => requestedValueSet.has(rawValue));\n      if (droppedValues.length) {\n        console.error(\n          `PvFilterPanel: removed selected \"${field}\" values with no display name: ${droppedValues.join(\", \")}`,\n        );\n        const rawValues = filterModelIndex.value.get(field)?.values ?? [];\n        const nextValues = rawValues.filter((rawValue) => !droppedValues.includes(rawValue));\n        updateStoreSelectedValues(filterKey, field, nextValues);\n        emitFilterChange(\n          updateValueFilter(\n            activeFilterModel.value as AdvancedFilterModel | null,\n            field,\n            nextValues,\n            effectiveFilterModelType.value,\n            findColDef(field) ?? filter.colDef,\n          ),\n          \"remove-filter\",\n          field,\n          \"value\",\n        );\n      }\n    }\n  };\n\n  // Whether the store has a real source to ask for option names. PvDataTable's store always installs a handler\n  // that falls back to its own cache, so it reports its source separately; an empty cache names nothing.\n  const storeCanNameSelections = computed(() => {\n    const store = effectiveFilterStore.value;\n    return store.hasFilterOptionsSource?.value ?? Boolean(store.filterOptionsHandler.value);\n  });\n\n  // Selected values per filter that an opening request has already asked the current store to name.\n  const askedSelectionsByFilter = new Map<string, Set<string>>();\n  watch(effectiveFilterStore, () => askedSelectionsByFilter.clear(), { flush: \"sync\" });\n\n  const requestStoreOptions = (\n    filter: PvFilterPanelResolvedFilter,\n    query: string,\n    reason: PvFilterPanelOptionsHandlerReason,\n    parentId?: string,\n  ) => {\n    const store = effectiveFilterStore.value;\n    const selectedValues = Array.from(\n      new Set([...getSelectedRawValuesByField(filter.colDef, filter.knownOptions ?? []).values()].flat()),\n    );\n    // Only an opening request asks the handler to name every selection: searches, facets, child and next-page\n    // requests cover part of the list. Without a handler, nothing was asked at all.\n    const canJudgeSelections = reason === \"open\" && !parentId && storeCanNameSelections.value;\n    if (canJudgeSelections) {\n      const askedSelections = askedSelectionsByFilter.get(filter.key) ?? new Set<string>();\n      selectedValues.forEach((value) => askedSelections.add(value));\n      askedSelectionsByFilter.set(filter.key, askedSelections);\n    }\n    const request = store.fetchFilterOptions({\n      colDef: filter.colDef,\n      field: filter.key,\n      filterModel: activeFilterModel.value,\n      parentId,\n      query,\n      reason,\n      selectedValues,\n    });\n    const requestId = store.filterRequestIdMap.value[filter.key];\n    void request.then(() => {\n      // The store discards a response that a newer request replaced, so only the accepted one may judge.\n      if (canJudgeSelections && store.filterRequestIdMap.value[filter.key] === requestId) {\n        dropIdOnlySelections(filter.key, selectedValues);\n      }\n    });\n  };\n\n  const fetchStoreOptions = (\n    filter: PvFilterPanelResolvedFilter,\n    query: string,\n    reason: PvFilterPanelOptionsHandlerReason,\n    parentId?: string,\n  ) => {\n    if (!shouldFetchStoreOptions(filter, query, reason, parentId) || !effectiveFilterStore.value) return;\n    requestStoreOptions(filter, query, reason, parentId);\n  };\n\n  // A saved or shared filter can arrive with values that no longer have a name. Ask for their names as soon as\n  // they show up, instead of waiting for the user to open the filter, so the ones that cannot be named are\n  // removed before they quietly filter the page. Each value is asked about once per store. This starts on mount,\n  // after the host component's setup has recorded its initial facets, which every fetch for that field carries.\n  onMounted(() => {\n    watch(\n      [resolvedFilters, isStoreMode, storeCanNameSelections],\n      ([filters, storeMode, canNameSelections]) => {\n        if (!storeMode || !canNameSelections) return;\n        const store = effectiveFilterStore.value;\n        for (const filter of filters) {\n          const askedSelections = askedSelectionsByFilter.get(filter.key);\n          const hasUnaskedIdOnlySelection = [...getIdOnlySelections(filter).values()]\n            .flat()\n            .some((value) => !askedSelections?.has(value));\n          if (hasUnaskedIdOnlySelection && !store.filterLoadingMap.value[filter.key]) {\n            requestStoreOptions(filter, filter.searchQuery ?? \"\", \"open\");\n          }\n        }\n      },\n      { immediate: true },\n    );\n  });\n\n  const handleLoadMore = (filter: PvFilterPanelResolvedFilter, query: string, parentId?: string) => {\n    emit(\"load-more\", filter.key, filter.colDef, query, parentId);\n    fetchStoreOptions(filter, query, parentId ? \"child-load-more\" : \"load-more\", parentId);\n  };\n\n  const applyRangeChange = (field: string, value: PvRangeValue, colDef?: PvFilterPanelColDef) => {\n    emitFilterChange(\n      updateRangeFilter(\n        activeFilterModel.value as AdvancedFilterModel | null,\n        field,\n        value.min,\n        value.max,\n        effectiveFilterModelType.value,\n        colDef,\n      ),\n      \"range-change\",\n      field,\n      \"range\",\n    );\n  };\n\n  const cancelPendingRangeChanges = () => {\n    for (const { timer } of pendingRangeChanges.values()) {\n      window.clearTimeout(timer);\n    }\n    pendingRangeChanges.clear();\n  };\n\n  const flushPendingRangeChanges = () => {\n    const changes = [...pendingRangeChanges.entries()];\n    cancelPendingRangeChanges();\n    for (const [field, change] of changes) {\n      applyRangeChange(field, change.value, change.colDef);\n    }\n  };\n\n  const handleRangeChange = (field: string, value: PvRangeValue, colDef?: PvFilterPanelColDef) => {\n    if (props.rangeDebounceMs <= 0) {\n      applyRangeChange(field, value, colDef);\n      return;\n    }\n\n    const existingChange = pendingRangeChanges.get(field);\n    if (existingChange) window.clearTimeout(existingChange.timer);\n\n    const timer = window.setTimeout(() => {\n      pendingRangeChanges.delete(field);\n      applyRangeChange(field, value, colDef);\n    }, props.rangeDebounceMs);\n    pendingRangeChanges.set(field, { colDef, timer, value });\n  };\n\n  onBeforeUnmount(cancelPendingRangeChanges);\n\n  const handleSearchChange = (filter: PvFilterPanelResolvedFilter, query: string) => {\n    emit(\"search-change\", filter.key, query, filter.colDef);\n    fetchStoreOptions(filter, query, \"search\");\n  };\n\n  /** Fetch options for a filter when it becomes active (accordion opened / category selected). */\n  const activateFilter = (filter: PvFilterPanelResolvedFilter, query = filter.searchQuery ?? \"\") => {\n    fetchStoreOptions(filter, query, \"open\");\n  };\n\n  // Secondary facets go to the options handler whenever there is one: only the handler can narrow\n  // options it has not sent to the browser yet, and a paginated field is holding a page rather than\n  // the list. The view keeps matching `metadata.filters` on top of whatever comes back, so a handler\n  // predating `params.facets` still narrows as it always did.\n  // Same call PvDataTable makes for server-side filtering (see `isServerSideFilter` in useFilterStore).\n  const usesHandlerFacets = computed(() => effectiveFilterStore.value.filterOptionsHandler.value != null);\n\n  /**\n   * Record a field's facet selections without fetching.\n   *\n   * Lets a view seed its declared `initial` facets before the field's first fetch, so the handler\n   * narrows by them from the very first page.\n   */\n  const setFacetSelections = (field: string, facets: Record<string, string[]>) => {\n    effectiveFilterStore.value.setFilterFacetSelections(field, facets);\n  };\n\n  /**\n   * Apply a changed facet selection for a filter.\n   *\n   * The selections are recorded on the store, so every later fetch for that field -- searching,\n   * loading more -- stays inside them. When a handler is doing the narrowing, this also re-asks it;\n   * otherwise the view narrows the options it already holds and no request is made.\n   */\n  const handleFacetChange = (\n    filter: PvFilterPanelResolvedFilter,\n    facets: Record<string, string[]>,\n    query = filter.searchQuery ?? \"\",\n  ) => {\n    const store = effectiveFilterStore.value;\n    if (isEqual(store.filterFacetSelectionMap.value[filter.key] ?? {}, facets)) return;\n\n    setFacetSelections(filter.key, facets);\n    emit(\"facet-change\", filter.key, facets, filter.colDef);\n    if (usesHandlerFacets.value) fetchStoreOptions(filter, query, \"facet-change\");\n  };\n\n  const handleToggleValue = (\n    filterKey: string,\n    field: string,\n    value: string,\n    checked: boolean,\n    option?: PvFilterPanelOption,\n  ) => {\n    const filter = findResolvedFilter(filterKey);\n    const currentValues = filter?.controlled\n      ? (props.controlledValues[filterKey] ?? [])\n      : (filterModelIndex.value.get(field)?.values ?? []);\n    const nextValues = filter?.singleSelect\n      ? checked\n        ? [value]\n        : []\n      : checked\n        ? Array.from(new Set([...currentValues, value]))\n        : currentValues.filter((selectedValue) => selectedValue !== value);\n\n    if (filter?.controlled) {\n      emit(\"controlled-change\", filterKey, nextValues, filter.colDef);\n      return;\n    }\n\n    updateStoreSelectedValues(filterKey, field, nextValues, checked ? option : undefined);\n    emitFilterChange(\n      updateValueFilter(\n        activeFilterModel.value as AdvancedFilterModel | null,\n        field,\n        nextValues,\n        effectiveFilterModelType.value,\n        findColDef(field) ?? filter?.colDef,\n      ),\n      \"value-toggle\",\n      field,\n      \"value\",\n    );\n  };\n\n  const handleSuggestionClick = (suggestion: PvFilterPanelSuggestion) => {\n    if (suggestion.filter.type === \"value\" && suggestion.option) {\n      const filter = findResolvedFilter(suggestion.field);\n      const field = getFilterPanelOptionField(suggestion.option, suggestion.field);\n      const value = getFilterPanelOptionRawValue(suggestion.option) ?? suggestion.filter.value;\n\n      if (filter?.isAggregate) {\n        handleAggregateSelectionChange(\n          suggestion.field,\n          updateFilterPanelAggregateSelectionState({\n            checked: suggestion.filter.checked,\n            option: suggestion.option,\n            options: filter.knownOptions ?? [],\n            state: filter.aggregateSelectionState ?? [],\n          }),\n        );\n      } else {\n        handleToggleValue(suggestion.field, field, value, suggestion.filter.checked, suggestion.option);\n      }\n    } else {\n      handleControlChange(suggestion.field, suggestion.filter);\n    }\n    emit(\"suggestion-click\", suggestion);\n  };\n\n  const removeAppliedFilter = (field: string, value: string, type?: PvFilterPanelFilterType) => {\n    const filterType = type ?? findResolvedFilter(field)?.type ?? \"value\";\n\n    if (filterType === \"range\" || (!type && value === RANGE_APPLIED_VALUE)) {\n      emitFilterChange(\n        updateRangeFilter(\n          activeFilterModel.value as AdvancedFilterModel | null,\n          field,\n          null,\n          null,\n          effectiveFilterModelType.value,\n          findColDef(field) ?? findResolvedFilter(field)?.colDef,\n        ),\n        \"remove-filter\",\n        field,\n        \"range\",\n      );\n      return;\n    }\n\n    if (filterType === \"boolean\" || (!type && value === BOOLEAN_APPLIED_VALUE)) {\n      emitFilterChange(\n        updateBooleanFilter(\n          activeFilterModel.value as AdvancedFilterModel | null,\n          field,\n          null,\n          effectiveFilterModelType.value,\n          \"boolean\",\n          findColDef(field) ?? findResolvedFilter(field)?.colDef,\n        ),\n        \"remove-filter\",\n        field,\n        \"boolean\",\n      );\n      return;\n    }\n\n    if (filterType === \"exists\" || (!type && value === EXISTS_APPLIED_VALUE)) {\n      emitFilterChange(\n        updateExistsFilter(\n          activeFilterModel.value as AdvancedFilterModel | null,\n          field,\n          false,\n          \"text\",\n          effectiveFilterModelType.value,\n          findColDef(field) ?? findResolvedFilter(field)?.colDef,\n        ),\n        \"remove-filter\",\n        field,\n        \"exists\",\n      );\n      return;\n    }\n\n    const filter = findResolvedFilter(field);\n    if (filterType === \"value\" && filter?.isAggregate) {\n      const option = findFilterPanelOptionByValue(filter.knownOptions ?? [], value);\n      const currentState = filter.aggregateSelectionState ?? [];\n      const nextState = option\n        ? updateFilterPanelAggregateSelectionState({\n            checked: false,\n            option,\n            options: filter.knownOptions ?? [],\n            state: currentState,\n          })\n        : currentState.filter((node) => node.id !== value);\n      handleAggregateSelectionChange(filter.key, nextState, \"remove-filter\");\n      return;\n    }\n\n    const currentValues = filterModelIndex.value.get(field)?.values ?? [];\n    const nextValues = currentValues.filter((selectedValue) => selectedValue !== value);\n    updateStoreSelectedValues(findResolvedFilter(field)?.key ?? field, field, nextValues);\n    emitFilterChange(\n      updateValueFilter(\n        activeFilterModel.value as AdvancedFilterModel | null,\n        field,\n        nextValues,\n        effectiveFilterModelType.value,\n        findColDef(field) ?? findResolvedFilter(field)?.colDef,\n      ),\n      \"remove-filter\",\n      field,\n      \"value\",\n    );\n  };\n\n  return {\n    // derived state\n    resolvedFilters,\n    appliedGroups,\n    appliedCount,\n    hasActiveFilters,\n    showClearAll,\n    visibleSuggestions,\n    effectiveFilterModelType,\n    activeFilterModel,\n    effectiveFilterStore,\n    // lookups\n    findResolvedFilter,\n    getRepresentedFields,\n    // intent handlers\n    activateFilter,\n    applyStagedFilters,\n    cancelStagedFilters,\n    clearAllFilters,\n    getSuggestionKey,\n    handleControlChange,\n    handleFacetChange,\n    handleLoadMore,\n    handleSearchChange,\n    handleSuggestionClick,\n    removeAppliedFilter,\n    setFacetSelections,\n    usesHandlerFacets,\n  };\n}\n","<script setup lang=\"ts\">\nimport { computed, type CSSProperties, ref, watch } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvModal from \"@/components/base/PvModal/PvModal.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSegmentedControl from \"@/components/base/PvSegmentedControl/PvSegmentedControl.vue\";\nimport PvSuggestionTag from \"@/components/base/PvSuggestionTag/PvSuggestionTag.vue\";\nimport PvFilterPanelAccordion from \"./PvFilterPanelAccordion.vue\";\nimport PvFilterPanelAppliedFiltersSection from \"./PvFilterPanelAppliedFiltersSection.vue\";\nimport PvFilterPanelCategoryButtonRow from \"./PvFilterPanelCategoryButtonRow.vue\";\nimport { usePvFilterPanel } from \"./usePvFilterPanel\";\nimport type {\n  PvFilterPanelCategory,\n  PvFilterPanelEmits,\n  PvFilterPanelFilterModel,\n  PvFilterPanelProps,\n  PvFilterPanelResolvedFilter,\n} from \"./types\";\n\ntype PvFilterPanelMode = \"filters\" | \"applied\";\n\nconst props = withDefaults(defineProps<PvFilterPanelProps>(), {\n  allCategoriesLabel: \"All\",\n  applyLabel: \"Apply\",\n  ariaLabel: \"Filters\",\n  autoHideRelatedFilterFields: undefined,\n  canRemoveFocus: true,\n  cancelLabel: \"Cancel\",\n  collapsedFilterDisplayLabel: \"Additional Filters\",\n  clearAllBody: \"Are you sure you want to clear all applied filters? This will reset your current filters.\",\n  clearAllHeader: \"Clear all filters\",\n  clearAllLabel: \"Clear all\",\n  colDefs: () => [],\n  controlledValues: () => ({}),\n  devMode: false,\n  disableWhileLoading: true,\n  displayPreferencesIcon: false,\n  enableFilterSearch: false,\n  enableFocusView: false,\n  externalFilters: () => [],\n  filterHasMoreMap: () => ({}),\n  filterLoadingMap: () => ({}),\n  filterLoadingMoreMap: () => ({}),\n  filterOptions: () => ({}),\n  filterSearchPlaceholder: \"Search filters\",\n  filterSearchQueries: () => ({}),\n  filterSuggestions: () => [],\n  focusableFields: () => [],\n  focusedValues: () => ({}),\n  focusText: \"Focus\",\n  hideCollapseButton: false,\n  rangeDebounceMs: 250,\n  readOnly: false,\n  staged: false,\n  width: \"320px\",\n});\n\nconst filterModel = defineModel<PvFilterPanelFilterModel>(\"filterModel\", { default: null });\nconst isCollapsed = defineModel<boolean>(\"isCollapsed\", { default: false });\n\nconst emit = defineEmits<PvFilterPanelEmits>();\n\nconst {\n  resolvedFilters,\n  appliedGroups,\n  appliedCount,\n  showClearAll,\n  visibleSuggestions,\n  activateFilter,\n  applyStagedFilters,\n  cancelStagedFilters,\n  clearAllFilters,\n  getSuggestionKey,\n  handleControlChange,\n  handleLoadMore,\n  handleSearchChange,\n  handleSuggestionClick,\n  removeAppliedFilter,\n} = usePvFilterPanel(props, filterModel, emit);\n\n// View-only state: the drawer's tab, accordion open-state, category carousel, and clear-all confirm.\nconst mode = ref<PvFilterPanelMode>(\"filters\");\nconst openSections = ref<Record<string, boolean>>({});\nconst selectedCategory = ref<PvFilterPanelCategory | null>(null);\nconst showCollapsedFilters = ref(false);\nconst showClearAllConfirm = ref(false);\nconst filterSearchText = ref(\"\");\n\n// Searching spans every filter, so it is a different way of narrowing the list than the category\n// row rather than an extra narrowing on top of it. Each control resets the other so the panel never\n// shows a highlighted category next to a list that ignores it.\nconst filterSearchQuery = computed(() => (props.enableFilterSearch ? filterSearchText.value.trim().toLowerCase() : \"\"));\nconst isSearchingFilters = computed(() => filterSearchQuery.value.length > 0);\nconst matchesFilterSearch = (filter: PvFilterPanelResolvedFilter) =>\n  filter.label.toLowerCase().includes(filterSearchQuery.value);\n\nwatch(isSearchingFilters, (isSearching) => {\n  if (isSearching) selectedCategory.value = null;\n});\n\nwatch(selectedCategory, (category) => {\n  if (category !== null) filterSearchText.value = \"\";\n});\n\nconst isCollapsedByDefault = (filter: PvFilterPanelResolvedFilter) =>\n  filter.colDef.context?.filterCollapsedByDefault === true;\nconst categoryFilters = computed<PvFilterPanelResolvedFilter[]>(() => {\n  if (isSearchingFilters.value) return resolvedFilters.value.filter(matchesFilterSearch);\n  if (selectedCategory.value === null) return resolvedFilters.value;\n  return resolvedFilters.value.filter((filter) => filter.category === selectedCategory.value);\n});\nconst defaultFilters = computed(() => categoryFilters.value.filter((filter) => !isCollapsedByDefault(filter)));\nconst overflowFilters = computed(() => categoryFilters.value.filter(isCollapsedByDefault));\nconst isCategorySelected = computed(() => selectedCategory.value !== null);\n// Narrowing to a category, and searching, are both already deliberate filters, so either one\n// surfaces every match rather than leaving some behind the collapsed filters toggle.\nconst visibleFilters = computed<PvFilterPanelResolvedFilter[]>(() => {\n  if (isCategorySelected.value || isSearchingFilters.value || showCollapsedFilters.value) {\n    return [...defaultFilters.value, ...overflowFilters.value];\n  }\n  return defaultFilters.value;\n});\nconst emptyFilterListMessage = computed(() =>\n  isSearchingFilters.value ? \"No filters match your search.\" : \"No filters in this category.\",\n);\nconst collapsedFiltersToggleLabel = computed(\n  () => `${showCollapsedFilters.value ? \"Hide\" : \"Show\"} ${props.collapsedFilterDisplayLabel}`,\n);\nconst showCollapsedFiltersToggle = computed(\n  () =>\n    mode.value === \"filters\" &&\n    !isCategorySelected.value &&\n    !isSearchingFilters.value &&\n    overflowFilters.value.length > 0,\n);\n// External filters are display-only, but they are still filters the user can see, so they count\n// toward the applied badge. Only the removable ones keep \"Clear all\" reachable: a button that can\n// clear nothing is worse than no button.\nconst visibleExternalFilters = computed(() => props.externalFilters.filter((group) => group.values.length > 0));\nconst clearableExternalFilters = computed(() =>\n  visibleExternalFilters.value.filter((group) => group.removable !== false),\n);\nconst externalFilterCount = computed(() =>\n  visibleExternalFilters.value.reduce((sum, group) => sum + group.values.length, 0),\n);\nconst clearableExternalFilterCount = computed(() =>\n  clearableExternalFilters.value.reduce((sum, group) => sum + group.values.length, 0),\n);\nconst totalAppliedCount = computed(() => appliedCount.value + externalFilterCount.value);\nconst showClearAllButton = computed(() => showClearAll.value || clearableExternalFilterCount.value > 0);\nconst showFooter = computed(() => {\n  return !props.readOnly && (showClearAllButton.value || props.staged);\n});\nconst filtersWithOpenState = computed<PvFilterPanelResolvedFilter[]>(() => {\n  return visibleFilters.value.map((filter) => ({\n    ...filter,\n    isOpen: openSections.value[filter.key] ?? filter.isOpen ?? false,\n  }));\n});\nconst modeOptions = computed(() => [\n  { label: \"Filters\", value: \"filters\" },\n  { label: `Applied (${totalAppliedCount.value})`, value: \"applied\" },\n]);\nconst panelStyle = computed<CSSProperties>(() => ({\n  \"--flex-align\": \"stretch\",\n  \"--flex-gap\": \"0\",\n  flex: `0 0 ${props.width}`,\n  minHeight: \"0\",\n  width: props.width,\n}));\n\nconst handleModeChange = (value: string) => {\n  if (value === \"filters\" || value === \"applied\") {\n    mode.value = value;\n  }\n};\n\nconst handleSectionOpenChange = (filter: PvFilterPanelResolvedFilter, open: boolean) => {\n  openSections.value[filter.key] = open;\n  emit(\"open-change\", filter.key, open, filter.colDef);\n  if (open) activateFilter(filter);\n};\n\nconst cancelClearAllFilters = () => {\n  showClearAllConfirm.value = false;\n};\n\nconst confirmClearAllFilters = () => {\n  // Skip the filter model when the panel owns nothing to clear, so clearing an external-only panel\n  // does not announce a filter-model change the consumer would have to ignore.\n  if (showClearAll.value) clearAllFilters();\n  clearableExternalFilters.value.forEach((group) => {\n    group.values.forEach((item) => emit(\"remove-external-filter\", group.key, item.value));\n  });\n  showClearAllConfirm.value = false;\n};\n\nconst requestClearAllFilters = () => {\n  showClearAllConfirm.value = true;\n};\n</script>\n\n<template>\n  <div\n    v-if=\"!isCollapsed\"\n    role=\"complementary\"\n    class=\"pv-filter-panel pv-flex-vertical pv-surface pv-border-right\"\n    data-testid=\"pv-filter-panel\"\n    :aria-label=\"ariaLabel\"\n    :style=\"panelStyle\"\n  >\n    <div class=\"pv-filter-panel-header pv-flex pv-border-bottom\">\n      <PvSegmentedControl\n        :modelValue=\"mode\"\n        :options=\"modeOptions\"\n        class=\"pv-filter-panel-mode-control\"\n        size=\"xl\"\n        @update:modelValue=\"handleModeChange\"\n      />\n      <PvButton\n        v-if=\"!hideCollapseButton\"\n        ariaLabel=\"Collapse filters\"\n        leftIcon=\"chevrons-left\"\n        size=\"xl\"\n        variant=\"secondary\"\n        @click=\"isCollapsed = true\"\n      />\n    </div>\n\n    <div class=\"pv-filter-panel-body pv-flex-vertical\">\n      <div\n        v-show=\"mode === 'filters'\"\n        class=\"pv-filter-panel-filters-view pv-flex-vertical\"\n        data-testid=\"pv-filter-panel-filters-view\"\n      >\n        <section\n          v-if=\"!readOnly && visibleSuggestions.length\"\n          aria-label=\"Filter suggestions\"\n          class=\"pv-filter-panel-suggestions pv-flex-vertical pv-border-bottom\"\n          data-testid=\"pv-filter-panel-suggestions\"\n        >\n          <p class=\"pv-filter-panel-section-title pv-text-title-sm pv-text-subdued\">Suggestions</p>\n          <div class=\"pv-filter-panel-suggestion-tags pv-flex\">\n            <PvSuggestionTag\n              v-for=\"suggestion in visibleSuggestions\"\n              :key=\"getSuggestionKey(suggestion)\"\n              :icon=\"suggestion.icon\"\n              :icon-classes=\"suggestion.iconClasses\"\n              :label=\"suggestion.label\"\n              @handle-click=\"() => handleSuggestionClick(suggestion)\"\n            />\n          </div>\n        </section>\n        <slot name=\"suggestions\" />\n        <PvFilterPanelCategoryButtonRow\n          v-model=\"selectedCategory\"\n          :all-categories-label=\"allCategoriesLabel\"\n          :category-order=\"categoryOrder\"\n          :filters=\"resolvedFilters\"\n        />\n        <div\n          v-if=\"enableFilterSearch && resolvedFilters.length\"\n          class=\"pv-filter-panel-search pv-border-bottom\"\n          data-testid=\"pv-filter-panel-search\"\n        >\n          <PvSearchInput v-model=\"filterSearchText\" :placeholder=\"filterSearchPlaceholder\" />\n        </div>\n        <div v-if=\"!resolvedFilters.length\" class=\"pv-filter-panel-empty pv-text-body-sm pv-text-subdued\">\n          No filters available.\n        </div>\n        <div v-else-if=\"!categoryFilters.length\" class=\"pv-filter-panel-empty pv-text-body-sm pv-text-subdued\">\n          {{ emptyFilterListMessage }}\n        </div>\n        <div v-else class=\"pv-filter-panel-filter-list pv-flex-vertical pv-inset-inline\" style=\"--inset-size: 8px\">\n          <PvFilterPanelAccordion\n            v-for=\"filter in filtersWithOpenState\"\n            :key=\"filter.key\"\n            :disable-while-loading=\"disableWhileLoading\"\n            :filter=\"filter\"\n            @filter-change=\"(change) => handleControlChange(filter.key, change)\"\n            @focus-change=\"(field, value, option) => emit('focus-change', field, value, option)\"\n            @handle-settings-icon=\"(field, colDef) => emit('handle-settings-icon', field, colDef)\"\n            @load-more=\"(query, parentId) => handleLoadMore(filter, query, parentId)\"\n            @open-change=\"(open) => handleSectionOpenChange(filter, open)\"\n            @search-change=\"(query) => handleSearchChange(filter, query)\"\n          />\n          <PvButton\n            v-if=\"showCollapsedFiltersToggle\"\n            class=\"pv-filter-panel-collapsed-filters-toggle pv-text-brand\"\n            :label=\"collapsedFiltersToggleLabel\"\n            variant=\"ghost\"\n            @click=\"showCollapsedFilters = !showCollapsedFilters\"\n          />\n        </div>\n      </div>\n\n      <PvFilterPanelAppliedFiltersSection\n        v-show=\"mode === 'applied'\"\n        :applied-count=\"appliedCount\"\n        :applied-groups=\"appliedGroups\"\n        :external-filters=\"visibleExternalFilters\"\n        :read-only=\"readOnly\"\n        @remove-external-filter=\"(key, value) => emit('remove-external-filter', key, value)\"\n        @remove-filter=\"removeAppliedFilter\"\n      />\n    </div>\n\n    <div v-if=\"showFooter\" class=\"pv-filter-panel-footer pv-flex pv-border-top\">\n      <div class=\"pv-filter-panel-actions pv-flex\">\n        <PvButton\n          v-if=\"showClearAllButton && !readOnly\"\n          class=\"pv-text-brand\"\n          :label=\"clearAllLabel\"\n          variant=\"ghost\"\n          @click=\"requestClearAllFilters\"\n        />\n        <template v-if=\"staged && !readOnly\">\n          <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelStagedFilters\" />\n          <PvButton :label=\"applyLabel\" variant=\"primary\" @click=\"applyStagedFilters\" />\n        </template>\n      </div>\n    </div>\n  </div>\n\n  <PvModal v-model=\"showClearAllConfirm\" :header=\"clearAllHeader\" :style=\"{ '--max-width': '440px' }\">\n    <template #body>\n      <p class=\"pv-text-body-sm\">\n        {{ clearAllBody }}\n      </p>\n    </template>\n    <template #footer>\n      <div class=\"pv-filter-panel-modal-footer pv-flex\">\n        <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelClearAllFilters\" />\n        <PvButton :label=\"clearAllLabel\" variant=\"primary\" @click=\"confirmClearAllFilters\" />\n      </div>\n    </template>\n  </PvModal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, type CSSProperties, ref, watch } from \"vue\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvModal from \"@/components/base/PvModal/PvModal.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSegmentedControl from \"@/components/base/PvSegmentedControl/PvSegmentedControl.vue\";\nimport PvSuggestionTag from \"@/components/base/PvSuggestionTag/PvSuggestionTag.vue\";\nimport PvFilterPanelAccordion from \"./PvFilterPanelAccordion.vue\";\nimport PvFilterPanelAppliedFiltersSection from \"./PvFilterPanelAppliedFiltersSection.vue\";\nimport PvFilterPanelCategoryButtonRow from \"./PvFilterPanelCategoryButtonRow.vue\";\nimport { usePvFilterPanel } from \"./usePvFilterPanel\";\nimport type {\n  PvFilterPanelCategory,\n  PvFilterPanelEmits,\n  PvFilterPanelFilterModel,\n  PvFilterPanelProps,\n  PvFilterPanelResolvedFilter,\n} from \"./types\";\n\ntype PvFilterPanelMode = \"filters\" | \"applied\";\n\nconst props = withDefaults(defineProps<PvFilterPanelProps>(), {\n  allCategoriesLabel: \"All\",\n  applyLabel: \"Apply\",\n  ariaLabel: \"Filters\",\n  autoHideRelatedFilterFields: undefined,\n  canRemoveFocus: true,\n  cancelLabel: \"Cancel\",\n  collapsedFilterDisplayLabel: \"Additional Filters\",\n  clearAllBody: \"Are you sure you want to clear all applied filters? This will reset your current filters.\",\n  clearAllHeader: \"Clear all filters\",\n  clearAllLabel: \"Clear all\",\n  colDefs: () => [],\n  controlledValues: () => ({}),\n  devMode: false,\n  disableWhileLoading: true,\n  displayPreferencesIcon: false,\n  enableFilterSearch: false,\n  enableFocusView: false,\n  externalFilters: () => [],\n  filterHasMoreMap: () => ({}),\n  filterLoadingMap: () => ({}),\n  filterLoadingMoreMap: () => ({}),\n  filterOptions: () => ({}),\n  filterSearchPlaceholder: \"Search filters\",\n  filterSearchQueries: () => ({}),\n  filterSuggestions: () => [],\n  focusableFields: () => [],\n  focusedValues: () => ({}),\n  focusText: \"Focus\",\n  hideCollapseButton: false,\n  rangeDebounceMs: 250,\n  readOnly: false,\n  staged: false,\n  width: \"320px\",\n});\n\nconst filterModel = defineModel<PvFilterPanelFilterModel>(\"filterModel\", { default: null });\nconst isCollapsed = defineModel<boolean>(\"isCollapsed\", { default: false });\n\nconst emit = defineEmits<PvFilterPanelEmits>();\n\nconst {\n  resolvedFilters,\n  appliedGroups,\n  appliedCount,\n  showClearAll,\n  visibleSuggestions,\n  activateFilter,\n  applyStagedFilters,\n  cancelStagedFilters,\n  clearAllFilters,\n  getSuggestionKey,\n  handleControlChange,\n  handleLoadMore,\n  handleSearchChange,\n  handleSuggestionClick,\n  removeAppliedFilter,\n} = usePvFilterPanel(props, filterModel, emit);\n\n// View-only state: the drawer's tab, accordion open-state, category carousel, and clear-all confirm.\nconst mode = ref<PvFilterPanelMode>(\"filters\");\nconst openSections = ref<Record<string, boolean>>({});\nconst selectedCategory = ref<PvFilterPanelCategory | null>(null);\nconst showCollapsedFilters = ref(false);\nconst showClearAllConfirm = ref(false);\nconst filterSearchText = ref(\"\");\n\n// Searching spans every filter, so it is a different way of narrowing the list than the category\n// row rather than an extra narrowing on top of it. Each control resets the other so the panel never\n// shows a highlighted category next to a list that ignores it.\nconst filterSearchQuery = computed(() => (props.enableFilterSearch ? filterSearchText.value.trim().toLowerCase() : \"\"));\nconst isSearchingFilters = computed(() => filterSearchQuery.value.length > 0);\nconst matchesFilterSearch = (filter: PvFilterPanelResolvedFilter) =>\n  filter.label.toLowerCase().includes(filterSearchQuery.value);\n\nwatch(isSearchingFilters, (isSearching) => {\n  if (isSearching) selectedCategory.value = null;\n});\n\nwatch(selectedCategory, (category) => {\n  if (category !== null) filterSearchText.value = \"\";\n});\n\nconst isCollapsedByDefault = (filter: PvFilterPanelResolvedFilter) =>\n  filter.colDef.context?.filterCollapsedByDefault === true;\nconst categoryFilters = computed<PvFilterPanelResolvedFilter[]>(() => {\n  if (isSearchingFilters.value) return resolvedFilters.value.filter(matchesFilterSearch);\n  if (selectedCategory.value === null) return resolvedFilters.value;\n  return resolvedFilters.value.filter((filter) => filter.category === selectedCategory.value);\n});\nconst defaultFilters = computed(() => categoryFilters.value.filter((filter) => !isCollapsedByDefault(filter)));\nconst overflowFilters = computed(() => categoryFilters.value.filter(isCollapsedByDefault));\nconst isCategorySelected = computed(() => selectedCategory.value !== null);\n// Narrowing to a category, and searching, are both already deliberate filters, so either one\n// surfaces every match rather than leaving some behind the collapsed filters toggle.\nconst visibleFilters = computed<PvFilterPanelResolvedFilter[]>(() => {\n  if (isCategorySelected.value || isSearchingFilters.value || showCollapsedFilters.value) {\n    return [...defaultFilters.value, ...overflowFilters.value];\n  }\n  return defaultFilters.value;\n});\nconst emptyFilterListMessage = computed(() =>\n  isSearchingFilters.value ? \"No filters match your search.\" : \"No filters in this category.\",\n);\nconst collapsedFiltersToggleLabel = computed(\n  () => `${showCollapsedFilters.value ? \"Hide\" : \"Show\"} ${props.collapsedFilterDisplayLabel}`,\n);\nconst showCollapsedFiltersToggle = computed(\n  () =>\n    mode.value === \"filters\" &&\n    !isCategorySelected.value &&\n    !isSearchingFilters.value &&\n    overflowFilters.value.length > 0,\n);\n// External filters are display-only, but they are still filters the user can see, so they count\n// toward the applied badge. Only the removable ones keep \"Clear all\" reachable: a button that can\n// clear nothing is worse than no button.\nconst visibleExternalFilters = computed(() => props.externalFilters.filter((group) => group.values.length > 0));\nconst clearableExternalFilters = computed(() =>\n  visibleExternalFilters.value.filter((group) => group.removable !== false),\n);\nconst externalFilterCount = computed(() =>\n  visibleExternalFilters.value.reduce((sum, group) => sum + group.values.length, 0),\n);\nconst clearableExternalFilterCount = computed(() =>\n  clearableExternalFilters.value.reduce((sum, group) => sum + group.values.length, 0),\n);\nconst totalAppliedCount = computed(() => appliedCount.value + externalFilterCount.value);\nconst showClearAllButton = computed(() => showClearAll.value || clearableExternalFilterCount.value > 0);\nconst showFooter = computed(() => {\n  return !props.readOnly && (showClearAllButton.value || props.staged);\n});\nconst filtersWithOpenState = computed<PvFilterPanelResolvedFilter[]>(() => {\n  return visibleFilters.value.map((filter) => ({\n    ...filter,\n    isOpen: openSections.value[filter.key] ?? filter.isOpen ?? false,\n  }));\n});\nconst modeOptions = computed(() => [\n  { label: \"Filters\", value: \"filters\" },\n  { label: `Applied (${totalAppliedCount.value})`, value: \"applied\" },\n]);\nconst panelStyle = computed<CSSProperties>(() => ({\n  \"--flex-align\": \"stretch\",\n  \"--flex-gap\": \"0\",\n  flex: `0 0 ${props.width}`,\n  minHeight: \"0\",\n  width: props.width,\n}));\n\nconst handleModeChange = (value: string) => {\n  if (value === \"filters\" || value === \"applied\") {\n    mode.value = value;\n  }\n};\n\nconst handleSectionOpenChange = (filter: PvFilterPanelResolvedFilter, open: boolean) => {\n  openSections.value[filter.key] = open;\n  emit(\"open-change\", filter.key, open, filter.colDef);\n  if (open) activateFilter(filter);\n};\n\nconst cancelClearAllFilters = () => {\n  showClearAllConfirm.value = false;\n};\n\nconst confirmClearAllFilters = () => {\n  // Skip the filter model when the panel owns nothing to clear, so clearing an external-only panel\n  // does not announce a filter-model change the consumer would have to ignore.\n  if (showClearAll.value) clearAllFilters();\n  clearableExternalFilters.value.forEach((group) => {\n    group.values.forEach((item) => emit(\"remove-external-filter\", group.key, item.value));\n  });\n  showClearAllConfirm.value = false;\n};\n\nconst requestClearAllFilters = () => {\n  showClearAllConfirm.value = true;\n};\n</script>\n\n<template>\n  <div\n    v-if=\"!isCollapsed\"\n    role=\"complementary\"\n    class=\"pv-filter-panel pv-flex-vertical pv-surface pv-border-right\"\n    data-testid=\"pv-filter-panel\"\n    :aria-label=\"ariaLabel\"\n    :style=\"panelStyle\"\n  >\n    <div class=\"pv-filter-panel-header pv-flex pv-border-bottom\">\n      <PvSegmentedControl\n        :modelValue=\"mode\"\n        :options=\"modeOptions\"\n        class=\"pv-filter-panel-mode-control\"\n        size=\"xl\"\n        @update:modelValue=\"handleModeChange\"\n      />\n      <PvButton\n        v-if=\"!hideCollapseButton\"\n        ariaLabel=\"Collapse filters\"\n        leftIcon=\"chevrons-left\"\n        size=\"xl\"\n        variant=\"secondary\"\n        @click=\"isCollapsed = true\"\n      />\n    </div>\n\n    <div class=\"pv-filter-panel-body pv-flex-vertical\">\n      <div\n        v-show=\"mode === 'filters'\"\n        class=\"pv-filter-panel-filters-view pv-flex-vertical\"\n        data-testid=\"pv-filter-panel-filters-view\"\n      >\n        <section\n          v-if=\"!readOnly && visibleSuggestions.length\"\n          aria-label=\"Filter suggestions\"\n          class=\"pv-filter-panel-suggestions pv-flex-vertical pv-border-bottom\"\n          data-testid=\"pv-filter-panel-suggestions\"\n        >\n          <p class=\"pv-filter-panel-section-title pv-text-title-sm pv-text-subdued\">Suggestions</p>\n          <div class=\"pv-filter-panel-suggestion-tags pv-flex\">\n            <PvSuggestionTag\n              v-for=\"suggestion in visibleSuggestions\"\n              :key=\"getSuggestionKey(suggestion)\"\n              :icon=\"suggestion.icon\"\n              :icon-classes=\"suggestion.iconClasses\"\n              :label=\"suggestion.label\"\n              @handle-click=\"() => handleSuggestionClick(suggestion)\"\n            />\n          </div>\n        </section>\n        <slot name=\"suggestions\" />\n        <PvFilterPanelCategoryButtonRow\n          v-model=\"selectedCategory\"\n          :all-categories-label=\"allCategoriesLabel\"\n          :category-order=\"categoryOrder\"\n          :filters=\"resolvedFilters\"\n        />\n        <div\n          v-if=\"enableFilterSearch && resolvedFilters.length\"\n          class=\"pv-filter-panel-search pv-border-bottom\"\n          data-testid=\"pv-filter-panel-search\"\n        >\n          <PvSearchInput v-model=\"filterSearchText\" :placeholder=\"filterSearchPlaceholder\" />\n        </div>\n        <div v-if=\"!resolvedFilters.length\" class=\"pv-filter-panel-empty pv-text-body-sm pv-text-subdued\">\n          No filters available.\n        </div>\n        <div v-else-if=\"!categoryFilters.length\" class=\"pv-filter-panel-empty pv-text-body-sm pv-text-subdued\">\n          {{ emptyFilterListMessage }}\n        </div>\n        <div v-else class=\"pv-filter-panel-filter-list pv-flex-vertical pv-inset-inline\" style=\"--inset-size: 8px\">\n          <PvFilterPanelAccordion\n            v-for=\"filter in filtersWithOpenState\"\n            :key=\"filter.key\"\n            :disable-while-loading=\"disableWhileLoading\"\n            :filter=\"filter\"\n            @filter-change=\"(change) => handleControlChange(filter.key, change)\"\n            @focus-change=\"(field, value, option) => emit('focus-change', field, value, option)\"\n            @handle-settings-icon=\"(field, colDef) => emit('handle-settings-icon', field, colDef)\"\n            @load-more=\"(query, parentId) => handleLoadMore(filter, query, parentId)\"\n            @open-change=\"(open) => handleSectionOpenChange(filter, open)\"\n            @search-change=\"(query) => handleSearchChange(filter, query)\"\n          />\n          <PvButton\n            v-if=\"showCollapsedFiltersToggle\"\n            class=\"pv-filter-panel-collapsed-filters-toggle pv-text-brand\"\n            :label=\"collapsedFiltersToggleLabel\"\n            variant=\"ghost\"\n            @click=\"showCollapsedFilters = !showCollapsedFilters\"\n          />\n        </div>\n      </div>\n\n      <PvFilterPanelAppliedFiltersSection\n        v-show=\"mode === 'applied'\"\n        :applied-count=\"appliedCount\"\n        :applied-groups=\"appliedGroups\"\n        :external-filters=\"visibleExternalFilters\"\n        :read-only=\"readOnly\"\n        @remove-external-filter=\"(key, value) => emit('remove-external-filter', key, value)\"\n        @remove-filter=\"removeAppliedFilter\"\n      />\n    </div>\n\n    <div v-if=\"showFooter\" class=\"pv-filter-panel-footer pv-flex pv-border-top\">\n      <div class=\"pv-filter-panel-actions pv-flex\">\n        <PvButton\n          v-if=\"showClearAllButton && !readOnly\"\n          class=\"pv-text-brand\"\n          :label=\"clearAllLabel\"\n          variant=\"ghost\"\n          @click=\"requestClearAllFilters\"\n        />\n        <template v-if=\"staged && !readOnly\">\n          <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelStagedFilters\" />\n          <PvButton :label=\"applyLabel\" variant=\"primary\" @click=\"applyStagedFilters\" />\n        </template>\n      </div>\n    </div>\n  </div>\n\n  <PvModal v-model=\"showClearAllConfirm\" :header=\"clearAllHeader\" :style=\"{ '--max-width': '440px' }\">\n    <template #body>\n      <p class=\"pv-text-body-sm\">\n        {{ clearAllBody }}\n      </p>\n    </template>\n    <template #footer>\n      <div class=\"pv-filter-panel-modal-footer pv-flex\">\n        <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelClearAllFilters\" />\n        <PvButton :label=\"clearAllLabel\" variant=\"primary\" @click=\"confirmClearAllFilters\" />\n      </div>\n    </template>\n  </PvModal>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\ninterface PvFilterModalSelectItem {\n  /** When true, applies fully rounded (pill) corners. */\n  rounded?: boolean;\n  /** When true, the toggle button is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** The value emitted when this toggle is selected (used with radio-style groups). */\n  value?: string;\n  /** Visible text label displayed inside the toggle. */\n  label?: string;\n  /** HTML id for the underlying input element. Auto-generated from label when omitted. */\n  id?: string;\n  /** HTML name attribute, used to group radio-style toggles. */\n  name?: string;\n  /**\n   * When true, renders as a checkbox (can be deselected). When false, renders as a radio (stays selected).\n   */\n  deselect?: boolean;\n  /** Optional counter on the right side of the button */\n  rightCounterBadge?: number;\n}\n\nconst props = withDefaults(defineProps<PvFilterModalSelectItem>(), {\n  deselect: true,\n});\n\nconst modelValue = defineModel<boolean | string>();\n\nconst labelId = computed(() => {\n  if (props.id) {\n    return props.id;\n  }\n\n  return `${props.label}-${Math.random()}`;\n});\n</script>\n\n<template>\n  <label class=\"pv-toggle-ghost pv-text-default\" :for=\"labelId\">\n    <input\n      v-model=\"modelValue\"\n      class=\"pv-hide\"\n      :id=\"labelId\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :name=\"name\"\n      :disabled=\"disabled\"\n    />\n    <span v-if=\"label\">{{ label }}</span>\n    <span class=\"pv-inset-square\" style=\"--inset-size: 0px 2px\">{{ rightCounterBadge }}</span>\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\n\ninterface PvFilterModalSelectItem {\n  /** When true, applies fully rounded (pill) corners. */\n  rounded?: boolean;\n  /** When true, the toggle button is non-interactive and visually dimmed. */\n  disabled?: boolean;\n  /** The value emitted when this toggle is selected (used with radio-style groups). */\n  value?: string;\n  /** Visible text label displayed inside the toggle. */\n  label?: string;\n  /** HTML id for the underlying input element. Auto-generated from label when omitted. */\n  id?: string;\n  /** HTML name attribute, used to group radio-style toggles. */\n  name?: string;\n  /**\n   * When true, renders as a checkbox (can be deselected). When false, renders as a radio (stays selected).\n   */\n  deselect?: boolean;\n  /** Optional counter on the right side of the button */\n  rightCounterBadge?: number;\n}\n\nconst props = withDefaults(defineProps<PvFilterModalSelectItem>(), {\n  deselect: true,\n});\n\nconst modelValue = defineModel<boolean | string>();\n\nconst labelId = computed(() => {\n  if (props.id) {\n    return props.id;\n  }\n\n  return `${props.label}-${Math.random()}`;\n});\n</script>\n\n<template>\n  <label class=\"pv-toggle-ghost pv-text-default\" :for=\"labelId\">\n    <input\n      v-model=\"modelValue\"\n      class=\"pv-hide\"\n      :id=\"labelId\"\n      :type=\"deselect ? 'checkbox' : 'radio'\"\n      :value=\"value\"\n      :name=\"name\"\n      :disabled=\"disabled\"\n    />\n    <span v-if=\"label\">{{ label }}</span>\n    <span class=\"pv-inset-square\" style=\"--inset-size: 0px 2px\">{{ rightCounterBadge }}</span>\n  </label>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from \"vue\";\nimport { watchDebounced } from \"@vueuse/core\";\nimport { startCase } from \"es-toolkit/string\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvMultiSelectButton from \"@/components/base/PvMultiSelectButton/PvMultiSelectButton.vue\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvFilterPanelOptionRow from \"@/components/base/PvFilterPanel/PvFilterPanelOptionRow.vue\";\nimport PvFilterModalSelectItem from \"./PvFilterModalSelectItem.vue\";\nimport { usePvFilterPanel } from \"@/components/base/PvFilterPanel/usePvFilterPanel\";\nimport { getFilterOptionLabel, getFilterOptionResultCount } from \"@/components/base/PvFilterPanel/filterOptionDisplay\";\nimport {\n  createFilterPanelAggregateSelectionStatusMap,\n  getFilterPanelAggregateSelectionCount,\n  updateFilterPanelAggregateSelectionState,\n} from \"@/components/base/PvFilterPanel/aggregateFilterModel\";\nimport {\n  flattenFilterPanelOptions,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n} from \"@/components/base/PvFilterPanel/filterOptionValue\";\nimport type {\n  PvFilterPanelEmits,\n  PvFilterPanelFacetDef,\n  PvFilterPanelFilterModel,\n  PvFilterPanelOption,\n  PvFilterPanelResolvedFilter,\n} from \"@/components/base/PvFilterPanel/types\";\nimport type { MenuOption } from \"@/types\";\nimport type { PvFilterModalProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterModalProps>(), {\n  applyLabel: \"Apply\",\n  ariaLabel: \"Filters\",\n  autoHideRelatedFilterFields: undefined,\n  canRemoveFocus: true,\n  cancelLabel: \"Cancel\",\n  clearAllBody: \"Are you sure you want to clear all applied filters? This will reset your current filters.\",\n  clearAllHeader: \"Clear all filters\",\n  clearAllLabel: \"Clear all\",\n  clearSelectionLabel: \"Clear All\",\n  colDefs: () => [],\n  controlledValues: () => ({}),\n  devMode: false,\n  displayPreferencesIcon: false,\n  enableFocusView: false,\n  filterHasMoreMap: () => ({}),\n  filterLoadingMap: () => ({}),\n  filterLoadingMoreMap: () => ({}),\n  filterOptions: () => ({}),\n  filterSearchQueries: () => ({}),\n  filterSuggestions: () => [],\n  focusableFields: () => [],\n  focusedValues: () => ({}),\n  focusText: \"Focus\",\n  header: \"Filters\",\n  maxWidth: \"640px\",\n  rangeDebounceMs: 250,\n  readOnly: false,\n  selectAllLabel: \"Select All\",\n  staged: false,\n});\n\nconst filterModel = defineModel<PvFilterPanelFilterModel>(\"filterModel\", { default: null });\nconst visible = defineModel<boolean>(\"visible\", { default: false });\n\nconst emit = defineEmits<PvFilterPanelEmits>();\n\nconst {\n  resolvedFilters,\n  activateFilter,\n  applyStagedFilters,\n  cancelStagedFilters,\n  handleControlChange,\n  handleFacetChange,\n  setFacetSelections,\n  usesHandlerFacets,\n} = usePvFilterPanel(props, filterModel, emit);\n\n// View-only state: which category (rail item) is active and the active filter's search text.\nconst activeKey = ref<string | null>(null);\nconst radioGroupName = useId();\nconst searchText = ref(\"\");\n\n// The modal renders value/checkbox filters; range/boolean/exists are skipped from the rail in v1.\nconst railFilters = computed(() => resolvedFilters.value.filter((filter) => filter.type === \"value\"));\n\nconst activeFilter = computed<PvFilterPanelResolvedFilter | null>(() => {\n  const filters = railFilters.value;\n  return filters.find((filter) => filter.key === activeKey.value) ?? filters[0] ?? null;\n});\n\nconst isAggregateFilter = computed(() => activeFilter.value?.isAggregate === true);\nconst aggregateSelectionState = computed(() => activeFilter.value?.aggregateSelectionState ?? []);\nconst selectedValueSet = computed(() => new Set(activeFilter.value?.selectedValues ?? []));\nconst normalizedSearchText = computed(() => searchText.value.trim().toLowerCase());\n\nconst getSearchableOptionText = (option: PvFilterPanelOption) => {\n  const metadataValues =\n    typeof option.metadata === \"object\" && option.metadata !== null ? Object.values(option.metadata) : [];\n  return [option.value, option.label, option.subText, option.subduedText, option.matchedValue, option.matchedField]\n    .concat(metadataValues.flatMap((value) => (value === null || value === undefined ? [] : [String(value)])))\n    .filter((value): value is string => Boolean(value))\n    .join(\" \")\n    .toLowerCase();\n};\n\n// Map known option values to their full option so selected items can be rendered even when they\n// have scrolled out of the currently loaded option page.\nconst knownOptionMap = computed<Record<string, PvFilterPanelOption>>(() => {\n  const filter = activeFilter.value;\n  if (!filter) return {};\n  const map: Record<string, PvFilterPanelOption> = {};\n  for (const option of flattenFilterPanelOptions([...(filter.knownOptions ?? []), ...(filter.options ?? [])])) {\n    map[option.value] = option;\n  }\n  return map;\n});\n\n// Secondary facet filters (e.g. filtering \"Payer\" options down to a state) narrow which options are\n// displayed within the active tab. Facets are declared per colDef (colDef.context.filterPanel)\n// and matched against each option's metadata.filters[facetKey]; selections are local UI state, keyed\n// per filter tab so switching tabs doesn't lose a facet selection made earlier. Each facet's `initial`\n// value only seeds the local state once, on mount.\nconst activeFacets = computed<Record<string, PvFilterPanelFacetDef>>(\n  () => activeFilter.value?.colDef.context?.filterPanel ?? {},\n);\nconst facetSelectionsByFilter = ref<Record<string, Record<string, string[]>>>(\n  Object.fromEntries(\n    railFilters.value.flatMap((filter) => {\n      const facets = filter.colDef.context?.filterPanel;\n      const initial = Object.fromEntries(\n        Object.entries(facets ?? {}).flatMap(([facetKey, def]) =>\n          def.initial?.length ? [[facetKey, def.initial]] : [],\n        ),\n      );\n      return Object.keys(initial).length ? [[filter.key, initial]] : [];\n    }),\n  ),\n);\n\n// An options handler narrows by whatever the store last recorded, so the declared `initial` values\n// have to be there before the field's first fetch -- narrowing in the browser instead would report\n// \"no matches\" for an initial value whose options sit past the first page.\nfor (const [key, facets] of Object.entries(facetSelectionsByFilter.value)) {\n  setFacetSelections(key, facets);\n}\n\n// The modal is the only holder of facet UI state, so a store outliving it must not keep narrowing by\n// selections nothing is showing any more.\nonBeforeUnmount(() => {\n  for (const key of Object.keys(facetSelectionsByFilter.value)) {\n    setFacetSelections(key, {});\n  }\n});\n\nconst getFacetSelection = (facetKey: string): string[] => {\n  const key = activeFilter.value?.key;\n  return (key && facetSelectionsByFilter.value[key]?.[facetKey]) || [];\n};\n\n/** The active filter's facet selections, empty ones omitted. */\nconst currentFacetSelections = (): Record<string, string[]> => {\n  const key = activeFilter.value?.key;\n  if (!key) return {};\n  const selections = facetSelectionsByFilter.value[key] ?? {};\n  return Object.fromEntries(\n    Object.keys(activeFacets.value)\n      .filter((facetKey) => selections[facetKey]?.length)\n      .map((facetKey) => [facetKey, selections[facetKey]]),\n  );\n};\n\nconst facetMenuOptions = (values: string[]): MenuOption[] => values.map((value) => ({ id: value, text: value }));\n\nconst getSelectedFacetOptions = (facetKey: string, values: string[]) => {\n  const selected = new Set(getFacetSelection(facetKey));\n  return facetMenuOptions(values).filter((option) => selected.has(option.id));\n};\n\nconst setFacetSelection = (facetKey: string, options: MenuOption[]) => {\n  const filter = activeFilter.value;\n  if (!filter) return;\n  facetSelectionsByFilter.value[filter.key] = {\n    ...facetSelectionsByFilter.value[filter.key],\n    [facetKey]: options.map((option) => option.id),\n  };\n};\n\n// Only facets with an active selection narrow the list; compute their selected-value sets once per\n// render rather than per option.\nconst activeFacetSelections = computed(() =>\n  Object.keys(activeFacets.value)\n    .map((facetKey) => [facetKey, new Set(getFacetSelection(facetKey))] as const)\n    .filter(([, selected]) => selected.size > 0),\n);\n\nconst optionMatchesFacets = (option: PvFilterPanelOption) =>\n  activeFacetSelections.value.every(([facetKey, selected]) => {\n    const rawValue = option.metadata?.filters?.[facetKey];\n    // An option that says nothing about this facet is taken on trust once a handler is narrowing,\n    // since a handler that applied the facet itself need not echo `metadata.filters` back. Keeping\n    // the match otherwise means a handler that ignores `params.facets` still gets narrowed here,\n    // rather than silently showing everything.\n    if (rawValue === undefined) return usesHandlerFacets.value;\n    const optionValues = Array.isArray(rawValue) ? rawValue : [rawValue];\n    return optionValues.some((value) => selected.has(String(value)));\n  });\n\nconst displayedOptions = computed(() => {\n  const options = (activeFilter.value?.options ?? []).filter(optionMatchesFacets);\n  const query = normalizedSearchText.value;\n  if (!query) return options;\n  return options.filter((option) => getSearchableOptionText(option).includes(query));\n});\n\nconst selectedOptions = computed(() => {\n  if (isAggregateFilter.value || activeFilter.value?.singleSelect) return [];\n  return (activeFilter.value?.selectedValues ?? []).map(\n    (value) => knownOptionMap.value[value] ?? { label: value, value },\n  );\n});\n\n// Selections are hoisted to the top of their section only when the list is (re-)displayed - the\n// modal opening, or switching to another filter in the rail. Checking a box in an open list leaves\n// the row exactly where it is so nothing jumps out from under the cursor; the pinned snapshot is\n// taken again on the next display, bringing selections back to the top.\nconst pinnedValues = ref<string[]>([]);\nconst pinnedValueSet = computed(() => new Set(pinnedValues.value));\n\nconst repinSelectedValues = () => {\n  pinnedValues.value =\n    isAggregateFilter.value || activeFilter.value?.singleSelect ? [] : [...(activeFilter.value?.selectedValues ?? [])];\n};\n\nrepinSelectedValues();\n\n// Selected values that fall outside the currently displayed page (scrolled out of the loaded page,\n// or filtered out by the search query) still need to render so selections stay visible and can be\n// unchecked. Resolve them through knownOptionMap, which usePvFilterPanel seeds with the selected\n// fallback options for exactly this case. Aggregate/single-select selections are excluded (aggregate\n// selection is tracked separately; single-select shows only the current page).\nconst sectionedOptions = computed(() => {\n  if (isAggregateFilter.value || activeFilter.value?.singleSelect) return displayedOptions.value;\n  const missing = (activeFilter.value?.selectedValues ?? [])\n    .filter((value) => !displayedOptions.value.some((option) => option.value === value))\n    .map((value) => knownOptionMap.value[value] ?? { label: value, value });\n  return [...missing, ...displayedOptions.value];\n});\n\n// Groups the visible options under section headings. Section defs (from colDef context) supply the\n// label/metadata and section order; undeclared sections render after the declared ones in the order\n// they first appear, and the unlabeled (\"\") bucket always renders last. Within a section the pinned\n// selections lead, each group keeping its relative order.\nconst optionSections = computed(() => {\n  const map = new Map<string, PvFilterPanelOption[]>();\n  for (const option of sectionedOptions.value) {\n    const key = option.section ?? \"\";\n    if (!map.has(key)) map.set(key, []);\n    map.get(key)!.push(option);\n  }\n\n  const defs = activeFilter.value?.filterSectionDefs ?? [];\n  const defByKey = new Map(defs.map((def) => [def.key, def]));\n  const orderedKeys = [\n    ...defs.map((def) => def.key).filter((key) => map.has(key)),\n    ...[...map.keys()].filter((key) => key !== \"\" && !defByKey.has(key)),\n    ...(map.has(\"\") ? [\"\"] : []),\n  ];\n\n  return orderedKeys.map((key) => {\n    const def = defByKey.get(key);\n    const options = map.get(key)!;\n    return {\n      key,\n      label: def?.label ?? key,\n      section: def,\n      options: [\n        ...options.filter((option) => pinnedValueSet.value.has(option.value)),\n        ...options.filter((option) => !pinnedValueSet.value.has(option.value)),\n      ],\n    };\n  });\n});\n\nconst aggregateSelectionStatusMap = computed(() =>\n  isAggregateFilter.value && activeFilter.value\n    ? createFilterPanelAggregateSelectionStatusMap({\n        options: activeFilter.value.knownOptions ?? [],\n        state: aggregateSelectionState.value,\n      })\n    : new Map<string, { indeterminate: boolean; selected: boolean }>(),\n);\n\nconst railCount = (filter: PvFilterPanelResolvedFilter) => {\n  if (filter.isAggregate) {\n    return getFilterPanelAggregateSelectionCount(filter.aggregateSelectionState ?? []) || undefined;\n  }\n  return filter.selectedValues?.length || undefined;\n};\n\nconst getOptionSelectionStatus = (option: PvFilterPanelOption) => {\n  if (!isAggregateFilter.value) return { indeterminate: false, selected: selectedValueSet.value.has(option.value) };\n  return aggregateSelectionStatusMap.value.get(option.value) ?? { indeterminate: false, selected: false };\n};\nconst getOptionDisplayLabel = (option: PvFilterPanelOption) =>\n  activeFilter.value ? getFilterOptionLabel(option, activeFilter.value.colDef) : option.label || option.value;\nconst getOptionFilterValue = (option: PvFilterPanelOption) => getFilterPanelOptionRawValue(option) ?? option.value;\nconst getOptionFilterField = (option: PvFilterPanelOption) =>\n  getFilterPanelOptionField(option, activeFilter.value?.key ?? \"\");\n\nconst toggleOption = (option: PvFilterPanelOption, checked: boolean) => {\n  const filter = activeFilter.value;\n  if (!filter) return;\n\n  if (filter.isAggregate) {\n    handleControlChange(filter.key, {\n      type: \"aggregate-selection\",\n      value: updateFilterPanelAggregateSelectionState({\n        checked,\n        option,\n        options: filter.knownOptions ?? [],\n        state: filter.aggregateSelectionState ?? [],\n      }),\n    });\n    return;\n  }\n\n  handleControlChange(filter.key, {\n    checked,\n    field: getOptionFilterField(option),\n    type: \"value\",\n    value: getOptionFilterValue(option),\n  });\n};\n\nconst handleSelectAll = () => {\n  for (const option of displayedOptions.value) {\n    if (!getOptionSelectionStatus(option).selected) toggleOption(option, true);\n  }\n};\n\nconst handleClearSelection = () => {\n  if (isAggregateFilter.value) {\n    for (const option of flattenFilterPanelOptions(activeFilter.value?.knownOptions ?? [])) {\n      if (getOptionSelectionStatus(option).selected) toggleOption(option, false);\n    }\n    return;\n  }\n  for (const option of selectedOptions.value) {\n    toggleOption(option, false);\n  }\n};\n\nconst handleSeeMore = () => {\n  if (activeFilter.value) emit(\"load-more\", activeFilter.value.key, activeFilter.value.colDef, searchText.value.trim());\n};\n\n// Drives the rail's radio-style PvToggleButton group: reads the active filter (incl. the\n// fall-back-to-first), writes the user's pick back to the local active key.\nconst railSelection = computed<string>({\n  get: () => activeFilter.value?.key ?? \"\",\n  set: (key) => {\n    activeKey.value = key;\n  },\n});\n\nwatch(\n  () => activeFilter.value?.key,\n  (key) => {\n    searchText.value = activeFilter.value?.searchQuery ?? \"\";\n    repinSelectedValues();\n    if (key && visible.value && activeFilter.value) activateFilter(activeFilter.value);\n  },\n);\n\nwatch(visible, (isVisible) => {\n  if (!isVisible) return;\n  repinSelectedValues();\n  if (activeFilter.value) activateFilter(activeFilter.value);\n});\n\n// Debounced on the same 300ms as the search input: the facet control emits per checkbox toggle, so\n// narrowing four values costs one request rather than four. The displayed list still narrows on the\n// click, because that reads local state. Switching tabs also lands here and is absorbed by\n// `handleFacetChange`, which ignores a selection the store has already recorded.\nwatchDebounced(\n  [() => activeFilter.value?.key, facetSelectionsByFilter],\n  () => {\n    const filter = activeFilter.value;\n    if (!filter) return;\n    handleFacetChange(filter, currentFacetSelections(), searchText.value.trim());\n  },\n  { debounce: 300, deep: true, maxWait: 1000 },\n);\n\nwatchDebounced(\n  searchText,\n  (query) => {\n    const filter = activeFilter.value;\n    if (!filter) return;\n    const trimmedQuery = query.trim();\n    if (trimmedQuery !== (filter.searchQuery ?? \"\").trim()) {\n      emit(\"search-change\", filter.key, trimmedQuery, filter.colDef);\n      activateFilter(filter, trimmedQuery);\n    }\n  },\n  { debounce: 300, maxWait: 1000 },\n);\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"visible\" position=\"bottom-left\" :offset=\"8\" :z-index=\"1000\">\n    <template #trigger>\n      <slot name=\"trigger\" />\n    </template>\n\n    <template #content>\n      <div\n        class=\"pv-surface pv-bordered pv-radius-lg pv-inset-square-12\"\n        role=\"dialog\"\n        :aria-label=\"ariaLabel\"\n        :style=\"{ width: maxWidth, maxWidth }\"\n      >\n        <div class=\"pv-filter-modal pv-flex\" style=\"--flex-align: stretch; --flex-gap: 0\">\n          <nav\n            class=\"pv-filter-modal-rail pv-flex-vertical pv-border-right\"\n            aria-label=\"Filter categories\"\n            style=\"--flex-gap: 0.25rem\"\n          >\n            <PvFilterModalSelectItem\n              v-for=\"filter in railFilters\"\n              :key=\"filter.key\"\n              v-model=\"railSelection\"\n              class=\"pv-full-width pv-space-between\"\n              :deselect=\"false\"\n              :label=\"filter.label\"\n              :right-counter-badge=\"railCount(filter)\"\n              :value=\"filter.key\"\n            />\n          </nav>\n\n          <div class=\"pv-filter-modal-pane pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.75rem\">\n            <PvSearchInput\n              v-model=\"searchText\"\n              class=\"pv-full-width\"\n              :disabled=\"activeFilter?.disabled\"\n              :placeholder=\"activeFilter?.searchPlaceholder ?? 'Search'\"\n            />\n\n            <div v-if=\"Object.keys(activeFacets).length\" class=\"pv-flex\" style=\"--flex-gap: 0.5rem; flex-wrap: wrap\">\n              <PvMultiSelectButton\n                v-for=\"(facet, facetKey) in activeFacets\"\n                :key=\"`facet-${facetKey}`\"\n                :disabled=\"activeFilter?.disabled\"\n                :label=\"facet.headerName || startCase(facetKey)\"\n                :model-value=\"getSelectedFacetOptions(facetKey, facet.values)\"\n                :options=\"facetMenuOptions(facet.values)\"\n                variant=\"secondary\"\n                @update:model-value=\"(selected) => setFacetSelection(facetKey, selected)\"\n              />\n            </div>\n\n            <div v-if=\"activeFilter?.isLoading\" class=\"pv-inset-square-8\">\n              <PvSpinner size=\"sm\" />\n            </div>\n            <template v-else-if=\"activeFilter\">\n              <div class=\"pv-filter-modal-options pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.75rem\">\n                <div\n                  v-for=\"section in optionSections\"\n                  :key=\"`section-${section.key}`\"\n                  class=\"pv-flex-vertical\"\n                  style=\"--flex-align: stretch; --flex-gap: 0.25rem\"\n                >\n                  <component\n                    :is=\"activeFilter.filterSectionHeaderRenderer\"\n                    v-if=\"section.label && activeFilter.filterSectionHeaderRenderer\"\n                    :col-def=\"activeFilter.colDef\"\n                    :field=\"activeFilter.key\"\n                    :options=\"section.options\"\n                    :section=\"section.section ?? { key: section.key, label: section.label }\"\n                  />\n                  <p\n                    v-else-if=\"section.label\"\n                    class=\"pv-text-body-sm pv-text-subdued pv-stack-8\"\n                    style=\"font-weight: 500\"\n                  >\n                    {{ section.label }}\n                  </p>\n                  <div\n                    v-for=\"option in section.options\"\n                    :key=\"`option-${option.value}`\"\n                    class=\"pv-inset-square-8 pv-radius\"\n                    :class=\"{ 'pv-surface-highlight': getOptionSelectionStatus(option).selected }\"\n                  >\n                    <PvFilterPanelOptionRow\n                      :control=\"activeFilter.singleSelect ? 'radio' : 'checkbox'\"\n                      :disabled=\"activeFilter.disabled || option.isSelectable === false\"\n                      :indeterminate=\"getOptionSelectionStatus(option).indeterminate\"\n                      :label=\"getOptionDisplayLabel(option)\"\n                      :name=\"radioGroupName\"\n                      :query-text=\"searchText\"\n                      :result-count=\"getFilterOptionResultCount(option)\"\n                      :selected=\"getOptionSelectionStatus(option).selected\"\n                      :sub-text=\"option.subText\"\n                      :subdued-text=\"option.subduedText\"\n                      :value=\"option.value\"\n                      @toggle-value=\"(_, checked) => toggleOption(option, checked)\"\n                    />\n                  </div>\n                </div>\n              </div>\n\n              <p v-if=\"!displayedOptions.length\" class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">\n                No matching values.\n              </p>\n\n              <PvButton\n                v-if=\"activeFilter.hasMore\"\n                class=\"pv-text-brand\"\n                :disabled=\"activeFilter.disabled || activeFilter.isLoadingMore\"\n                label=\"See more\"\n                style=\"width: fit-content\"\n                variant=\"ghost\"\n                @click=\"handleSeeMore\"\n              />\n            </template>\n\n            <div v-if=\"activeFilter && !readOnly\" class=\"pv-filter-modal-pane-actions pv-space-between pv-border-top\">\n              <PvButton\n                v-if=\"!activeFilter.singleSelect\"\n                :disabled=\"activeFilter.disabled\"\n                :label=\"selectAllLabel\"\n                variant=\"ghost\"\n                @click=\"handleSelectAll\"\n              />\n              <PvButton\n                :disabled=\"activeFilter.disabled\"\n                :label=\"clearSelectionLabel\"\n                variant=\"ghost\"\n                @click=\"handleClearSelection\"\n              />\n            </div>\n          </div>\n        </div>\n\n        <div\n          v-if=\"staged\"\n          class=\"pv-flex pv-border-top\"\n          style=\"--flex-gap: 0.5rem; --flex-justify: flex-end; margin-top: 0.75rem; padding-top: 0.75rem\"\n        >\n          <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelStagedFilters\" />\n          <PvButton :label=\"applyLabel\" variant=\"primary\" @click=\"applyStagedFilters\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n\n<style scoped>\n.pv-filter-modal-rail {\n  --flex-align: stretch;\n  flex: 0 0 180px;\n  overflow-y: auto;\n  padding-inline-end: 1rem;\n}\n\n.pv-filter-modal-pane {\n  flex: 1 1 auto;\n  min-height: 0;\n  min-width: 0;\n  padding-inline-start: 1rem;\n}\n\n.pv-filter-modal-options {\n  /* Keep the list area a stable 360px: short lists fill it, long lists scroll internally. */\n  min-height: 360px;\n  max-height: 360px;\n  overflow-y: auto;\n}\n\n.pv-filter-modal-pane-actions {\n  margin-top: auto;\n  padding-top: 0.5rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from \"vue\";\nimport { watchDebounced } from \"@vueuse/core\";\nimport { startCase } from \"es-toolkit/string\";\n\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvMultiSelectButton from \"@/components/base/PvMultiSelectButton/PvMultiSelectButton.vue\";\nimport PvPopoverV2 from \"@/components/base/PvPopoverV2/PvPopoverV2.vue\";\nimport PvSearchInput from \"@/components/base/PvSearchInput/PvSearchInput.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport PvFilterPanelOptionRow from \"@/components/base/PvFilterPanel/PvFilterPanelOptionRow.vue\";\nimport PvFilterModalSelectItem from \"./PvFilterModalSelectItem.vue\";\nimport { usePvFilterPanel } from \"@/components/base/PvFilterPanel/usePvFilterPanel\";\nimport { getFilterOptionLabel, getFilterOptionResultCount } from \"@/components/base/PvFilterPanel/filterOptionDisplay\";\nimport {\n  createFilterPanelAggregateSelectionStatusMap,\n  getFilterPanelAggregateSelectionCount,\n  updateFilterPanelAggregateSelectionState,\n} from \"@/components/base/PvFilterPanel/aggregateFilterModel\";\nimport {\n  flattenFilterPanelOptions,\n  getFilterPanelOptionField,\n  getFilterPanelOptionRawValue,\n} from \"@/components/base/PvFilterPanel/filterOptionValue\";\nimport type {\n  PvFilterPanelEmits,\n  PvFilterPanelFacetDef,\n  PvFilterPanelFilterModel,\n  PvFilterPanelOption,\n  PvFilterPanelResolvedFilter,\n} from \"@/components/base/PvFilterPanel/types\";\nimport type { MenuOption } from \"@/types\";\nimport type { PvFilterModalProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvFilterModalProps>(), {\n  applyLabel: \"Apply\",\n  ariaLabel: \"Filters\",\n  autoHideRelatedFilterFields: undefined,\n  canRemoveFocus: true,\n  cancelLabel: \"Cancel\",\n  clearAllBody: \"Are you sure you want to clear all applied filters? This will reset your current filters.\",\n  clearAllHeader: \"Clear all filters\",\n  clearAllLabel: \"Clear all\",\n  clearSelectionLabel: \"Clear All\",\n  colDefs: () => [],\n  controlledValues: () => ({}),\n  devMode: false,\n  displayPreferencesIcon: false,\n  enableFocusView: false,\n  filterHasMoreMap: () => ({}),\n  filterLoadingMap: () => ({}),\n  filterLoadingMoreMap: () => ({}),\n  filterOptions: () => ({}),\n  filterSearchQueries: () => ({}),\n  filterSuggestions: () => [],\n  focusableFields: () => [],\n  focusedValues: () => ({}),\n  focusText: \"Focus\",\n  header: \"Filters\",\n  maxWidth: \"640px\",\n  rangeDebounceMs: 250,\n  readOnly: false,\n  selectAllLabel: \"Select All\",\n  staged: false,\n});\n\nconst filterModel = defineModel<PvFilterPanelFilterModel>(\"filterModel\", { default: null });\nconst visible = defineModel<boolean>(\"visible\", { default: false });\n\nconst emit = defineEmits<PvFilterPanelEmits>();\n\nconst {\n  resolvedFilters,\n  activateFilter,\n  applyStagedFilters,\n  cancelStagedFilters,\n  handleControlChange,\n  handleFacetChange,\n  setFacetSelections,\n  usesHandlerFacets,\n} = usePvFilterPanel(props, filterModel, emit);\n\n// View-only state: which category (rail item) is active and the active filter's search text.\nconst activeKey = ref<string | null>(null);\nconst radioGroupName = useId();\nconst searchText = ref(\"\");\n\n// The modal renders value/checkbox filters; range/boolean/exists are skipped from the rail in v1.\nconst railFilters = computed(() => resolvedFilters.value.filter((filter) => filter.type === \"value\"));\n\nconst activeFilter = computed<PvFilterPanelResolvedFilter | null>(() => {\n  const filters = railFilters.value;\n  return filters.find((filter) => filter.key === activeKey.value) ?? filters[0] ?? null;\n});\n\nconst isAggregateFilter = computed(() => activeFilter.value?.isAggregate === true);\nconst aggregateSelectionState = computed(() => activeFilter.value?.aggregateSelectionState ?? []);\nconst selectedValueSet = computed(() => new Set(activeFilter.value?.selectedValues ?? []));\nconst normalizedSearchText = computed(() => searchText.value.trim().toLowerCase());\n\nconst getSearchableOptionText = (option: PvFilterPanelOption) => {\n  const metadataValues =\n    typeof option.metadata === \"object\" && option.metadata !== null ? Object.values(option.metadata) : [];\n  return [option.value, option.label, option.subText, option.subduedText, option.matchedValue, option.matchedField]\n    .concat(metadataValues.flatMap((value) => (value === null || value === undefined ? [] : [String(value)])))\n    .filter((value): value is string => Boolean(value))\n    .join(\" \")\n    .toLowerCase();\n};\n\n// Map known option values to their full option so selected items can be rendered even when they\n// have scrolled out of the currently loaded option page.\nconst knownOptionMap = computed<Record<string, PvFilterPanelOption>>(() => {\n  const filter = activeFilter.value;\n  if (!filter) return {};\n  const map: Record<string, PvFilterPanelOption> = {};\n  for (const option of flattenFilterPanelOptions([...(filter.knownOptions ?? []), ...(filter.options ?? [])])) {\n    map[option.value] = option;\n  }\n  return map;\n});\n\n// Secondary facet filters (e.g. filtering \"Payer\" options down to a state) narrow which options are\n// displayed within the active tab. Facets are declared per colDef (colDef.context.filterPanel)\n// and matched against each option's metadata.filters[facetKey]; selections are local UI state, keyed\n// per filter tab so switching tabs doesn't lose a facet selection made earlier. Each facet's `initial`\n// value only seeds the local state once, on mount.\nconst activeFacets = computed<Record<string, PvFilterPanelFacetDef>>(\n  () => activeFilter.value?.colDef.context?.filterPanel ?? {},\n);\nconst facetSelectionsByFilter = ref<Record<string, Record<string, string[]>>>(\n  Object.fromEntries(\n    railFilters.value.flatMap((filter) => {\n      const facets = filter.colDef.context?.filterPanel;\n      const initial = Object.fromEntries(\n        Object.entries(facets ?? {}).flatMap(([facetKey, def]) =>\n          def.initial?.length ? [[facetKey, def.initial]] : [],\n        ),\n      );\n      return Object.keys(initial).length ? [[filter.key, initial]] : [];\n    }),\n  ),\n);\n\n// An options handler narrows by whatever the store last recorded, so the declared `initial` values\n// have to be there before the field's first fetch -- narrowing in the browser instead would report\n// \"no matches\" for an initial value whose options sit past the first page.\nfor (const [key, facets] of Object.entries(facetSelectionsByFilter.value)) {\n  setFacetSelections(key, facets);\n}\n\n// The modal is the only holder of facet UI state, so a store outliving it must not keep narrowing by\n// selections nothing is showing any more.\nonBeforeUnmount(() => {\n  for (const key of Object.keys(facetSelectionsByFilter.value)) {\n    setFacetSelections(key, {});\n  }\n});\n\nconst getFacetSelection = (facetKey: string): string[] => {\n  const key = activeFilter.value?.key;\n  return (key && facetSelectionsByFilter.value[key]?.[facetKey]) || [];\n};\n\n/** The active filter's facet selections, empty ones omitted. */\nconst currentFacetSelections = (): Record<string, string[]> => {\n  const key = activeFilter.value?.key;\n  if (!key) return {};\n  const selections = facetSelectionsByFilter.value[key] ?? {};\n  return Object.fromEntries(\n    Object.keys(activeFacets.value)\n      .filter((facetKey) => selections[facetKey]?.length)\n      .map((facetKey) => [facetKey, selections[facetKey]]),\n  );\n};\n\nconst facetMenuOptions = (values: string[]): MenuOption[] => values.map((value) => ({ id: value, text: value }));\n\nconst getSelectedFacetOptions = (facetKey: string, values: string[]) => {\n  const selected = new Set(getFacetSelection(facetKey));\n  return facetMenuOptions(values).filter((option) => selected.has(option.id));\n};\n\nconst setFacetSelection = (facetKey: string, options: MenuOption[]) => {\n  const filter = activeFilter.value;\n  if (!filter) return;\n  facetSelectionsByFilter.value[filter.key] = {\n    ...facetSelectionsByFilter.value[filter.key],\n    [facetKey]: options.map((option) => option.id),\n  };\n};\n\n// Only facets with an active selection narrow the list; compute their selected-value sets once per\n// render rather than per option.\nconst activeFacetSelections = computed(() =>\n  Object.keys(activeFacets.value)\n    .map((facetKey) => [facetKey, new Set(getFacetSelection(facetKey))] as const)\n    .filter(([, selected]) => selected.size > 0),\n);\n\nconst optionMatchesFacets = (option: PvFilterPanelOption) =>\n  activeFacetSelections.value.every(([facetKey, selected]) => {\n    const rawValue = option.metadata?.filters?.[facetKey];\n    // An option that says nothing about this facet is taken on trust once a handler is narrowing,\n    // since a handler that applied the facet itself need not echo `metadata.filters` back. Keeping\n    // the match otherwise means a handler that ignores `params.facets` still gets narrowed here,\n    // rather than silently showing everything.\n    if (rawValue === undefined) return usesHandlerFacets.value;\n    const optionValues = Array.isArray(rawValue) ? rawValue : [rawValue];\n    return optionValues.some((value) => selected.has(String(value)));\n  });\n\nconst displayedOptions = computed(() => {\n  const options = (activeFilter.value?.options ?? []).filter(optionMatchesFacets);\n  const query = normalizedSearchText.value;\n  if (!query) return options;\n  return options.filter((option) => getSearchableOptionText(option).includes(query));\n});\n\nconst selectedOptions = computed(() => {\n  if (isAggregateFilter.value || activeFilter.value?.singleSelect) return [];\n  return (activeFilter.value?.selectedValues ?? []).map(\n    (value) => knownOptionMap.value[value] ?? { label: value, value },\n  );\n});\n\n// Selections are hoisted to the top of their section only when the list is (re-)displayed - the\n// modal opening, or switching to another filter in the rail. Checking a box in an open list leaves\n// the row exactly where it is so nothing jumps out from under the cursor; the pinned snapshot is\n// taken again on the next display, bringing selections back to the top.\nconst pinnedValues = ref<string[]>([]);\nconst pinnedValueSet = computed(() => new Set(pinnedValues.value));\n\nconst repinSelectedValues = () => {\n  pinnedValues.value =\n    isAggregateFilter.value || activeFilter.value?.singleSelect ? [] : [...(activeFilter.value?.selectedValues ?? [])];\n};\n\nrepinSelectedValues();\n\n// Selected values that fall outside the currently displayed page (scrolled out of the loaded page,\n// or filtered out by the search query) still need to render so selections stay visible and can be\n// unchecked. Resolve them through knownOptionMap, which usePvFilterPanel seeds with the selected\n// fallback options for exactly this case. Aggregate/single-select selections are excluded (aggregate\n// selection is tracked separately; single-select shows only the current page).\nconst sectionedOptions = computed(() => {\n  if (isAggregateFilter.value || activeFilter.value?.singleSelect) return displayedOptions.value;\n  const missing = (activeFilter.value?.selectedValues ?? [])\n    .filter((value) => !displayedOptions.value.some((option) => option.value === value))\n    .map((value) => knownOptionMap.value[value] ?? { label: value, value });\n  return [...missing, ...displayedOptions.value];\n});\n\n// Groups the visible options under section headings. Section defs (from colDef context) supply the\n// label/metadata and section order; undeclared sections render after the declared ones in the order\n// they first appear, and the unlabeled (\"\") bucket always renders last. Within a section the pinned\n// selections lead, each group keeping its relative order.\nconst optionSections = computed(() => {\n  const map = new Map<string, PvFilterPanelOption[]>();\n  for (const option of sectionedOptions.value) {\n    const key = option.section ?? \"\";\n    if (!map.has(key)) map.set(key, []);\n    map.get(key)!.push(option);\n  }\n\n  const defs = activeFilter.value?.filterSectionDefs ?? [];\n  const defByKey = new Map(defs.map((def) => [def.key, def]));\n  const orderedKeys = [\n    ...defs.map((def) => def.key).filter((key) => map.has(key)),\n    ...[...map.keys()].filter((key) => key !== \"\" && !defByKey.has(key)),\n    ...(map.has(\"\") ? [\"\"] : []),\n  ];\n\n  return orderedKeys.map((key) => {\n    const def = defByKey.get(key);\n    const options = map.get(key)!;\n    return {\n      key,\n      label: def?.label ?? key,\n      section: def,\n      options: [\n        ...options.filter((option) => pinnedValueSet.value.has(option.value)),\n        ...options.filter((option) => !pinnedValueSet.value.has(option.value)),\n      ],\n    };\n  });\n});\n\nconst aggregateSelectionStatusMap = computed(() =>\n  isAggregateFilter.value && activeFilter.value\n    ? createFilterPanelAggregateSelectionStatusMap({\n        options: activeFilter.value.knownOptions ?? [],\n        state: aggregateSelectionState.value,\n      })\n    : new Map<string, { indeterminate: boolean; selected: boolean }>(),\n);\n\nconst railCount = (filter: PvFilterPanelResolvedFilter) => {\n  if (filter.isAggregate) {\n    return getFilterPanelAggregateSelectionCount(filter.aggregateSelectionState ?? []) || undefined;\n  }\n  return filter.selectedValues?.length || undefined;\n};\n\nconst getOptionSelectionStatus = (option: PvFilterPanelOption) => {\n  if (!isAggregateFilter.value) return { indeterminate: false, selected: selectedValueSet.value.has(option.value) };\n  return aggregateSelectionStatusMap.value.get(option.value) ?? { indeterminate: false, selected: false };\n};\nconst getOptionDisplayLabel = (option: PvFilterPanelOption) =>\n  activeFilter.value ? getFilterOptionLabel(option, activeFilter.value.colDef) : option.label || option.value;\nconst getOptionFilterValue = (option: PvFilterPanelOption) => getFilterPanelOptionRawValue(option) ?? option.value;\nconst getOptionFilterField = (option: PvFilterPanelOption) =>\n  getFilterPanelOptionField(option, activeFilter.value?.key ?? \"\");\n\nconst toggleOption = (option: PvFilterPanelOption, checked: boolean) => {\n  const filter = activeFilter.value;\n  if (!filter) return;\n\n  if (filter.isAggregate) {\n    handleControlChange(filter.key, {\n      type: \"aggregate-selection\",\n      value: updateFilterPanelAggregateSelectionState({\n        checked,\n        option,\n        options: filter.knownOptions ?? [],\n        state: filter.aggregateSelectionState ?? [],\n      }),\n    });\n    return;\n  }\n\n  handleControlChange(filter.key, {\n    checked,\n    field: getOptionFilterField(option),\n    type: \"value\",\n    value: getOptionFilterValue(option),\n  });\n};\n\nconst handleSelectAll = () => {\n  for (const option of displayedOptions.value) {\n    if (!getOptionSelectionStatus(option).selected) toggleOption(option, true);\n  }\n};\n\nconst handleClearSelection = () => {\n  if (isAggregateFilter.value) {\n    for (const option of flattenFilterPanelOptions(activeFilter.value?.knownOptions ?? [])) {\n      if (getOptionSelectionStatus(option).selected) toggleOption(option, false);\n    }\n    return;\n  }\n  for (const option of selectedOptions.value) {\n    toggleOption(option, false);\n  }\n};\n\nconst handleSeeMore = () => {\n  if (activeFilter.value) emit(\"load-more\", activeFilter.value.key, activeFilter.value.colDef, searchText.value.trim());\n};\n\n// Drives the rail's radio-style PvToggleButton group: reads the active filter (incl. the\n// fall-back-to-first), writes the user's pick back to the local active key.\nconst railSelection = computed<string>({\n  get: () => activeFilter.value?.key ?? \"\",\n  set: (key) => {\n    activeKey.value = key;\n  },\n});\n\nwatch(\n  () => activeFilter.value?.key,\n  (key) => {\n    searchText.value = activeFilter.value?.searchQuery ?? \"\";\n    repinSelectedValues();\n    if (key && visible.value && activeFilter.value) activateFilter(activeFilter.value);\n  },\n);\n\nwatch(visible, (isVisible) => {\n  if (!isVisible) return;\n  repinSelectedValues();\n  if (activeFilter.value) activateFilter(activeFilter.value);\n});\n\n// Debounced on the same 300ms as the search input: the facet control emits per checkbox toggle, so\n// narrowing four values costs one request rather than four. The displayed list still narrows on the\n// click, because that reads local state. Switching tabs also lands here and is absorbed by\n// `handleFacetChange`, which ignores a selection the store has already recorded.\nwatchDebounced(\n  [() => activeFilter.value?.key, facetSelectionsByFilter],\n  () => {\n    const filter = activeFilter.value;\n    if (!filter) return;\n    handleFacetChange(filter, currentFacetSelections(), searchText.value.trim());\n  },\n  { debounce: 300, deep: true, maxWait: 1000 },\n);\n\nwatchDebounced(\n  searchText,\n  (query) => {\n    const filter = activeFilter.value;\n    if (!filter) return;\n    const trimmedQuery = query.trim();\n    if (trimmedQuery !== (filter.searchQuery ?? \"\").trim()) {\n      emit(\"search-change\", filter.key, trimmedQuery, filter.colDef);\n      activateFilter(filter, trimmedQuery);\n    }\n  },\n  { debounce: 300, maxWait: 1000 },\n);\n</script>\n\n<template>\n  <PvPopoverV2 v-model=\"visible\" position=\"bottom-left\" :offset=\"8\" :z-index=\"1000\">\n    <template #trigger>\n      <slot name=\"trigger\" />\n    </template>\n\n    <template #content>\n      <div\n        class=\"pv-surface pv-bordered pv-radius-lg pv-inset-square-12\"\n        role=\"dialog\"\n        :aria-label=\"ariaLabel\"\n        :style=\"{ width: maxWidth, maxWidth }\"\n      >\n        <div class=\"pv-filter-modal pv-flex\" style=\"--flex-align: stretch; --flex-gap: 0\">\n          <nav\n            class=\"pv-filter-modal-rail pv-flex-vertical pv-border-right\"\n            aria-label=\"Filter categories\"\n            style=\"--flex-gap: 0.25rem\"\n          >\n            <PvFilterModalSelectItem\n              v-for=\"filter in railFilters\"\n              :key=\"filter.key\"\n              v-model=\"railSelection\"\n              class=\"pv-full-width pv-space-between\"\n              :deselect=\"false\"\n              :label=\"filter.label\"\n              :right-counter-badge=\"railCount(filter)\"\n              :value=\"filter.key\"\n            />\n          </nav>\n\n          <div class=\"pv-filter-modal-pane pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.75rem\">\n            <PvSearchInput\n              v-model=\"searchText\"\n              class=\"pv-full-width\"\n              :disabled=\"activeFilter?.disabled\"\n              :placeholder=\"activeFilter?.searchPlaceholder ?? 'Search'\"\n            />\n\n            <div v-if=\"Object.keys(activeFacets).length\" class=\"pv-flex\" style=\"--flex-gap: 0.5rem; flex-wrap: wrap\">\n              <PvMultiSelectButton\n                v-for=\"(facet, facetKey) in activeFacets\"\n                :key=\"`facet-${facetKey}`\"\n                :disabled=\"activeFilter?.disabled\"\n                :label=\"facet.headerName || startCase(facetKey)\"\n                :model-value=\"getSelectedFacetOptions(facetKey, facet.values)\"\n                :options=\"facetMenuOptions(facet.values)\"\n                variant=\"secondary\"\n                @update:model-value=\"(selected) => setFacetSelection(facetKey, selected)\"\n              />\n            </div>\n\n            <div v-if=\"activeFilter?.isLoading\" class=\"pv-inset-square-8\">\n              <PvSpinner size=\"sm\" />\n            </div>\n            <template v-else-if=\"activeFilter\">\n              <div class=\"pv-filter-modal-options pv-flex-vertical\" style=\"--flex-align: stretch; --flex-gap: 0.75rem\">\n                <div\n                  v-for=\"section in optionSections\"\n                  :key=\"`section-${section.key}`\"\n                  class=\"pv-flex-vertical\"\n                  style=\"--flex-align: stretch; --flex-gap: 0.25rem\"\n                >\n                  <component\n                    :is=\"activeFilter.filterSectionHeaderRenderer\"\n                    v-if=\"section.label && activeFilter.filterSectionHeaderRenderer\"\n                    :col-def=\"activeFilter.colDef\"\n                    :field=\"activeFilter.key\"\n                    :options=\"section.options\"\n                    :section=\"section.section ?? { key: section.key, label: section.label }\"\n                  />\n                  <p\n                    v-else-if=\"section.label\"\n                    class=\"pv-text-body-sm pv-text-subdued pv-stack-8\"\n                    style=\"font-weight: 500\"\n                  >\n                    {{ section.label }}\n                  </p>\n                  <div\n                    v-for=\"option in section.options\"\n                    :key=\"`option-${option.value}`\"\n                    class=\"pv-inset-square-8 pv-radius\"\n                    :class=\"{ 'pv-surface-highlight': getOptionSelectionStatus(option).selected }\"\n                  >\n                    <PvFilterPanelOptionRow\n                      :control=\"activeFilter.singleSelect ? 'radio' : 'checkbox'\"\n                      :disabled=\"activeFilter.disabled || option.isSelectable === false\"\n                      :indeterminate=\"getOptionSelectionStatus(option).indeterminate\"\n                      :label=\"getOptionDisplayLabel(option)\"\n                      :name=\"radioGroupName\"\n                      :query-text=\"searchText\"\n                      :result-count=\"getFilterOptionResultCount(option)\"\n                      :selected=\"getOptionSelectionStatus(option).selected\"\n                      :sub-text=\"option.subText\"\n                      :subdued-text=\"option.subduedText\"\n                      :value=\"option.value\"\n                      @toggle-value=\"(_, checked) => toggleOption(option, checked)\"\n                    />\n                  </div>\n                </div>\n              </div>\n\n              <p v-if=\"!displayedOptions.length\" class=\"pv-text-body-xs pv-text-subdued\" style=\"margin: 0\">\n                No matching values.\n              </p>\n\n              <PvButton\n                v-if=\"activeFilter.hasMore\"\n                class=\"pv-text-brand\"\n                :disabled=\"activeFilter.disabled || activeFilter.isLoadingMore\"\n                label=\"See more\"\n                style=\"width: fit-content\"\n                variant=\"ghost\"\n                @click=\"handleSeeMore\"\n              />\n            </template>\n\n            <div v-if=\"activeFilter && !readOnly\" class=\"pv-filter-modal-pane-actions pv-space-between pv-border-top\">\n              <PvButton\n                v-if=\"!activeFilter.singleSelect\"\n                :disabled=\"activeFilter.disabled\"\n                :label=\"selectAllLabel\"\n                variant=\"ghost\"\n                @click=\"handleSelectAll\"\n              />\n              <PvButton\n                :disabled=\"activeFilter.disabled\"\n                :label=\"clearSelectionLabel\"\n                variant=\"ghost\"\n                @click=\"handleClearSelection\"\n              />\n            </div>\n          </div>\n        </div>\n\n        <div\n          v-if=\"staged\"\n          class=\"pv-flex pv-border-top\"\n          style=\"--flex-gap: 0.5rem; --flex-justify: flex-end; margin-top: 0.75rem; padding-top: 0.75rem\"\n        >\n          <PvButton :label=\"cancelLabel\" variant=\"ghost\" @click=\"cancelStagedFilters\" />\n          <PvButton :label=\"applyLabel\" variant=\"primary\" @click=\"applyStagedFilters\" />\n        </div>\n      </div>\n    </template>\n  </PvPopoverV2>\n</template>\n\n<style scoped>\n.pv-filter-modal-rail {\n  --flex-align: stretch;\n  flex: 0 0 180px;\n  overflow-y: auto;\n  padding-inline-end: 1rem;\n}\n\n.pv-filter-modal-pane {\n  flex: 1 1 auto;\n  min-height: 0;\n  min-width: 0;\n  padding-inline-start: 1rem;\n}\n\n.pv-filter-modal-options {\n  /* Keep the list area a stable 360px: short lists fill it, long lists scroll internally. */\n  min-height: 360px;\n  max-height: 360px;\n  overflow-y: auto;\n}\n\n.pv-filter-modal-pane-actions {\n  margin-top: auto;\n  padding-top: 0.5rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvActionBar from \"@/components/base/PvActionBar/PvActionBar.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { MenuOption, MenuOptionSelectedEvent } from \"@/types\";\nimport type { PvHoverActionMenuProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvHoverActionMenuProps>(), {\n  disabled: false,\n  options: () => [],\n  position: \"top-right\",\n  variant: \"white\",\n});\n\nconst emit = defineEmits<{\n  \"option-select\": [payload: MenuOptionSelectedEvent];\n}>();\n\ndefineSlots<{\n  /**\n   * Content the actions are attached to. When options are present the wrapper\n   * is focusable, so the actions reveal on hover or focus within without\n   * requiring the slotted content to be focusable.\n   */\n  default(): never;\n}>();\n\nconst positionClass = computed(() => `pv-hover-action-menu--${props.position}`);\n\nconst handleSelect = (option: MenuOption, event: MouseEvent) => {\n  if (props.disabled || option.disabled) return;\n  emit(\"option-select\", { option, event });\n};\n</script>\n\n<template>\n  <div\n    class=\"pv-hover-action-menu\"\n    :class=\"positionClass\"\n    :tabindex=\"options.length ? 0 : undefined\"\n    data-testid=\"pv-hover-action-menu\"\n  >\n    <slot name=\"default\" />\n    <div v-if=\"options.length\" class=\"pv-hover-action-menu__actions\">\n      <PvActionBar :variant=\"variant\" data-testid=\"pv-hover-action-menu-actions\" @click.stop>\n        <div class=\"pv-hover-action-menu__action-group\">\n          <PvTooltipV2\n            v-for=\"option in options\"\n            :key=\"option.id\"\n            variant=\"dark\"\n            position=\"top-center\"\n            :description=\"option.icon ? option.text : undefined\"\n          >\n            <template #trigger>\n              <PvButton\n                variant=\"ghost\"\n                size=\"md\"\n                :leftIcon=\"option.icon\"\n                :label=\"option.icon ? undefined : option.text\"\n                :ariaLabel=\"option.text\"\n                :disabled=\"disabled || option.disabled\"\n                :inverse=\"variant === 'dark'\"\n                :class=\"['pv-hover-action-menu__button', option.classList]\"\n                @click=\"(event) => handleSelect(option, event)\"\n              />\n            </template>\n          </PvTooltipV2>\n        </div>\n      </PvActionBar>\n    </div>\n  </div>\n</template>\n\n<style scoped>\n.pv-hover-action-menu {\n  position: relative;\n}\n\n.pv-hover-action-menu__actions {\n  position: absolute;\n  display: none;\n  z-index: 1;\n}\n\n.pv-hover-action-menu:hover > .pv-hover-action-menu__actions,\n.pv-hover-action-menu:focus-within > .pv-hover-action-menu__actions {\n  display: flex;\n}\n\n.pv-hover-action-menu--top-right > .pv-hover-action-menu__actions {\n  top: var(--pv-hover-action-menu-offset-block, 8px);\n  right: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu--top-left > .pv-hover-action-menu__actions {\n  top: var(--pv-hover-action-menu-offset-block, 8px);\n  left: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu--bottom-right > .pv-hover-action-menu__actions {\n  right: var(--pv-hover-action-menu-offset-inline, 8px);\n  bottom: var(--pv-hover-action-menu-offset-block, 8px);\n}\n\n.pv-hover-action-menu--bottom-left > .pv-hover-action-menu__actions {\n  bottom: var(--pv-hover-action-menu-offset-block, 8px);\n  left: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu__button:deep(.pv-icon) {\n  margin: 0;\n}\n\n.pv-hover-action-menu__button,\n.pv-hover-action-menu__button:deep(button) {\n  opacity: 0.7;\n}\n\n.pv-hover-action-menu__button:hover:not(:disabled),\n.pv-hover-action-menu__button:deep(button:hover:not(:disabled)) {\n  opacity: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvActionBar from \"@/components/base/PvActionBar/PvActionBar.vue\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvTooltipV2 from \"@/components/base/PvTooltipV2/PvTooltipV2.vue\";\nimport type { MenuOption, MenuOptionSelectedEvent } from \"@/types\";\nimport type { PvHoverActionMenuProps } from \"./types\";\n\nconst props = withDefaults(defineProps<PvHoverActionMenuProps>(), {\n  disabled: false,\n  options: () => [],\n  position: \"top-right\",\n  variant: \"white\",\n});\n\nconst emit = defineEmits<{\n  \"option-select\": [payload: MenuOptionSelectedEvent];\n}>();\n\ndefineSlots<{\n  /**\n   * Content the actions are attached to. When options are present the wrapper\n   * is focusable, so the actions reveal on hover or focus within without\n   * requiring the slotted content to be focusable.\n   */\n  default(): never;\n}>();\n\nconst positionClass = computed(() => `pv-hover-action-menu--${props.position}`);\n\nconst handleSelect = (option: MenuOption, event: MouseEvent) => {\n  if (props.disabled || option.disabled) return;\n  emit(\"option-select\", { option, event });\n};\n</script>\n\n<template>\n  <div\n    class=\"pv-hover-action-menu\"\n    :class=\"positionClass\"\n    :tabindex=\"options.length ? 0 : undefined\"\n    data-testid=\"pv-hover-action-menu\"\n  >\n    <slot name=\"default\" />\n    <div v-if=\"options.length\" class=\"pv-hover-action-menu__actions\">\n      <PvActionBar :variant=\"variant\" data-testid=\"pv-hover-action-menu-actions\" @click.stop>\n        <div class=\"pv-hover-action-menu__action-group\">\n          <PvTooltipV2\n            v-for=\"option in options\"\n            :key=\"option.id\"\n            variant=\"dark\"\n            position=\"top-center\"\n            :description=\"option.icon ? option.text : undefined\"\n          >\n            <template #trigger>\n              <PvButton\n                variant=\"ghost\"\n                size=\"md\"\n                :leftIcon=\"option.icon\"\n                :label=\"option.icon ? undefined : option.text\"\n                :ariaLabel=\"option.text\"\n                :disabled=\"disabled || option.disabled\"\n                :inverse=\"variant === 'dark'\"\n                :class=\"['pv-hover-action-menu__button', option.classList]\"\n                @click=\"(event) => handleSelect(option, event)\"\n              />\n            </template>\n          </PvTooltipV2>\n        </div>\n      </PvActionBar>\n    </div>\n  </div>\n</template>\n\n<style scoped>\n.pv-hover-action-menu {\n  position: relative;\n}\n\n.pv-hover-action-menu__actions {\n  position: absolute;\n  display: none;\n  z-index: 1;\n}\n\n.pv-hover-action-menu:hover > .pv-hover-action-menu__actions,\n.pv-hover-action-menu:focus-within > .pv-hover-action-menu__actions {\n  display: flex;\n}\n\n.pv-hover-action-menu--top-right > .pv-hover-action-menu__actions {\n  top: var(--pv-hover-action-menu-offset-block, 8px);\n  right: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu--top-left > .pv-hover-action-menu__actions {\n  top: var(--pv-hover-action-menu-offset-block, 8px);\n  left: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu--bottom-right > .pv-hover-action-menu__actions {\n  right: var(--pv-hover-action-menu-offset-inline, 8px);\n  bottom: var(--pv-hover-action-menu-offset-block, 8px);\n}\n\n.pv-hover-action-menu--bottom-left > .pv-hover-action-menu__actions {\n  bottom: var(--pv-hover-action-menu-offset-block, 8px);\n  left: var(--pv-hover-action-menu-offset-inline, 8px);\n}\n\n.pv-hover-action-menu__button:deep(.pv-icon) {\n  margin: 0;\n}\n\n.pv-hover-action-menu__button,\n.pv-hover-action-menu__button:deep(button) {\n  opacity: 0.7;\n}\n\n.pv-hover-action-menu__button:hover:not(:disabled),\n.pv-hover-action-menu__button:deep(button:hover:not(:disabled)) {\n  opacity: 1;\n}\n</style>\n","import { MenuOption } from \"@/types\";\n\n// The query builder can be used in two modes:\n// 1. Full - the query is parsed and populates both the filter model and free text terms.\n// 2. Field-only - the query is parsed to extract only the filter model, treating free-text terms as invalid\nexport type QueryBuilderProcessor = \"full\" | \"field-only\";\n\nexport interface QueryBuilderOutput {\n  queryTerms: QueryTerm[];\n  freeTextTerms?: string[];\n}\n\nexport interface QueryTerm {\n  queryField?: string;\n  queryDisplayField?: string;\n  exactMatch?: boolean;\n  matchMode?: \"words\";\n  queryText?: string;\n}\n\nexport interface QueryBuilderSuggestionMenuOption extends MenuOption<QueryTerm> {\n  queryTerm?: QueryTerm;\n}\n\n/**\n * The filter model is structured as follows:\n * For single conditions\n * {\n *     [field]: {\n *      filterType: \"text\",\n *      type: \"equals\" | \"contains\",\n *      filter: string,\n *     },\n * }\n * For multiple conditions on the same field, it will be structured as:\n * {\n *    [field]: {\n *     filterType: \"text\",\n *     operator: 'OR',\n *     conditions: [\n *         {\n *         type: \"equals\" | \"contains\",\n *         filter: string,\n *         }\n *     ]\n *    },\n * }\n */\n\nexport const useQueryBuilder = () => {\n  const addQueryOption = (\n    query: QueryBuilderOutput | null,\n    option: QueryBuilderSuggestionMenuOption,\n  ): QueryBuilderOutput | null => {\n    const updatedQuery = query || { queryTerms: [] };\n    const newQueryTerm = option.queryTerm || {};\n    if (isValidQueryTerm(option) && !containsQueryOption(query, option)) {\n      updatedQuery.queryTerms.push(newQueryTerm);\n    }\n    return updatedQuery;\n  };\n  const isValidQueryTerm = (option: QueryBuilderSuggestionMenuOption): boolean => {\n    // don't allow blank query terms\n    if (!option.queryTerm) return false;\n    return option.queryTerm.queryText !== undefined && option.queryTerm.queryText.trim() !== \"\";\n  };\n  const queryTermEquals = (a: QueryTerm, b: QueryTerm): boolean => {\n    return (\n      a.queryField === b.queryField &&\n      a.exactMatch === b.exactMatch &&\n      a.matchMode === b.matchMode &&\n      a.queryText === b.queryText &&\n      a.queryDisplayField === b.queryDisplayField\n    );\n  };\n  const containsQueryOption = (query: QueryBuilderOutput | null, option: QueryBuilderSuggestionMenuOption): boolean => {\n    return !!query && query.queryTerms.some((term) => queryTermEquals(term, option.queryTerm || {}));\n  };\n  const removeQueryOption = (\n    query: QueryBuilderOutput | null,\n    option: QueryBuilderSuggestionMenuOption,\n  ): QueryBuilderOutput | null => {\n    if (!query) return null;\n\n    return {\n      ...query,\n      queryTerms: query.queryTerms.filter((term) => !queryTermEquals(term, option.queryTerm || {})),\n    };\n  };\n  return {\n    addQueryOption,\n    containsQueryOption,\n    removeQueryOption,\n  };\n};\n","<script setup lang=\"ts\">\nimport {\n  QueryBuilderOutput,\n  QueryBuilderSuggestionMenuOption,\n  QueryTerm,\n  useQueryBuilder,\n} from \"@/components/base/PvQueryBuilderInput/useQueryBuilder\";\nimport PvTag from \"@/components/base/PvTag/PvTag.vue\";\nimport { computed } from \"vue\";\nimport { TagVariant } from \"@/components/base/PvTag/types\";\n\ninterface QueryFormatterProps {\n  queryTermDisplayLimit?: number;\n}\n\nconst props = withDefaults(defineProps<QueryFormatterProps>(), {\n  queryTermDisplayLimit: 3,\n});\n\nconst parsedQuery = defineModel<QueryBuilderOutput | null>({ required: true });\nconst wrapContent = defineModel<boolean>(\"wrap-content\", { required: false, default: false });\nconst { removeQueryOption } = useQueryBuilder();\n\nconst displayedQueryTerms = computed(() => {\n  // extract filter terms from parsedQuery\n  // if enableItemWrap is true, show all terms\n  const terms = parsedQuery.value?.queryTerms || [];\n  return wrapContent.value ? terms : terms.slice(0, props.queryTermDisplayLimit);\n});\n\nconst overflowQueryTermCount = computed(() => {\n  const availableQueryTermCount = parsedQuery.value?.queryTerms.length || 0;\n  const currentDisplayCount = displayedQueryTerms.value.length;\n  return availableQueryTermCount - currentDisplayCount;\n});\n\nconst tagLabelForQueryTerm = (term: QueryTerm) => {\n  // Free text has no column to name, so it stands alone. Anything scoped to a column\n  // is prefixed with that column, because the same value can appear under several of\n  // them. Quotes mark a substring match; an exact match is a literal value.\n  if (!term.queryField) return term.queryText || \"\";\n  const displayField = term.queryDisplayField || term.queryField;\n  return term.exactMatch ? `${displayField}: ${term.queryText}` : `${displayField}: '${term.queryText}'`;\n};\n\nconst tagVariantForQueryTerm = (term: QueryTerm): TagVariant => {\n  // return variant based on term type\n  return term.exactMatch ? \"primary\" : \"tertiary\";\n};\n\nconst handleTagClick = (term: QueryTerm) => {\n  const queryOption: QueryBuilderSuggestionMenuOption = {\n    id: \"id\",\n    text: term.queryText || \"\",\n    queryTerm: term,\n  };\n  parsedQuery.value = removeQueryOption(parsedQuery.value, queryOption);\n};\n</script>\n\n<template>\n  <PvTag\n    v-for=\"(queryTerm, index) in displayedQueryTerms\"\n    :key=\"`${index}-${queryTerm.queryText}`\"\n    :variant=\"tagVariantForQueryTerm(queryTerm)\"\n    :label=\"tagLabelForQueryTerm(queryTerm)\"\n    :show-clear=\"true\"\n    @handle-close=\"handleTagClick(queryTerm)\"\n  />\n  <PvTag v-if=\"overflowQueryTermCount > 0\" :label=\"`+${overflowQueryTermCount}`\" @handle-click=\"wrapContent = true\" />\n</template>\n","<script setup lang=\"ts\">\nimport {\n  QueryBuilderOutput,\n  QueryBuilderSuggestionMenuOption,\n  QueryTerm,\n  useQueryBuilder,\n} from \"@/components/base/PvQueryBuilderInput/useQueryBuilder\";\nimport PvTag from \"@/components/base/PvTag/PvTag.vue\";\nimport { computed } from \"vue\";\nimport { TagVariant } from \"@/components/base/PvTag/types\";\n\ninterface QueryFormatterProps {\n  queryTermDisplayLimit?: number;\n}\n\nconst props = withDefaults(defineProps<QueryFormatterProps>(), {\n  queryTermDisplayLimit: 3,\n});\n\nconst parsedQuery = defineModel<QueryBuilderOutput | null>({ required: true });\nconst wrapContent = defineModel<boolean>(\"wrap-content\", { required: false, default: false });\nconst { removeQueryOption } = useQueryBuilder();\n\nconst displayedQueryTerms = computed(() => {\n  // extract filter terms from parsedQuery\n  // if enableItemWrap is true, show all terms\n  const terms = parsedQuery.value?.queryTerms || [];\n  return wrapContent.value ? terms : terms.slice(0, props.queryTermDisplayLimit);\n});\n\nconst overflowQueryTermCount = computed(() => {\n  const availableQueryTermCount = parsedQuery.value?.queryTerms.length || 0;\n  const currentDisplayCount = displayedQueryTerms.value.length;\n  return availableQueryTermCount - currentDisplayCount;\n});\n\nconst tagLabelForQueryTerm = (term: QueryTerm) => {\n  // Free text has no column to name, so it stands alone. Anything scoped to a column\n  // is prefixed with that column, because the same value can appear under several of\n  // them. Quotes mark a substring match; an exact match is a literal value.\n  if (!term.queryField) return term.queryText || \"\";\n  const displayField = term.queryDisplayField || term.queryField;\n  return term.exactMatch ? `${displayField}: ${term.queryText}` : `${displayField}: '${term.queryText}'`;\n};\n\nconst tagVariantForQueryTerm = (term: QueryTerm): TagVariant => {\n  // return variant based on term type\n  return term.exactMatch ? \"primary\" : \"tertiary\";\n};\n\nconst handleTagClick = (term: QueryTerm) => {\n  const queryOption: QueryBuilderSuggestionMenuOption = {\n    id: \"id\",\n    text: term.queryText || \"\",\n    queryTerm: term,\n  };\n  parsedQuery.value = removeQueryOption(parsedQuery.value, queryOption);\n};\n</script>\n\n<template>\n  <PvTag\n    v-for=\"(queryTerm, index) in displayedQueryTerms\"\n    :key=\"`${index}-${queryTerm.queryText}`\"\n    :variant=\"tagVariantForQueryTerm(queryTerm)\"\n    :label=\"tagLabelForQueryTerm(queryTerm)\"\n    :show-clear=\"true\"\n    @handle-close=\"handleTagClick(queryTerm)\"\n  />\n  <PvTag v-if=\"overflowQueryTermCount > 0\" :label=\"`+${overflowQueryTermCount}`\" @handle-click=\"wrapContent = true\" />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ComputedRef, nextTick, ref, useId, useSlots, useTemplateRef, watch } from \"vue\";\nimport {\n  QueryBuilderOutput,\n  QueryBuilderProcessor,\n  QueryBuilderSuggestionMenuOption,\n  QueryTerm,\n  useQueryBuilder,\n} from \"@/components/base/PvQueryBuilderInput/useQueryBuilder\";\nimport PvPopover from \"@/components/base/PvPopover/PvPopover.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvMenuItem from \"@/components/base/PvMenu/items/PvMenuItem.vue\";\nimport { vOnClickOutside } from \"@vueuse/components\";\nimport QueryFormatter from \"@/components/base/PvQueryBuilderInput/QueryFormatter.vue\";\nimport type { MenuOption, MenuOptionConfig } from \"@/types\";\nimport type { PvSize } from \"@/components/base/baseProps\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport { onKeyStroke } from \"@vueuse/core\";\n\nexport interface PvQueryBuilderInputProps {\n  /**\n   * Placeholder text shown in the input when no query is active.\n   */\n  placeholder?: string;\n  /**\n   * When true, the input is non-interactive and visually dimmed.\n   */\n  disabled?: boolean;\n  /** When true, displays a keyboard shortcut badge next to the input. */\n  displayShortcut?: boolean;\n  /**\n   * Determines how user input is parsed into structured query terms.\n   * - `'full'`: free-text and field-based queries.\n   * - `'field-only'`: only options with a queryField are shown.\n   */\n  processor?: QueryBuilderProcessor;\n  /**\n   * When true, shows a loading spinner in the suggestion dropdown.\n   */\n  optionsLoading?: boolean;\n  /** Matches PvSearchInput sizing. */\n  size?: Extract<PvSize, \"lg\" | \"xl\">;\n  /**\n   * When true, users can press Enter to add free-text terms without selecting a suggestion.\n   */\n  enableCustomOptionsInput?: boolean;\n  /**\n   * When true, hides the search icon on the left side of the input.\n   */\n  hideSearchIcon?: boolean;\n  /**\n   * When true, hides the clear button that resets the query.\n   */\n  hideClearButton?: boolean;\n  /**\n   * Maximum number of query term pills to display before collapsing.\n   */\n  queryTermDisplayLimit?: number;\n  /**\n   * When true, query term pills wrap to the next line instead of scrolling horizontally.\n   */\n  enableWrapQueryTerms?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvQueryBuilderInputProps>(), {\n  placeholder: \"Search\",\n  disabled: false,\n  processor: \"full\",\n  optionsLoading: false,\n  enableCustomOptionsInput: false,\n  hideSearchIcon: false,\n  hideClearButton: false,\n  queryTermDisplayLimit: 3,\n  enableWrapQueryTerms: false,\n  size: \"xl\",\n});\n\n// \"icon\" keeps PvMenuBaseItem's opt-in row icon; options without an icon render without one.\nconst menuOptionConfig: MenuOptionConfig = {\n  variant: \"icon\",\n};\n\n// Figma's Surface/card-hover, scoped to this popover so other menus keep the default hover.\nconst popoverCssProperties = {\n  width: \"100%\",\n  maxWidth: \"100%\",\n  \"--popover-list-item-hover-background-color\": \"var(--surface-card-hover, #ece8e2)\",\n};\n\nconst input = useTemplateRef<HTMLInputElement | null>(\"search-input\");\nconst inputText = defineModel<string>(\"searchText\", { required: false, default: \"\" });\nconst parsedQuery = defineModel<QueryBuilderOutput | null>(\"query\", { required: true });\nconst queryOptions = defineModel<QueryBuilderSuggestionMenuOption[]>(\"options\", {\n  required: false,\n});\nconst { addQueryOption, containsQueryOption, removeQueryOption } = useQueryBuilder();\nconst displayOptions = ref(false);\nconst isCurrentInputFocused = ref(false);\nconst wrapContent = ref(false);\n\nconst slots = useSlots();\n// The popover used to exist only when there were options to list. Consumers that supply\n// their own sections still need it, so a header, footer, or empty slot keeps it mounted.\n// With no slots supplied this stays false and the menu behaves exactly as it did before.\nconst hasPopoverSlots = computed(() => Boolean(slots.header || slots.footer || slots.empty));\n\nconst componentId = useId();\nconst optionListId = `${componentId}-options`;\n// Positional ids: a consumer repeating an option id would otherwise produce duplicate DOM\n// ids and break aria-activedescendant.\nconst optionDomId = (index: number) => `${componentId}-option-${index}`;\nconst groupLabelId = (groupIndex: number) => `${componentId}-group-${groupIndex}`;\nconst showPopover = computed(() => availableOptions.value.length > 0 || props.optionsLoading || hasPopoverSlots.value);\n\nconst computedPlaceholder = computed(() => {\n  return parsedQuery.value !== null ? \"\" : props.placeholder;\n});\n\nconst invalidQueryReason = ref<string | null>(null);\nconst displayInvalidQuery = computed(() => {\n  return invalidQueryReason.value !== null && invalidQueryReason.value !== \"\" && !isCurrentInputFocused.value;\n});\n\nconst clearQuery = () => {\n  parsedQuery.value = null;\n  inputText.value = \"\";\n  invalidQueryReason.value = null;\n  wrapContent.value = false;\n};\n\nonKeyStroke(\n  \"Enter\",\n  (event) => {\n    const active = activeOption.value;\n    if (active) {\n      event.preventDefault();\n      handleOptionSelected(active);\n      return;\n    }\n    if (props.enableCustomOptionsInput && inputText.value.trim()) {\n      handleAddSelfAddedOption();\n    }\n  },\n  { target: input },\n);\n\nonKeyStroke(\n  [\"ArrowDown\", \"ArrowUp\"],\n  (event) => {\n    if (flattenedOptions.value.length === 0) return;\n    event.preventDefault();\n    displayOptions.value = true;\n    moveActiveOption(event.key === \"ArrowDown\" ? 1 : -1);\n  },\n  { target: input },\n);\n\n// Escape dismisses the menu but leaves what has been typed alone, so a stray keypress\n// never costs the user their query.\nonKeyStroke(\n  \"Escape\",\n  () => {\n    if (!displayOptions.value) return;\n    displayOptions.value = false;\n    activeOptionIndex.value = -1;\n  },\n  { target: input },\n);\n\n// when the input is empty, backspace removes the most recently added query term\nonKeyStroke(\n  \"Backspace\",\n  () => {\n    if (inputText.value !== \"\") return;\n    const queryTerms = parsedQuery.value?.queryTerms;\n    if (!queryTerms || queryTerms.length === 0) return;\n    const lastTerm = queryTerms[queryTerms.length - 1];\n    parsedQuery.value = removeQueryOption(parsedQuery.value, {\n      id: lastTerm.queryText || \"\",\n      text: lastTerm.queryText || \"\",\n      queryTerm: lastTerm,\n    });\n    if (parsedQuery.value?.queryTerms.length === 0) {\n      parsedQuery.value = null;\n    }\n  },\n  { target: input },\n);\n\nconst handleAddSelfAddedOption = () => {\n  if (inputText.value.trim()) {\n    parsedQuery.value = addQueryOption(parsedQuery.value, {\n      id: inputText.value.trim(),\n      text: inputText.value,\n      queryTerm: {\n        queryText: inputText.value,\n      },\n    });\n    clearInputText();\n  }\n};\n\n// A suggestion's text is the matched value, and the same value turns up under several\n// columns, so a list of them reads as one value repeated. The column is what tells the\n// rows apart: a partial match searches within it, an exact match is a value from it.\n// Free text has no column, and a consumer's own subText wins over this.\nconst columnSubText = (queryTerm?: QueryTerm): string | undefined => {\n  const displayField = queryTerm?.queryDisplayField || queryTerm?.queryField;\n  if (!displayField) return undefined;\n  return queryTerm?.exactMatch ? displayField : `Search in ${displayField}`;\n};\n\nconst availableOptions: ComputedRef<MenuOption<QueryTerm>[]> = computed(() => {\n  if (!queryOptions.value || queryOptions.value.length === 0) {\n    return [];\n  }\n  let filteredOptions = queryOptions.value;\n  // if the processor is field-only, filter out options without a queryField\n  if (props.processor === \"field-only\") {\n    filteredOptions = queryOptions.value.filter((option) => option.queryTerm?.queryField);\n  }\n  // filter out options that are already present in the current query\n  if (parsedQuery.value) {\n    filteredOptions = filteredOptions.filter((option) => !containsQueryOption(parsedQuery.value, option));\n  }\n  // append the input text to the option text for highlighting in the menu item\n  return filteredOptions.map((option) => {\n    const menuOption: MenuOption<QueryTerm> = {\n      ...option,\n      subText: option.subText ?? columnSubText(option.queryTerm),\n      searchText: inputText.value,\n      context: option.queryTerm,\n    };\n    return menuOption;\n  });\n});\n\n// Bucket options by groupingLabel, preserving the order each label first appears in.\n// Options without a label collect under an empty key and render without a section header.\nconst groupedOptions = computed<[string, MenuOption<QueryTerm>[]][]>(() => {\n  const groups = new Map<string, MenuOption<QueryTerm>[]>();\n  for (const option of availableOptions.value) {\n    const label = option.groupingLabel ?? \"\";\n    const group = groups.get(label);\n    if (group) {\n      group.push(option);\n    } else {\n      groups.set(label, [option]);\n    }\n  }\n  return Array.from(groups.entries());\n});\n\n// PvMenu drives its keyboard navigation with roving DOM focus, which assumes the menu\n// itself takes focus. Here focus has to stay in the text input, so this follows the\n// combobox pattern instead: a tracked active index published via aria-activedescendant.\n// Navigating the flattened list is also what skips the group headers for free.\nconst flattenedOptions = computed(() => groupedOptions.value.flatMap(([, options]) => options));\nconst optionPositions = computed(() => new Map(flattenedOptions.value.map((option, index) => [option, index])));\nconst activeOptionIndex = ref(-1);\n// A disabled row never becomes active: PvMenuItem refuses a click on one, so selecting it\n// with the keyboard has to be refused too. Resolving it here covers every caller at once.\nconst activeOption = computed(() => {\n  if (!displayOptions.value) return null;\n  const option = flattenedOptions.value[activeOptionIndex.value] ?? null;\n  return option?.disabled ? null : option;\n});\n\nconst activeOptionDomId = computed(() => (activeOption.value ? optionDomId(activeOptionIndex.value) : undefined));\n\nconst scrollActiveOptionIntoView = (index: number) => {\n  nextTick(() => {\n    // scrollIntoView is called optionally: jsdom does not implement it, and a throw inside\n    // nextTick surfaces as an unhandled rejection in consumer tests rather than a failure.\n    document.getElementById(optionDomId(index))?.scrollIntoView?.({ block: \"nearest\" });\n  });\n};\n\nconst moveActiveOption = (offset: number) => {\n  const options = flattenedOptions.value;\n  const count = options.length;\n  if (count === 0) return;\n  // From \"nothing active\", down lands on the first row and up wraps to the last.\n  const from = activeOptionIndex.value === -1 ? (offset > 0 ? -1 : 0) : activeOptionIndex.value;\n  // Step over disabled rows rather than stopping on one; gives up if every row is disabled.\n  for (let step = 1; step <= count; step++) {\n    const index = (((from + offset * step) % count) + count) % count;\n    if (!options[index].disabled) {\n      activeOptionIndex.value = index;\n      scrollActiveOptionIntoView(index);\n      return;\n    }\n  }\n};\n\n// Hovering takes over the active row so only one row is ever highlighted and Enter always\n// commits the row the user can see is highlighted.\nconst handleOptionHovered = (option: MenuOption<QueryTerm>) => {\n  if (option.disabled) return;\n  activeOptionIndex.value = optionPositions.value.get(option) ?? -1;\n};\n\n// A stale index would point at an unrelated row once the list changes underneath it.\nwatch([flattenedOptions, inputText], () => {\n  activeOptionIndex.value = -1;\n});\n\n// Watch for changes in available options, input text, or loading state to ensure menu is displayed when typing.\nwatch(\n  [availableOptions, inputText, () => props.optionsLoading],\n  ([newOptions, newInputText, isLoading]) => {\n    // If user is typing and there are options to show OR loading, display the menu\n    if (newInputText && newInputText.length > 0 && (newOptions.length > 0 || isLoading || hasPopoverSlots.value)) {\n      displayOptions.value = true;\n    } else if (!newInputText || newInputText.length === 0) {\n      // Clear the menu if no input text\n      displayOptions.value = false;\n    }\n  },\n  { immediate: true },\n);\n\nconst handleClickOutside = () => {\n  if (props.enableCustomOptionsInput) {\n    handleAddSelfAddedOption();\n  }\n\n  // Drop the highlight along with the menu: refocusing the input reopens it, and a stale\n  // active option would let the next Enter commit a row the user never highlighted.\n  activeOptionIndex.value = -1;\n  displayOptions.value = false;\n  isCurrentInputFocused.value = false;\n  wrapContent.value = false;\n};\n\nconst handleOptionSelected = (option: MenuOption<QueryTerm>) => {\n  try {\n    const queryOption: QueryBuilderSuggestionMenuOption = {\n      id: option.id,\n      text: option.text,\n      queryTerm: option.context,\n      icon: option.icon,\n    };\n    parsedQuery.value = addQueryOption(parsedQuery.value, queryOption);\n    //clear input text after adding option\n    clearInputText();\n  } catch (error) {\n    console.error(\"Error adding query option:\", error);\n  } finally {\n    displayOptions.value = false;\n    isCurrentInputFocused.value = false;\n  }\n};\n\nfunction handleWrapperClick(event: MouseEvent) {\n  const target = event.target as HTMLElement;\n\n  // Don't interfere if clicking on a contenteditable element (QueryTerm)\n  if (target.isContentEditable || target.closest('[contenteditable=\"true\"]')) {\n    return;\n  }\n\n  // Don't interfere if clicking on buttons or other interactive elements\n  if (target.tagName === \"BUTTON\" || target.tagName === \"SVG\" || target.closest(\"button\")) {\n    return;\n  }\n\n  // Focus the main input for everything else\n  input.value?.focus();\n}\n\nfunction checkWrapperFocus(event: FocusEvent) {\n  if (event.type === \"focus\") {\n    isCurrentInputFocused.value = true;\n    displayOptions.value = true;\n  }\n  // Blur is intentionally handled by the wrapper's v-on-click-outside directive\n  // (handleClickOutside) rather than the native blur event, so clicks on\n  // suggestion items inside the popover do not prematurely close the menu.\n}\n\nconst clearInputText = () => {\n  inputText.value = \"\";\n};\n</script>\n\n<template>\n  <div\n    ref=\"query-builder-input\"\n    class=\"pv-relative pv-query-builder-input-wrapper\"\n    :class=\"{ 'pv-query-builder-input-small': size === 'lg' }\"\n    @focus=\"checkWrapperFocus\"\n    @click=\"handleWrapperClick\"\n    v-on-click-outside=\"handleClickOutside\"\n  >\n    <PvIcon v-if=\"!hideSearchIcon\" name=\"search\" />\n    <div\n      class=\"pv-flex pv-full-width pv-inset-inline pv-query-builder-input\"\n      style=\"--inset-size: 4px; --flex-gap: 4px\"\n      :style=\"\n        enableWrapQueryTerms || wrapContent ? 'flex-wrap: wrap;' : 'flex-wrap: nowrap; justify-content: flex-end;'\n      \"\n    >\n      <QueryFormatter\n        v-model=\"parsedQuery\"\n        v-model:wrap-content=\"wrapContent\"\n        :query-term-display-limit=\"queryTermDisplayLimit\"\n      ></QueryFormatter>\n      <input\n        v-model=\"inputText\"\n        ref=\"search-input\"\n        data-testid=\"pv-search-input\"\n        type=\"text\"\n        role=\"combobox\"\n        aria-autocomplete=\"list\"\n        :aria-expanded=\"showPopover && displayOptions\"\n        :aria-controls=\"optionListId\"\n        :aria-activedescendant=\"activeOptionDomId\"\n        :disabled=\"disabled\"\n        :placeholder=\"computedPlaceholder\"\n        :data-invalid=\"displayInvalidQuery ? 'true' : undefined\"\n        :style=\"inputText ? 'min-width: 8rem;' : undefined\"\n        @focus=\"checkWrapperFocus\"\n        @blur=\"checkWrapperFocus\"\n      />\n    </div>\n    <PvButton v-if=\"parsedQuery && !hideClearButton\" variant=\"ghost\" leftIcon=\"close\" size=\"md\" @click=\"clearQuery\" />\n    <p v-if=\"displayInvalidQuery\" class=\"pv-text-red pv-text-body-xs\">\n      {{ invalidQueryReason }}\n    </p>\n    <!-- v-show, not a `pv-hide` class: PvPopover's scoped pinned-sections rule sets\n         `display: flex` at class+attribute specificity, which outranks the `.pv-hide`\n         utility. An inline display wins regardless of what the popover styles itself. -->\n    <!-- The thin scrollbar goes on both boxes: the popover root scrolls on its own, and\n         the list takes over as the scroller once a header or footer is pinned. -->\n    <PvPopover\n      v-if=\"showPopover\"\n      v-show=\"displayOptions\"\n      class=\"pv-scrollbar-visible\"\n      :css-custom-properties=\"popoverCssProperties\"\n      :isList=\"true\"\n      listClass=\"pv-scrollbar-visible\"\n      :listId=\"optionListId\"\n      listRole=\"listbox\"\n    >\n      <template v-if=\"$slots.header\" #header><slot name=\"header\"></slot></template>\n      <template v-if=\"$slots.footer\" #footer><slot name=\"footer\"></slot></template>\n      <template v-if=\"!optionsLoading\">\n        <template v-if=\"availableOptions.length > 0\">\n          <template v-for=\"([groupLabel, groupOptions], groupIndex) in groupedOptions\" :key=\"groupLabel\">\n            <li\n              v-if=\"groupLabel\"\n              :id=\"groupLabelId(groupIndex)\"\n              role=\"presentation\"\n              class=\"pv-query-builder-group-label pv-text-body-xs pv-text-subdued\"\n            >\n              {{ groupLabel }}\n            </li>\n            <li\n              v-for=\"option in groupOptions\"\n              :key=\"`${groupLabel}-${option.id}`\"\n              :id=\"optionDomId(optionPositions.get(option) ?? -1)\"\n              role=\"option\"\n              :aria-selected=\"option === activeOption\"\n              :aria-describedby=\"groupLabel ? groupLabelId(groupIndex) : undefined\"\n              :class=\"{ 'pv-query-builder-option-active': option === activeOption }\"\n              @mouseenter=\"handleOptionHovered(option)\"\n            >\n              <PvMenuItem\n                v-bind=\"option\"\n                :config=\"menuOptionConfig\"\n                :queryText=\"inputText\"\n                @handleSelected=\"handleOptionSelected(option)\"\n              />\n            </li>\n          </template>\n        </template>\n        <li v-else-if=\"$slots.empty\" role=\"presentation\">\n          <slot name=\"empty\"></slot>\n        </li>\n      </template>\n      <template v-else>\n        <div class=\"pv-text-center\">\n          <PvSpinner variant=\"dark\" />\n        </div>\n      </template>\n    </PvPopover>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ComputedRef, nextTick, ref, useId, useSlots, useTemplateRef, watch } from \"vue\";\nimport {\n  QueryBuilderOutput,\n  QueryBuilderProcessor,\n  QueryBuilderSuggestionMenuOption,\n  QueryTerm,\n  useQueryBuilder,\n} from \"@/components/base/PvQueryBuilderInput/useQueryBuilder\";\nimport PvPopover from \"@/components/base/PvPopover/PvPopover.vue\";\nimport PvIcon from \"@/components/base/PvIcon/PvIcon.vue\";\nimport PvMenuItem from \"@/components/base/PvMenu/items/PvMenuItem.vue\";\nimport { vOnClickOutside } from \"@vueuse/components\";\nimport QueryFormatter from \"@/components/base/PvQueryBuilderInput/QueryFormatter.vue\";\nimport type { MenuOption, MenuOptionConfig } from \"@/types\";\nimport type { PvSize } from \"@/components/base/baseProps\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\nimport PvSpinner from \"@/components/base/PvSpinner/PvSpinner.vue\";\nimport { onKeyStroke } from \"@vueuse/core\";\n\nexport interface PvQueryBuilderInputProps {\n  /**\n   * Placeholder text shown in the input when no query is active.\n   */\n  placeholder?: string;\n  /**\n   * When true, the input is non-interactive and visually dimmed.\n   */\n  disabled?: boolean;\n  /** When true, displays a keyboard shortcut badge next to the input. */\n  displayShortcut?: boolean;\n  /**\n   * Determines how user input is parsed into structured query terms.\n   * - `'full'`: free-text and field-based queries.\n   * - `'field-only'`: only options with a queryField are shown.\n   */\n  processor?: QueryBuilderProcessor;\n  /**\n   * When true, shows a loading spinner in the suggestion dropdown.\n   */\n  optionsLoading?: boolean;\n  /** Matches PvSearchInput sizing. */\n  size?: Extract<PvSize, \"lg\" | \"xl\">;\n  /**\n   * When true, users can press Enter to add free-text terms without selecting a suggestion.\n   */\n  enableCustomOptionsInput?: boolean;\n  /**\n   * When true, hides the search icon on the left side of the input.\n   */\n  hideSearchIcon?: boolean;\n  /**\n   * When true, hides the clear button that resets the query.\n   */\n  hideClearButton?: boolean;\n  /**\n   * Maximum number of query term pills to display before collapsing.\n   */\n  queryTermDisplayLimit?: number;\n  /**\n   * When true, query term pills wrap to the next line instead of scrolling horizontally.\n   */\n  enableWrapQueryTerms?: boolean;\n}\n\nconst props = withDefaults(defineProps<PvQueryBuilderInputProps>(), {\n  placeholder: \"Search\",\n  disabled: false,\n  processor: \"full\",\n  optionsLoading: false,\n  enableCustomOptionsInput: false,\n  hideSearchIcon: false,\n  hideClearButton: false,\n  queryTermDisplayLimit: 3,\n  enableWrapQueryTerms: false,\n  size: \"xl\",\n});\n\n// \"icon\" keeps PvMenuBaseItem's opt-in row icon; options without an icon render without one.\nconst menuOptionConfig: MenuOptionConfig = {\n  variant: \"icon\",\n};\n\n// Figma's Surface/card-hover, scoped to this popover so other menus keep the default hover.\nconst popoverCssProperties = {\n  width: \"100%\",\n  maxWidth: \"100%\",\n  \"--popover-list-item-hover-background-color\": \"var(--surface-card-hover, #ece8e2)\",\n};\n\nconst input = useTemplateRef<HTMLInputElement | null>(\"search-input\");\nconst inputText = defineModel<string>(\"searchText\", { required: false, default: \"\" });\nconst parsedQuery = defineModel<QueryBuilderOutput | null>(\"query\", { required: true });\nconst queryOptions = defineModel<QueryBuilderSuggestionMenuOption[]>(\"options\", {\n  required: false,\n});\nconst { addQueryOption, containsQueryOption, removeQueryOption } = useQueryBuilder();\nconst displayOptions = ref(false);\nconst isCurrentInputFocused = ref(false);\nconst wrapContent = ref(false);\n\nconst slots = useSlots();\n// The popover used to exist only when there were options to list. Consumers that supply\n// their own sections still need it, so a header, footer, or empty slot keeps it mounted.\n// With no slots supplied this stays false and the menu behaves exactly as it did before.\nconst hasPopoverSlots = computed(() => Boolean(slots.header || slots.footer || slots.empty));\n\nconst componentId = useId();\nconst optionListId = `${componentId}-options`;\n// Positional ids: a consumer repeating an option id would otherwise produce duplicate DOM\n// ids and break aria-activedescendant.\nconst optionDomId = (index: number) => `${componentId}-option-${index}`;\nconst groupLabelId = (groupIndex: number) => `${componentId}-group-${groupIndex}`;\nconst showPopover = computed(() => availableOptions.value.length > 0 || props.optionsLoading || hasPopoverSlots.value);\n\nconst computedPlaceholder = computed(() => {\n  return parsedQuery.value !== null ? \"\" : props.placeholder;\n});\n\nconst invalidQueryReason = ref<string | null>(null);\nconst displayInvalidQuery = computed(() => {\n  return invalidQueryReason.value !== null && invalidQueryReason.value !== \"\" && !isCurrentInputFocused.value;\n});\n\nconst clearQuery = () => {\n  parsedQuery.value = null;\n  inputText.value = \"\";\n  invalidQueryReason.value = null;\n  wrapContent.value = false;\n};\n\nonKeyStroke(\n  \"Enter\",\n  (event) => {\n    const active = activeOption.value;\n    if (active) {\n      event.preventDefault();\n      handleOptionSelected(active);\n      return;\n    }\n    if (props.enableCustomOptionsInput && inputText.value.trim()) {\n      handleAddSelfAddedOption();\n    }\n  },\n  { target: input },\n);\n\nonKeyStroke(\n  [\"ArrowDown\", \"ArrowUp\"],\n  (event) => {\n    if (flattenedOptions.value.length === 0) return;\n    event.preventDefault();\n    displayOptions.value = true;\n    moveActiveOption(event.key === \"ArrowDown\" ? 1 : -1);\n  },\n  { target: input },\n);\n\n// Escape dismisses the menu but leaves what has been typed alone, so a stray keypress\n// never costs the user their query.\nonKeyStroke(\n  \"Escape\",\n  () => {\n    if (!displayOptions.value) return;\n    displayOptions.value = false;\n    activeOptionIndex.value = -1;\n  },\n  { target: input },\n);\n\n// when the input is empty, backspace removes the most recently added query term\nonKeyStroke(\n  \"Backspace\",\n  () => {\n    if (inputText.value !== \"\") return;\n    const queryTerms = parsedQuery.value?.queryTerms;\n    if (!queryTerms || queryTerms.length === 0) return;\n    const lastTerm = queryTerms[queryTerms.length - 1];\n    parsedQuery.value = removeQueryOption(parsedQuery.value, {\n      id: lastTerm.queryText || \"\",\n      text: lastTerm.queryText || \"\",\n      queryTerm: lastTerm,\n    });\n    if (parsedQuery.value?.queryTerms.length === 0) {\n      parsedQuery.value = null;\n    }\n  },\n  { target: input },\n);\n\nconst handleAddSelfAddedOption = () => {\n  if (inputText.value.trim()) {\n    parsedQuery.value = addQueryOption(parsedQuery.value, {\n      id: inputText.value.trim(),\n      text: inputText.value,\n      queryTerm: {\n        queryText: inputText.value,\n      },\n    });\n    clearInputText();\n  }\n};\n\n// A suggestion's text is the matched value, and the same value turns up under several\n// columns, so a list of them reads as one value repeated. The column is what tells the\n// rows apart: a partial match searches within it, an exact match is a value from it.\n// Free text has no column, and a consumer's own subText wins over this.\nconst columnSubText = (queryTerm?: QueryTerm): string | undefined => {\n  const displayField = queryTerm?.queryDisplayField || queryTerm?.queryField;\n  if (!displayField) return undefined;\n  return queryTerm?.exactMatch ? displayField : `Search in ${displayField}`;\n};\n\nconst availableOptions: ComputedRef<MenuOption<QueryTerm>[]> = computed(() => {\n  if (!queryOptions.value || queryOptions.value.length === 0) {\n    return [];\n  }\n  let filteredOptions = queryOptions.value;\n  // if the processor is field-only, filter out options without a queryField\n  if (props.processor === \"field-only\") {\n    filteredOptions = queryOptions.value.filter((option) => option.queryTerm?.queryField);\n  }\n  // filter out options that are already present in the current query\n  if (parsedQuery.value) {\n    filteredOptions = filteredOptions.filter((option) => !containsQueryOption(parsedQuery.value, option));\n  }\n  // append the input text to the option text for highlighting in the menu item\n  return filteredOptions.map((option) => {\n    const menuOption: MenuOption<QueryTerm> = {\n      ...option,\n      subText: option.subText ?? columnSubText(option.queryTerm),\n      searchText: inputText.value,\n      context: option.queryTerm,\n    };\n    return menuOption;\n  });\n});\n\n// Bucket options by groupingLabel, preserving the order each label first appears in.\n// Options without a label collect under an empty key and render without a section header.\nconst groupedOptions = computed<[string, MenuOption<QueryTerm>[]][]>(() => {\n  const groups = new Map<string, MenuOption<QueryTerm>[]>();\n  for (const option of availableOptions.value) {\n    const label = option.groupingLabel ?? \"\";\n    const group = groups.get(label);\n    if (group) {\n      group.push(option);\n    } else {\n      groups.set(label, [option]);\n    }\n  }\n  return Array.from(groups.entries());\n});\n\n// PvMenu drives its keyboard navigation with roving DOM focus, which assumes the menu\n// itself takes focus. Here focus has to stay in the text input, so this follows the\n// combobox pattern instead: a tracked active index published via aria-activedescendant.\n// Navigating the flattened list is also what skips the group headers for free.\nconst flattenedOptions = computed(() => groupedOptions.value.flatMap(([, options]) => options));\nconst optionPositions = computed(() => new Map(flattenedOptions.value.map((option, index) => [option, index])));\nconst activeOptionIndex = ref(-1);\n// A disabled row never becomes active: PvMenuItem refuses a click on one, so selecting it\n// with the keyboard has to be refused too. Resolving it here covers every caller at once.\nconst activeOption = computed(() => {\n  if (!displayOptions.value) return null;\n  const option = flattenedOptions.value[activeOptionIndex.value] ?? null;\n  return option?.disabled ? null : option;\n});\n\nconst activeOptionDomId = computed(() => (activeOption.value ? optionDomId(activeOptionIndex.value) : undefined));\n\nconst scrollActiveOptionIntoView = (index: number) => {\n  nextTick(() => {\n    // scrollIntoView is called optionally: jsdom does not implement it, and a throw inside\n    // nextTick surfaces as an unhandled rejection in consumer tests rather than a failure.\n    document.getElementById(optionDomId(index))?.scrollIntoView?.({ block: \"nearest\" });\n  });\n};\n\nconst moveActiveOption = (offset: number) => {\n  const options = flattenedOptions.value;\n  const count = options.length;\n  if (count === 0) return;\n  // From \"nothing active\", down lands on the first row and up wraps to the last.\n  const from = activeOptionIndex.value === -1 ? (offset > 0 ? -1 : 0) : activeOptionIndex.value;\n  // Step over disabled rows rather than stopping on one; gives up if every row is disabled.\n  for (let step = 1; step <= count; step++) {\n    const index = (((from + offset * step) % count) + count) % count;\n    if (!options[index].disabled) {\n      activeOptionIndex.value = index;\n      scrollActiveOptionIntoView(index);\n      return;\n    }\n  }\n};\n\n// Hovering takes over the active row so only one row is ever highlighted and Enter always\n// commits the row the user can see is highlighted.\nconst handleOptionHovered = (option: MenuOption<QueryTerm>) => {\n  if (option.disabled) return;\n  activeOptionIndex.value = optionPositions.value.get(option) ?? -1;\n};\n\n// A stale index would point at an unrelated row once the list changes underneath it.\nwatch([flattenedOptions, inputText], () => {\n  activeOptionIndex.value = -1;\n});\n\n// Watch for changes in available options, input text, or loading state to ensure menu is displayed when typing.\nwatch(\n  [availableOptions, inputText, () => props.optionsLoading],\n  ([newOptions, newInputText, isLoading]) => {\n    // If user is typing and there are options to show OR loading, display the menu\n    if (newInputText && newInputText.length > 0 && (newOptions.length > 0 || isLoading || hasPopoverSlots.value)) {\n      displayOptions.value = true;\n    } else if (!newInputText || newInputText.length === 0) {\n      // Clear the menu if no input text\n      displayOptions.value = false;\n    }\n  },\n  { immediate: true },\n);\n\nconst handleClickOutside = () => {\n  if (props.enableCustomOptionsInput) {\n    handleAddSelfAddedOption();\n  }\n\n  // Drop the highlight along with the menu: refocusing the input reopens it, and a stale\n  // active option would let the next Enter commit a row the user never highlighted.\n  activeOptionIndex.value = -1;\n  displayOptions.value = false;\n  isCurrentInputFocused.value = false;\n  wrapContent.value = false;\n};\n\nconst handleOptionSelected = (option: MenuOption<QueryTerm>) => {\n  try {\n    const queryOption: QueryBuilderSuggestionMenuOption = {\n      id: option.id,\n      text: option.text,\n      queryTerm: option.context,\n      icon: option.icon,\n    };\n    parsedQuery.value = addQueryOption(parsedQuery.value, queryOption);\n    //clear input text after adding option\n    clearInputText();\n  } catch (error) {\n    console.error(\"Error adding query option:\", error);\n  } finally {\n    displayOptions.value = false;\n    isCurrentInputFocused.value = false;\n  }\n};\n\nfunction handleWrapperClick(event: MouseEvent) {\n  const target = event.target as HTMLElement;\n\n  // Don't interfere if clicking on a contenteditable element (QueryTerm)\n  if (target.isContentEditable || target.closest('[contenteditable=\"true\"]')) {\n    return;\n  }\n\n  // Don't interfere if clicking on buttons or other interactive elements\n  if (target.tagName === \"BUTTON\" || target.tagName === \"SVG\" || target.closest(\"button\")) {\n    return;\n  }\n\n  // Focus the main input for everything else\n  input.value?.focus();\n}\n\nfunction checkWrapperFocus(event: FocusEvent) {\n  if (event.type === \"focus\") {\n    isCurrentInputFocused.value = true;\n    displayOptions.value = true;\n  }\n  // Blur is intentionally handled by the wrapper's v-on-click-outside directive\n  // (handleClickOutside) rather than the native blur event, so clicks on\n  // suggestion items inside the popover do not prematurely close the menu.\n}\n\nconst clearInputText = () => {\n  inputText.value = \"\";\n};\n</script>\n\n<template>\n  <div\n    ref=\"query-builder-input\"\n    class=\"pv-relative pv-query-builder-input-wrapper\"\n    :class=\"{ 'pv-query-builder-input-small': size === 'lg' }\"\n    @focus=\"checkWrapperFocus\"\n    @click=\"handleWrapperClick\"\n    v-on-click-outside=\"handleClickOutside\"\n  >\n    <PvIcon v-if=\"!hideSearchIcon\" name=\"search\" />\n    <div\n      class=\"pv-flex pv-full-width pv-inset-inline pv-query-builder-input\"\n      style=\"--inset-size: 4px; --flex-gap: 4px\"\n      :style=\"\n        enableWrapQueryTerms || wrapContent ? 'flex-wrap: wrap;' : 'flex-wrap: nowrap; justify-content: flex-end;'\n      \"\n    >\n      <QueryFormatter\n        v-model=\"parsedQuery\"\n        v-model:wrap-content=\"wrapContent\"\n        :query-term-display-limit=\"queryTermDisplayLimit\"\n      ></QueryFormatter>\n      <input\n        v-model=\"inputText\"\n        ref=\"search-input\"\n        data-testid=\"pv-search-input\"\n        type=\"text\"\n        role=\"combobox\"\n        aria-autocomplete=\"list\"\n        :aria-expanded=\"showPopover && displayOptions\"\n        :aria-controls=\"optionListId\"\n        :aria-activedescendant=\"activeOptionDomId\"\n        :disabled=\"disabled\"\n        :placeholder=\"computedPlaceholder\"\n        :data-invalid=\"displayInvalidQuery ? 'true' : undefined\"\n        :style=\"inputText ? 'min-width: 8rem;' : undefined\"\n        @focus=\"checkWrapperFocus\"\n        @blur=\"checkWrapperFocus\"\n      />\n    </div>\n    <PvButton v-if=\"parsedQuery && !hideClearButton\" variant=\"ghost\" leftIcon=\"close\" size=\"md\" @click=\"clearQuery\" />\n    <p v-if=\"displayInvalidQuery\" class=\"pv-text-red pv-text-body-xs\">\n      {{ invalidQueryReason }}\n    </p>\n    <!-- v-show, not a `pv-hide` class: PvPopover's scoped pinned-sections rule sets\n         `display: flex` at class+attribute specificity, which outranks the `.pv-hide`\n         utility. An inline display wins regardless of what the popover styles itself. -->\n    <!-- The thin scrollbar goes on both boxes: the popover root scrolls on its own, and\n         the list takes over as the scroller once a header or footer is pinned. -->\n    <PvPopover\n      v-if=\"showPopover\"\n      v-show=\"displayOptions\"\n      class=\"pv-scrollbar-visible\"\n      :css-custom-properties=\"popoverCssProperties\"\n      :isList=\"true\"\n      listClass=\"pv-scrollbar-visible\"\n      :listId=\"optionListId\"\n      listRole=\"listbox\"\n    >\n      <template v-if=\"$slots.header\" #header><slot name=\"header\"></slot></template>\n      <template v-if=\"$slots.footer\" #footer><slot name=\"footer\"></slot></template>\n      <template v-if=\"!optionsLoading\">\n        <template v-if=\"availableOptions.length > 0\">\n          <template v-for=\"([groupLabel, groupOptions], groupIndex) in groupedOptions\" :key=\"groupLabel\">\n            <li\n              v-if=\"groupLabel\"\n              :id=\"groupLabelId(groupIndex)\"\n              role=\"presentation\"\n              class=\"pv-query-builder-group-label pv-text-body-xs pv-text-subdued\"\n            >\n              {{ groupLabel }}\n            </li>\n            <li\n              v-for=\"option in groupOptions\"\n              :key=\"`${groupLabel}-${option.id}`\"\n              :id=\"optionDomId(optionPositions.get(option) ?? -1)\"\n              role=\"option\"\n              :aria-selected=\"option === activeOption\"\n              :aria-describedby=\"groupLabel ? groupLabelId(groupIndex) : undefined\"\n              :class=\"{ 'pv-query-builder-option-active': option === activeOption }\"\n              @mouseenter=\"handleOptionHovered(option)\"\n            >\n              <PvMenuItem\n                v-bind=\"option\"\n                :config=\"menuOptionConfig\"\n                :queryText=\"inputText\"\n                @handleSelected=\"handleOptionSelected(option)\"\n              />\n            </li>\n          </template>\n        </template>\n        <li v-else-if=\"$slots.empty\" role=\"presentation\">\n          <slot name=\"empty\"></slot>\n        </li>\n      </template>\n      <template v-else>\n        <div class=\"pv-text-center\">\n          <PvSpinner variant=\"dark\" />\n        </div>\n      </template>\n    </PvPopover>\n  </div>\n</template>\n","import type { PvSidebarNavItem } from \"./types.ts\";\n\n/** True when the item itself or any of its descendants is the current page. */\nexport const isNavItemActive = (item: PvSidebarNavItem): boolean =>\n  Boolean(item.active || item.children?.some(isNavItemActive));\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport type { PvSidebarNavItem } from \"./types.ts\";\n\ndefineOptions({ name: \"PvSidebarNavFlyout\" });\n\ndefineProps<{\n  items: PvSidebarNavItem[];\n  /** Keeps nested flyouts closed while the surface hosting this list is inactive. */\n  disabled?: boolean;\n}>();\n\nconst openItems = ref<Record<string | number, boolean>>({});\n</script>\n\n<template>\n  <div class=\"pv-popover\" style=\"--position: static; --height: 350px\">\n    <ul role=\"list\" class=\"pv-popover-list\">\n      <li v-for=\"item in items\" :key=\"item.value\" :data-active=\"(!item.children?.length && item.active) || undefined\">\n        <!-- Nested items - another flyout on the right, rendered inside this one so hovering it keeps this open.\n             Not teleported: the nested surface has to stay a DOM descendant of this one for that to hold. -->\n        <PvPopoverV2\n          v-if=\"item.children?.length\"\n          v-model=\"openItems[item.value]\"\n          show-on-hover\n          enable-group-sync\n          enable-click-toggle\n          position=\"right-top\"\n          :offset=\"8\"\n          :disabled=\"disabled\"\n          :css-custom-properties=\"{ width: '100%' }\"\n        >\n          <template #trigger>\n            <a\n              :href=\"item.url\"\n              v-bind=\"item.linkAttrs\"\n              :role=\"item.url ? undefined : 'button'\"\n              :tabindex=\"item.url ? undefined : 0\"\n              :data-active=\"isNavItemActive(item) || undefined\"\n              aria-haspopup=\"true\"\n              :aria-expanded=\"Boolean(openItems[item.value])\"\n              style=\"flex-wrap: wrap\"\n            >\n              <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                item.label\n              }}</span>\n              <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n            </a>\n          </template>\n          <template #content>\n            <PvSidebarNavFlyout :items=\"item.children\" :disabled=\"disabled\" />\n          </template>\n        </PvPopoverV2>\n\n        <a v-else :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{ item.label }}</span>\n          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n        </a>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport type { PvSidebarNavItem } from \"./types.ts\";\n\ndefineOptions({ name: \"PvSidebarNavFlyout\" });\n\ndefineProps<{\n  items: PvSidebarNavItem[];\n  /** Keeps nested flyouts closed while the surface hosting this list is inactive. */\n  disabled?: boolean;\n}>();\n\nconst openItems = ref<Record<string | number, boolean>>({});\n</script>\n\n<template>\n  <div class=\"pv-popover\" style=\"--position: static; --height: 350px\">\n    <ul role=\"list\" class=\"pv-popover-list\">\n      <li v-for=\"item in items\" :key=\"item.value\" :data-active=\"(!item.children?.length && item.active) || undefined\">\n        <!-- Nested items - another flyout on the right, rendered inside this one so hovering it keeps this open.\n             Not teleported: the nested surface has to stay a DOM descendant of this one for that to hold. -->\n        <PvPopoverV2\n          v-if=\"item.children?.length\"\n          v-model=\"openItems[item.value]\"\n          show-on-hover\n          enable-group-sync\n          enable-click-toggle\n          position=\"right-top\"\n          :offset=\"8\"\n          :disabled=\"disabled\"\n          :css-custom-properties=\"{ width: '100%' }\"\n        >\n          <template #trigger>\n            <a\n              :href=\"item.url\"\n              v-bind=\"item.linkAttrs\"\n              :role=\"item.url ? undefined : 'button'\"\n              :tabindex=\"item.url ? undefined : 0\"\n              :data-active=\"isNavItemActive(item) || undefined\"\n              aria-haspopup=\"true\"\n              :aria-expanded=\"Boolean(openItems[item.value])\"\n              style=\"flex-wrap: wrap\"\n            >\n              <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                item.label\n              }}</span>\n              <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n            </a>\n          </template>\n          <template #content>\n            <PvSidebarNavFlyout :items=\"item.children\" :disabled=\"disabled\" />\n          </template>\n        </PvPopoverV2>\n\n        <a v-else :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{ item.label }}</span>\n          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n        </a>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n  computed,\n  getCurrentInstance,\n  nextTick,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  useSlots,\n  watch,\n  type ComponentPublicInstance,\n  type CSSProperties,\n} from \"vue\";\nimport { useElementBounding } from \"@vueuse/core\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport PvSidebarNavFlyout from \"./PvSidebarNavFlyout.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport { hasHostSlotContent, useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport type { PvSidebarNavItem, PvSidebarOrgEntity, PvSidebarProps } from \"./types.ts\";\n\nconst props = defineProps<PvSidebarProps>();\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { present: hasAdditionalContent } = useSlotPresence(\"sidebar-additional-content\", {\n  host: customElementHost,\n});\nconst { present: hasAdditionalHeader } = useSlotPresence(\"sidebar-additional-header\", {\n  host: customElementHost,\n});\nconst { present: hasHelpContent } = useSlotPresence(\"sidebar-help-content\", { host: customElementHost });\nconst { present: hasProfileContent } = useSlotPresence(\"sidebar-profile-content\", { host: customElementHost });\nconst slots = useSlots();\nconst popoverTeleportTarget = ref<HTMLElement | null>(null);\nconst sidebarPanel = ref<HTMLElement | null>(null);\nconst hoverPanelOpen = ref<Record<string | number, boolean>>({});\nconst hoverPanelFocusRestore = ref<string | number>();\nconst hoverPanelSurfaces = new Map<string | number, HTMLElement>();\nconst hoverPanelTriggers = new Map<string | number, HTMLElement>();\nconst nativeSlotRevision = ref(0);\nconst sidebarBounds = useElementBounding(sidebarPanel);\nconst hoverPanelPositionStyles = computed<CSSProperties>(() => ({\n  \"--pv-sidebar-hover-panel-height\": `${sidebarBounds.height.value}px`,\n  \"--pv-sidebar-hover-panel-left\": `${sidebarBounds.right.value}px`,\n  \"--pv-sidebar-hover-panel-top\": `${sidebarBounds.top.value}px`,\n}));\n\nlet nativeSlotObserver: MutationObserver | undefined;\n\nconst hasHoverPanelSlot = (item: PvSidebarNavItem) => {\n  if (!item.hoverPanelSlot) return false;\n  if (!customElementHost) return Boolean(slots[item.hoverPanelSlot]);\n\n  void nativeSlotRevision.value;\n  return hasHostSlotContent(customElementHost, item.hoverPanelSlot);\n};\n\nconst setHoverPanelElement = (\n  elements: Map<string | number, HTMLElement>,\n  value: string | number,\n  element: Element | ComponentPublicInstance | null,\n) => {\n  if (element instanceof HTMLElement) elements.set(value, element);\n  else elements.delete(value);\n};\n\nconst focusableSelector =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst findFirstPanelControl = (value: string | number) => {\n  const surface = hoverPanelSurfaces.get(value);\n  const control = surface?.querySelector<HTMLElement>(focusableSelector);\n  if (control) return control;\n\n  for (const slot of surface?.querySelectorAll(\"slot\") ?? []) {\n    for (const element of slot.assignedElements({ flatten: true })) {\n      if (element.matches(focusableSelector)) return element as HTMLElement;\n      const slottedControl = element.querySelector<HTMLElement>(focusableSelector);\n      if (slottedControl) return slottedControl;\n    }\n  }\n};\n\nconst handleHoverPanelTab = (event: KeyboardEvent, value: string | number) => {\n  if (event.shiftKey) return;\n  const control = findFirstPanelControl(value);\n  if (!control) return;\n  event.preventDefault();\n  hoverPanelOpen.value[value] = true;\n  nextTick(() => control.focus());\n};\n\nconst closeHoverPanel = (value: string | number) => {\n  hoverPanelFocusRestore.value = value;\n  hoverPanelOpen.value[value] = false;\n  nextTick(() => {\n    hoverPanelTriggers.get(value)?.focus({ preventScroll: true });\n    nextTick(() => (hoverPanelFocusRestore.value = undefined));\n  });\n};\n\nconst handleHoverPanelClick = (event: MouseEvent, value: string | number) => {\n  if (\n    event\n      .composedPath()\n      .some((target) => target instanceof Element && target.hasAttribute(\"data-sidebar-nav-panel-close\"))\n  ) {\n    closeHoverPanel(value);\n  }\n};\n\nconst handleHoverPanelKeydown = (event: KeyboardEvent, value: string | number) => {\n  if (event.key !== \"Escape\") return;\n  event.preventDefault();\n  event.stopPropagation();\n  closeHoverPanel(value);\n};\n\nonMounted(() => {\n  if (!customElementHost) return;\n  nativeSlotObserver = new MutationObserver((mutations) => {\n    if (\n      mutations.some(\n        (mutation) =>\n          mutation.target === customElementHost ||\n          (mutation.type === \"attributes\" && mutation.target.parentNode === customElementHost),\n      )\n    ) {\n      nativeSlotRevision.value += 1;\n    }\n  });\n  nativeSlotObserver.observe(customElementHost, {\n    attributes: true,\n    attributeFilter: [\"slot\"],\n    childList: true,\n    subtree: true,\n  });\n});\n\nonBeforeUnmount(() => nativeSlotObserver?.disconnect());\n\nconst findActiveEntity = (entities: PvSidebarOrgEntity[]): PvSidebarOrgEntity | undefined => {\n  for (const entity of entities) {\n    if (entity.active) return entity;\n    const activeChild = entity.entities && findActiveEntity(entity.entities);\n    if (activeChild) return activeChild;\n  }\n  return undefined;\n};\n\nconst activeOrganization = computed(\n  () => (props.organizations && findActiveEntity(props.organizations)) ?? props.organizations?.[0],\n);\n\nconst initialOpenNavItems = (): Record<string | number, boolean> => {\n  const open: Record<string | number, boolean> = {};\n  props.navItems?.forEach((item) => {\n    if (isNavItemActive(item)) open[item.value] = true;\n  });\n  return open;\n};\n\nconst openNavItems = ref<Record<string | number, boolean>>(initialOpenNavItems());\n\n// Re-syncs whenever navItems changes (e.g. a client-side route change recomputes\n// `active` on the consumer's side), not just once at mount — merges in newly-active\n// items without forcing already-open/closed items the user has manually toggled.\nwatch(\n  () => props.navItems,\n  (items) => {\n    items?.forEach((item) => {\n      if (isNavItemActive(item)) {\n        openNavItems.value[item.value] = true;\n      }\n    });\n  },\n);\n\nconst isCollapsed = defineModel<boolean>({ default: false });\nconst isTransitioning = ref(false);\nconst isExpanding = computed(() => !isCollapsed.value && isTransitioning.value);\n\nconst emit = defineEmits<{\n  (e: \"change\", payload: { collapsed: boolean }): void;\n}>();\n\nconst helpPopoverOpen = ref(false);\nconst organizationPopoverOpen = ref(false);\nconst profilePopoverOpen = ref(false);\nconst nestedNavPopoverOpen = ref<Record<string | number, boolean>>({});\n\nconst closeSidebarPopovers = () => {\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  nestedNavPopoverOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n};\n\nwatch(helpPopoverOpen, (open) => {\n  if (!open) return;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n});\nwatch(organizationPopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  profilePopoverOpen.value = false;\n});\nwatch(profilePopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n});\nwatch(isCollapsed, () => {\n  closeSidebarPopovers();\n  isTransitioning.value = true;\n});\n\nconst toggle = () => {\n  isCollapsed.value = !isCollapsed.value;\n  emit(\"change\", { collapsed: isCollapsed.value });\n};\n\nconst handleTransitionEnd = (event: TransitionEvent) => {\n  if (event.target === event.currentTarget && event.propertyName === \"grid-template-columns\") {\n    isTransitioning.value = false;\n  }\n};\n\nconst hasActiveChildren = (children: PvSidebarNavItem[]) => {\n  return children.some(isNavItemActive);\n};\n\n// This trigger renders inside PvAccordion's native <summary>, which can't contain\n// a real <a> (invalid nesting of interactive content), so modifier-clicks have to\n// be replicated manually to keep new-tab/new-window behavior working for mouse users.\nconst handleRedirect = (event: MouseEvent, child: PvSidebarNavItem) => {\n  if (!child.url) return;\n  if (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1) {\n    window.open(child.url, \"_blank\", \"noopener\");\n    return;\n  }\n  window.location.href = child.url;\n};\n</script>\n\n<template>\n  <div\n    class=\"sidebar-layout sidebar-layout-new sidebar-layout-secondary\"\n    :class=\"{\n      'is-collapsed': isCollapsed,\n      'is-expanded': !isCollapsed,\n      'is-transitioning': isTransitioning,\n    }\"\n    :style=\"hoverPanelPositionStyles\"\n    @transitionend=\"handleTransitionEnd\"\n  >\n    <div ref=\"sidebarPanel\" class=\"sidebar-panel\">\n      <div>\n        <div v-if=\"hasAdditionalHeader\" class=\"sidebar-additional-header\">\n          <slot name=\"sidebar-additional-header\" />\n        </div>\n        <div\n          class=\"sidebar-header\"\n          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n          :class=\"[{ 'pv-border-bottom': isCollapsed }]\"\n        >\n          <div class=\"sidebar-header-content pv-full-width\">\n            <div\n              v-if=\"organizations && organizations.length\"\n              class=\"pv-sidebar-nav-header pv-sidebar-surface-secondary\"\n            >\n              <PvPopoverV2\n                v-model=\"organizationPopoverOpen\"\n                :position=\"isCollapsed ? 'right-top' : 'bottom-left'\"\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvTooltipV2\n                    :description=\"activeOrganization?.label\"\n                    :disabled=\"!isCollapsed || isTransitioning || organizationPopoverOpen\"\n                    variant=\"white\"\n                    position=\"center-right\"\n                    :delay=\"250\"\n                    :offset=\"4\"\n                    enable-group-sync\n                    :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                    :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                    :css-custom-properties=\"{ width: '100%' }\"\n                  >\n                    <template #trigger>\n                      <button\n                        type=\"button\"\n                        class=\"pv-nav-list-item pv-full-width pv-space-between\"\n                        :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                        data-testid=\"pv-sidebar-org-switcher\"\n                        :aria-label=\"`Switch organization: ${activeOrganization?.label}`\"\n                        :aria-expanded=\"organizationPopoverOpen\"\n                      >\n                        <div class=\"pv-flex\" style=\"min-width: 0\">\n                          <span class=\"pv-avatar-xs\" style=\"border-radius: 4px; flex-shrink: 0\">\n                            <img\n                              v-if=\"activeOrganization?.avatarUrl\"\n                              :src=\"activeOrganization.avatarUrl\"\n                              alt=\"Organization Avatar\"\n                            />\n                            <span v-else>{{ activeOrganization?.label?.slice(0, 1) }}</span>\n                          </span>\n                          <span\n                            class=\"pv-text-title-lg pv-truncate\"\n                            data-sidebar-expanded-content\n                            :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                            :data-sidebar-expanding=\"isExpanding || undefined\"\n                            :title=\"activeOrganization?.label\"\n                            >{{ activeOrganization?.label }}</span\n                          >\n                        </div>\n                        <PvIcon\n                          name=\"chevron-down\"\n                          class=\"pv-icon-16\"\n                          data-sidebar-expanded-content\n                          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                          :data-sidebar-expanding=\"isExpanding || undefined\"\n                        />\n                      </button>\n                    </template>\n                  </PvTooltipV2>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"width: fit-content; max-width: 280px; margin-top: 4px\">\n                    <ul\n                      role=\"list\"\n                      class=\"pv-popover-list pv-flow\"\n                      style=\"--flow-size: 0.25rem\"\n                      data-testid=\"pv-sidebar-org-list\"\n                    >\n                      <template v-for=\"organization in organizations\" :key=\"organization.value\">\n                        <li :data-active=\"organization.active || undefined\">\n                          <a\n                            class=\"pv-flex\"\n                            :href=\"organization.url\"\n                            data-testid=\"pv-sidebar-org-option\"\n                            :data-org-value=\"organization.value\"\n                          >\n                            <div class=\"pv-avatar-xs\" style=\"border-radius: 4px\">\n                              <img\n                                v-if=\"organization.avatarUrl\"\n                                :src=\"organization.avatarUrl\"\n                                alt=\"Organization Avatar\"\n                              />\n                              <span v-else>{{ organization.label.slice(0, 1) }}</span>\n                            </div>\n                            <span class=\"pv-truncate pv-flex-item\" :title=\"organization.label\">{{\n                              organization.label\n                            }}</span>\n                          </a>\n                        </li>\n                        <li\n                          v-for=\"entity in organization.entities\"\n                          :key=\"entity.value\"\n                          style=\"padding-left: 0.5rem\"\n                          :data-active=\"entity.active || undefined\"\n                        >\n                          <a\n                            class=\"pv-flex pv-truncate\"\n                            :href=\"entity.url\"\n                            style=\"max-width: 100%\"\n                            data-testid=\"pv-sidebar-org-entity\"\n                            :data-org-value=\"entity.value\"\n                          >\n                            <PvIcon name=\"corner-down-right\" />\n                            <span class=\"pv-truncate\" :title=\"entity.label\">{{ entity.label }}</span>\n                          </a>\n                        </li>\n                      </template>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n            </div>\n          </div>\n          <PvTooltipV2 v-if=\"!disableToggle\" variant=\"white\" position=\"center-right\" :delay=\"1000\">\n            <template #trigger>\n              <PvButton\n                class=\"sidebar-toggle\"\n                :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                :data-sidebar-expanding=\"isExpanding || undefined\"\n                :left-icon=\"isCollapsed ? 'panel-left-open' : 'panel-left-close'\"\n                :aria-label=\"isCollapsed ? 'Open sidebar' : 'Close sidebar'\"\n                variant=\"ghost\"\n                @click=\"toggle\"\n              />\n            </template>\n            <template #content> {{ isCollapsed ? \"Expand navigation\" : \"Collapse navigation\" }} </template>\n          </PvTooltipV2>\n        </div>\n      </div>\n      <div class=\"pv-sidebar-nav pv-sidebar-surface-secondary\">\n        <div v-if=\"hasAdditionalContent\">\n          <slot name=\"sidebar-additional-content\" />\n        </div>\n        <ul v-if=\"navItems && navItems.length\" role=\"list\" class=\"pv-full-width pv-flow\" style=\"--flow-size: 0.25rem\">\n          <template v-for=\"item in navItems\" :key=\"item.value\">\n            <li v-if=\"item.separatorAtTop\" class=\"pv-sidebar-nav-separator\" aria-hidden=\"true\"></li>\n            <li>\n              <!-- Slotted full-height panel - available while collapsed or expanded -->\n              <PvPopoverV2\n                v-if=\"hasHoverPanelSlot(item)\"\n                v-model=\"hoverPanelOpen[item.value]\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"hoverPanelFocusRestore === item.value\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <component\n                    :is=\"item.url ? 'a' : 'button'\"\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelTriggers, item.value, element)\n                    \"\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    :type=\"item.url ? undefined : 'button'\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :aria-expanded=\"Boolean(hoverPanelOpen[item.value])\"\n                    :aria-label=\"isCollapsed ? item.label : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                    @keydown.tab=\"handleHoverPanelTab($event, item.value)\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </component>\n                </template>\n                <template #content>\n                  <div\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelSurfaces, item.value, element)\n                    \"\n                    class=\"pv-sidebar-hover-panel\"\n                    @click=\"handleHoverPanelClick($event, item.value)\"\n                    @keydown=\"handleHoverPanelKeydown($event, item.value)\"\n                  >\n                    <slot :name=\"item.hoverPanelSlot\" />\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Leaf item - direct link with a collapsed interactive flyout -->\n              <PvPopoverV2\n                v-else-if=\"!item.children || item.children.length === 0\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <a\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </a>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"--position: static\">\n                    <ul role=\"list\" class=\"pv-popover-list\">\n                      <li :data-active=\"item.active || undefined\">\n                        <a :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n                          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                            item.label\n                          }}</span>\n                          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                        </a>\n                      </li>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Child items - accordion with a collapsed hover flyout -->\n              <PvPopoverV2\n                v-else\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvAccordion\n                    v-model=\"openNavItems[item.value]\"\n                    :default-open=\"isNavItemActive(item)\"\n                    :summary-attrs=\"{\n                      class: isCollapsed ? 'pv-sidebar-item-collapsed' : undefined,\n                      'aria-current': hasActiveChildren(item.children) && isCollapsed ? 'page' : undefined,\n                    }\"\n                    enable-trigger-slot\n                    enable-trigger-full-width\n                  >\n                    <template #trigger>\n                      <div\n                        class=\"pv-flex\"\n                        @click=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                        @auxclick=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                      >\n                        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                        <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">{{\n                          item.label\n                        }}</span>\n                      </div>\n                    </template>\n                    <div class=\"pv-sidebar-nav-nested\" :data-sidebar-collapsed=\"isCollapsed || undefined\">\n                      <template v-for=\"child in item.children\" :key=\"child.value\">\n                        <!-- Nested items - expanded-only flyout on the right; the collapsed flyout handles its own -->\n                        <PvPopoverV2\n                          v-if=\"child.children?.length\"\n                          v-model=\"nestedNavPopoverOpen[child.value]\"\n                          show-on-hover\n                          enable-group-sync\n                          enable-click-toggle\n                          :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                          :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                          position=\"right-top\"\n                          :offset=\"8\"\n                          :disabled=\"isCollapsed\"\n                          :css-custom-properties=\"{ width: '100%' }\"\n                        >\n                          <template #trigger>\n                            <a\n                              :href=\"child.url\"\n                              v-bind=\"child.linkAttrs\"\n                              :role=\"child.url ? undefined : 'button'\"\n                              :tabindex=\"child.url ? undefined : 0\"\n                              :aria-current=\"isNavItemActive(child) ? 'page' : undefined\"\n                              aria-haspopup=\"true\"\n                              :aria-expanded=\"Boolean(nestedNavPopoverOpen[child.value])\"\n                              :title=\"child.label\"\n                            >\n                              <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                                <span\n                                  class=\"pv-truncate pv-flex-item\"\n                                  :class=\"{ 'pv-link-external': child.external }\"\n                                  >{{ child.label }}</span\n                                >\n                                <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                                  child.badge.toUpperCase()\n                                }}</span>\n                              </span>\n                              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n                            </a>\n                          </template>\n                          <template #content>\n                            <PvSidebarNavFlyout :items=\"child.children\" :disabled=\"isCollapsed\" />\n                          </template>\n                        </PvPopoverV2>\n                        <a\n                          v-else\n                          :href=\"child.url\"\n                          v-bind=\"child.linkAttrs\"\n                          :aria-current=\"child.active ? 'page' : undefined\"\n                          :title=\"child.label\"\n                        >\n                          <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                            <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': child.external }\">{{\n                              child.label\n                            }}</span>\n                            <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                              child.badge.toUpperCase()\n                            }}</span>\n                          </span>\n                        </a>\n                      </template>\n                    </div>\n                  </PvAccordion>\n                </template>\n                <template #content>\n                  <PvSidebarNavFlyout :items=\"item.children\" :disabled=\"!isCollapsed\" />\n                </template>\n              </PvPopoverV2>\n            </li>\n          </template>\n        </ul>\n        <div class=\"pv-sidebar-nav-footer pv-sticky\" style=\"--bottom: 0\">\n          <PvPopoverV2\n            v-if=\"hasHelpContent\"\n            v-model=\"helpPopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :show-on-hover=\"isCollapsed\"\n            enable-group-sync\n            enable-click-toggle\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                aria-label=\"Help\"\n                :aria-expanded=\"helpPopoverOpen\"\n                title=\"Help\"\n              >\n                <PvIcon name=\"help-circle\" class=\"pv-icon-20 pv-nav-icon\" />\n                <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">Help</span>\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\">\n                <slot name=\"sidebar-help-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n\n          <PvPopoverV2\n            v-if=\"hasProfileContent && profile\"\n            v-model=\"profilePopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                data-testid=\"pv-sidebar-profile-trigger\"\n                :aria-label=\"profile.name\"\n                :aria-expanded=\"profilePopoverOpen\"\n                :title=\"profile.name\"\n              >\n                <span class=\"pv-avatar-xs\" style=\"border-radius: 50%; flex-shrink: 0\">\n                  <img v-if=\"profile.avatarUrl\" :src=\"profile.avatarUrl\" alt=\"\" />\n                  <span v-else>{{ profile.name.slice(0, 1) }}</span>\n                </span>\n                <span\n                  class=\"pv-truncate\"\n                  data-sidebar-expanded-content\n                  :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                  >{{ profile.name }}</span\n                >\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\" style=\"--height: 750px\">\n                <slot name=\"sidebar-profile-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n        </div>\n      </div>\n    </div>\n    <div class=\"content-panel\">\n      <slot />\n    </div>\n    <div ref=\"popoverTeleportTarget\" class=\"pv-sidebar-popover-portal pv-sidebar-surface-secondary\"></div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n  computed,\n  getCurrentInstance,\n  nextTick,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  useSlots,\n  watch,\n  type ComponentPublicInstance,\n  type CSSProperties,\n} from \"vue\";\nimport { useElementBounding } from \"@vueuse/core\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport PvSidebarNavFlyout from \"./PvSidebarNavFlyout.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport { hasHostSlotContent, useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport type { PvSidebarNavItem, PvSidebarOrgEntity, PvSidebarProps } from \"./types.ts\";\n\nconst props = defineProps<PvSidebarProps>();\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { present: hasAdditionalContent } = useSlotPresence(\"sidebar-additional-content\", {\n  host: customElementHost,\n});\nconst { present: hasAdditionalHeader } = useSlotPresence(\"sidebar-additional-header\", {\n  host: customElementHost,\n});\nconst { present: hasHelpContent } = useSlotPresence(\"sidebar-help-content\", { host: customElementHost });\nconst { present: hasProfileContent } = useSlotPresence(\"sidebar-profile-content\", { host: customElementHost });\nconst slots = useSlots();\nconst popoverTeleportTarget = ref<HTMLElement | null>(null);\nconst sidebarPanel = ref<HTMLElement | null>(null);\nconst hoverPanelOpen = ref<Record<string | number, boolean>>({});\nconst hoverPanelFocusRestore = ref<string | number>();\nconst hoverPanelSurfaces = new Map<string | number, HTMLElement>();\nconst hoverPanelTriggers = new Map<string | number, HTMLElement>();\nconst nativeSlotRevision = ref(0);\nconst sidebarBounds = useElementBounding(sidebarPanel);\nconst hoverPanelPositionStyles = computed<CSSProperties>(() => ({\n  \"--pv-sidebar-hover-panel-height\": `${sidebarBounds.height.value}px`,\n  \"--pv-sidebar-hover-panel-left\": `${sidebarBounds.right.value}px`,\n  \"--pv-sidebar-hover-panel-top\": `${sidebarBounds.top.value}px`,\n}));\n\nlet nativeSlotObserver: MutationObserver | undefined;\n\nconst hasHoverPanelSlot = (item: PvSidebarNavItem) => {\n  if (!item.hoverPanelSlot) return false;\n  if (!customElementHost) return Boolean(slots[item.hoverPanelSlot]);\n\n  void nativeSlotRevision.value;\n  return hasHostSlotContent(customElementHost, item.hoverPanelSlot);\n};\n\nconst setHoverPanelElement = (\n  elements: Map<string | number, HTMLElement>,\n  value: string | number,\n  element: Element | ComponentPublicInstance | null,\n) => {\n  if (element instanceof HTMLElement) elements.set(value, element);\n  else elements.delete(value);\n};\n\nconst focusableSelector =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst findFirstPanelControl = (value: string | number) => {\n  const surface = hoverPanelSurfaces.get(value);\n  const control = surface?.querySelector<HTMLElement>(focusableSelector);\n  if (control) return control;\n\n  for (const slot of surface?.querySelectorAll(\"slot\") ?? []) {\n    for (const element of slot.assignedElements({ flatten: true })) {\n      if (element.matches(focusableSelector)) return element as HTMLElement;\n      const slottedControl = element.querySelector<HTMLElement>(focusableSelector);\n      if (slottedControl) return slottedControl;\n    }\n  }\n};\n\nconst handleHoverPanelTab = (event: KeyboardEvent, value: string | number) => {\n  if (event.shiftKey) return;\n  const control = findFirstPanelControl(value);\n  if (!control) return;\n  event.preventDefault();\n  hoverPanelOpen.value[value] = true;\n  nextTick(() => control.focus());\n};\n\nconst closeHoverPanel = (value: string | number) => {\n  hoverPanelFocusRestore.value = value;\n  hoverPanelOpen.value[value] = false;\n  nextTick(() => {\n    hoverPanelTriggers.get(value)?.focus({ preventScroll: true });\n    nextTick(() => (hoverPanelFocusRestore.value = undefined));\n  });\n};\n\nconst handleHoverPanelClick = (event: MouseEvent, value: string | number) => {\n  if (\n    event\n      .composedPath()\n      .some((target) => target instanceof Element && target.hasAttribute(\"data-sidebar-nav-panel-close\"))\n  ) {\n    closeHoverPanel(value);\n  }\n};\n\nconst handleHoverPanelKeydown = (event: KeyboardEvent, value: string | number) => {\n  if (event.key !== \"Escape\") return;\n  event.preventDefault();\n  event.stopPropagation();\n  closeHoverPanel(value);\n};\n\nonMounted(() => {\n  if (!customElementHost) return;\n  nativeSlotObserver = new MutationObserver((mutations) => {\n    if (\n      mutations.some(\n        (mutation) =>\n          mutation.target === customElementHost ||\n          (mutation.type === \"attributes\" && mutation.target.parentNode === customElementHost),\n      )\n    ) {\n      nativeSlotRevision.value += 1;\n    }\n  });\n  nativeSlotObserver.observe(customElementHost, {\n    attributes: true,\n    attributeFilter: [\"slot\"],\n    childList: true,\n    subtree: true,\n  });\n});\n\nonBeforeUnmount(() => nativeSlotObserver?.disconnect());\n\nconst findActiveEntity = (entities: PvSidebarOrgEntity[]): PvSidebarOrgEntity | undefined => {\n  for (const entity of entities) {\n    if (entity.active) return entity;\n    const activeChild = entity.entities && findActiveEntity(entity.entities);\n    if (activeChild) return activeChild;\n  }\n  return undefined;\n};\n\nconst activeOrganization = computed(\n  () => (props.organizations && findActiveEntity(props.organizations)) ?? props.organizations?.[0],\n);\n\nconst initialOpenNavItems = (): Record<string | number, boolean> => {\n  const open: Record<string | number, boolean> = {};\n  props.navItems?.forEach((item) => {\n    if (isNavItemActive(item)) open[item.value] = true;\n  });\n  return open;\n};\n\nconst openNavItems = ref<Record<string | number, boolean>>(initialOpenNavItems());\n\n// Re-syncs whenever navItems changes (e.g. a client-side route change recomputes\n// `active` on the consumer's side), not just once at mount — merges in newly-active\n// items without forcing already-open/closed items the user has manually toggled.\nwatch(\n  () => props.navItems,\n  (items) => {\n    items?.forEach((item) => {\n      if (isNavItemActive(item)) {\n        openNavItems.value[item.value] = true;\n      }\n    });\n  },\n);\n\nconst isCollapsed = defineModel<boolean>({ default: false });\nconst isTransitioning = ref(false);\nconst isExpanding = computed(() => !isCollapsed.value && isTransitioning.value);\n\nconst emit = defineEmits<{\n  (e: \"change\", payload: { collapsed: boolean }): void;\n}>();\n\nconst helpPopoverOpen = ref(false);\nconst organizationPopoverOpen = ref(false);\nconst profilePopoverOpen = ref(false);\nconst nestedNavPopoverOpen = ref<Record<string | number, boolean>>({});\n\nconst closeSidebarPopovers = () => {\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  nestedNavPopoverOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n};\n\nwatch(helpPopoverOpen, (open) => {\n  if (!open) return;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n});\nwatch(organizationPopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  profilePopoverOpen.value = false;\n});\nwatch(profilePopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n});\nwatch(isCollapsed, () => {\n  closeSidebarPopovers();\n  isTransitioning.value = true;\n});\n\nconst toggle = () => {\n  isCollapsed.value = !isCollapsed.value;\n  emit(\"change\", { collapsed: isCollapsed.value });\n};\n\nconst handleTransitionEnd = (event: TransitionEvent) => {\n  if (event.target === event.currentTarget && event.propertyName === \"grid-template-columns\") {\n    isTransitioning.value = false;\n  }\n};\n\nconst hasActiveChildren = (children: PvSidebarNavItem[]) => {\n  return children.some(isNavItemActive);\n};\n\n// This trigger renders inside PvAccordion's native <summary>, which can't contain\n// a real <a> (invalid nesting of interactive content), so modifier-clicks have to\n// be replicated manually to keep new-tab/new-window behavior working for mouse users.\nconst handleRedirect = (event: MouseEvent, child: PvSidebarNavItem) => {\n  if (!child.url) return;\n  if (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1) {\n    window.open(child.url, \"_blank\", \"noopener\");\n    return;\n  }\n  window.location.href = child.url;\n};\n</script>\n\n<template>\n  <div\n    class=\"sidebar-layout sidebar-layout-new sidebar-layout-secondary\"\n    :class=\"{\n      'is-collapsed': isCollapsed,\n      'is-expanded': !isCollapsed,\n      'is-transitioning': isTransitioning,\n    }\"\n    :style=\"hoverPanelPositionStyles\"\n    @transitionend=\"handleTransitionEnd\"\n  >\n    <div ref=\"sidebarPanel\" class=\"sidebar-panel\">\n      <div>\n        <div v-if=\"hasAdditionalHeader\" class=\"sidebar-additional-header\">\n          <slot name=\"sidebar-additional-header\" />\n        </div>\n        <div\n          class=\"sidebar-header\"\n          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n          :class=\"[{ 'pv-border-bottom': isCollapsed }]\"\n        >\n          <div class=\"sidebar-header-content pv-full-width\">\n            <div\n              v-if=\"organizations && organizations.length\"\n              class=\"pv-sidebar-nav-header pv-sidebar-surface-secondary\"\n            >\n              <PvPopoverV2\n                v-model=\"organizationPopoverOpen\"\n                :position=\"isCollapsed ? 'right-top' : 'bottom-left'\"\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvTooltipV2\n                    :description=\"activeOrganization?.label\"\n                    :disabled=\"!isCollapsed || isTransitioning || organizationPopoverOpen\"\n                    variant=\"white\"\n                    position=\"center-right\"\n                    :delay=\"250\"\n                    :offset=\"4\"\n                    enable-group-sync\n                    :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                    :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                    :css-custom-properties=\"{ width: '100%' }\"\n                  >\n                    <template #trigger>\n                      <button\n                        type=\"button\"\n                        class=\"pv-nav-list-item pv-full-width pv-space-between\"\n                        :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                        data-testid=\"pv-sidebar-org-switcher\"\n                        :aria-label=\"`Switch organization: ${activeOrganization?.label}`\"\n                        :aria-expanded=\"organizationPopoverOpen\"\n                      >\n                        <div class=\"pv-flex\" style=\"min-width: 0\">\n                          <span class=\"pv-avatar-xs\" style=\"border-radius: 4px; flex-shrink: 0\">\n                            <img\n                              v-if=\"activeOrganization?.avatarUrl\"\n                              :src=\"activeOrganization.avatarUrl\"\n                              alt=\"Organization Avatar\"\n                            />\n                            <span v-else>{{ activeOrganization?.label?.slice(0, 1) }}</span>\n                          </span>\n                          <span\n                            class=\"pv-text-title-lg pv-truncate\"\n                            data-sidebar-expanded-content\n                            :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                            :data-sidebar-expanding=\"isExpanding || undefined\"\n                            :title=\"activeOrganization?.label\"\n                            >{{ activeOrganization?.label }}</span\n                          >\n                        </div>\n                        <PvIcon\n                          name=\"chevron-down\"\n                          class=\"pv-icon-16\"\n                          data-sidebar-expanded-content\n                          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                          :data-sidebar-expanding=\"isExpanding || undefined\"\n                        />\n                      </button>\n                    </template>\n                  </PvTooltipV2>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"width: fit-content; max-width: 280px; margin-top: 4px\">\n                    <ul\n                      role=\"list\"\n                      class=\"pv-popover-list pv-flow\"\n                      style=\"--flow-size: 0.25rem\"\n                      data-testid=\"pv-sidebar-org-list\"\n                    >\n                      <template v-for=\"organization in organizations\" :key=\"organization.value\">\n                        <li :data-active=\"organization.active || undefined\">\n                          <a\n                            class=\"pv-flex\"\n                            :href=\"organization.url\"\n                            data-testid=\"pv-sidebar-org-option\"\n                            :data-org-value=\"organization.value\"\n                          >\n                            <div class=\"pv-avatar-xs\" style=\"border-radius: 4px\">\n                              <img\n                                v-if=\"organization.avatarUrl\"\n                                :src=\"organization.avatarUrl\"\n                                alt=\"Organization Avatar\"\n                              />\n                              <span v-else>{{ organization.label.slice(0, 1) }}</span>\n                            </div>\n                            <span class=\"pv-truncate pv-flex-item\" :title=\"organization.label\">{{\n                              organization.label\n                            }}</span>\n                          </a>\n                        </li>\n                        <li\n                          v-for=\"entity in organization.entities\"\n                          :key=\"entity.value\"\n                          style=\"padding-left: 0.5rem\"\n                          :data-active=\"entity.active || undefined\"\n                        >\n                          <a\n                            class=\"pv-flex pv-truncate\"\n                            :href=\"entity.url\"\n                            style=\"max-width: 100%\"\n                            data-testid=\"pv-sidebar-org-entity\"\n                            :data-org-value=\"entity.value\"\n                          >\n                            <PvIcon name=\"corner-down-right\" />\n                            <span class=\"pv-truncate\" :title=\"entity.label\">{{ entity.label }}</span>\n                          </a>\n                        </li>\n                      </template>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n            </div>\n          </div>\n          <PvTooltipV2 v-if=\"!disableToggle\" variant=\"white\" position=\"center-right\" :delay=\"1000\">\n            <template #trigger>\n              <PvButton\n                class=\"sidebar-toggle\"\n                :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                :data-sidebar-expanding=\"isExpanding || undefined\"\n                :left-icon=\"isCollapsed ? 'panel-left-open' : 'panel-left-close'\"\n                :aria-label=\"isCollapsed ? 'Open sidebar' : 'Close sidebar'\"\n                variant=\"ghost\"\n                @click=\"toggle\"\n              />\n            </template>\n            <template #content> {{ isCollapsed ? \"Expand navigation\" : \"Collapse navigation\" }} </template>\n          </PvTooltipV2>\n        </div>\n      </div>\n      <div class=\"pv-sidebar-nav pv-sidebar-surface-secondary\">\n        <div v-if=\"hasAdditionalContent\">\n          <slot name=\"sidebar-additional-content\" />\n        </div>\n        <ul v-if=\"navItems && navItems.length\" role=\"list\" class=\"pv-full-width pv-flow\" style=\"--flow-size: 0.25rem\">\n          <template v-for=\"item in navItems\" :key=\"item.value\">\n            <li v-if=\"item.separatorAtTop\" class=\"pv-sidebar-nav-separator\" aria-hidden=\"true\"></li>\n            <li>\n              <!-- Slotted full-height panel - available while collapsed or expanded -->\n              <PvPopoverV2\n                v-if=\"hasHoverPanelSlot(item)\"\n                v-model=\"hoverPanelOpen[item.value]\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"hoverPanelFocusRestore === item.value\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <component\n                    :is=\"item.url ? 'a' : 'button'\"\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelTriggers, item.value, element)\n                    \"\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    :type=\"item.url ? undefined : 'button'\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :aria-expanded=\"Boolean(hoverPanelOpen[item.value])\"\n                    :aria-label=\"isCollapsed ? item.label : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                    @keydown.tab=\"handleHoverPanelTab($event, item.value)\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </component>\n                </template>\n                <template #content>\n                  <div\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelSurfaces, item.value, element)\n                    \"\n                    class=\"pv-sidebar-hover-panel\"\n                    @click=\"handleHoverPanelClick($event, item.value)\"\n                    @keydown=\"handleHoverPanelKeydown($event, item.value)\"\n                  >\n                    <slot :name=\"item.hoverPanelSlot\" />\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Leaf item - direct link with a collapsed interactive flyout -->\n              <PvPopoverV2\n                v-else-if=\"!item.children || item.children.length === 0\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <a\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </a>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"--position: static\">\n                    <ul role=\"list\" class=\"pv-popover-list\">\n                      <li :data-active=\"item.active || undefined\">\n                        <a :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n                          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                            item.label\n                          }}</span>\n                          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                        </a>\n                      </li>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Child items - accordion with a collapsed hover flyout -->\n              <PvPopoverV2\n                v-else\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvAccordion\n                    v-model=\"openNavItems[item.value]\"\n                    :default-open=\"isNavItemActive(item)\"\n                    :summary-attrs=\"{\n                      class: isCollapsed ? 'pv-sidebar-item-collapsed' : undefined,\n                      'aria-current': hasActiveChildren(item.children) && isCollapsed ? 'page' : undefined,\n                    }\"\n                    enable-trigger-slot\n                    enable-trigger-full-width\n                  >\n                    <template #trigger>\n                      <div\n                        class=\"pv-flex\"\n                        @click=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                        @auxclick=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                      >\n                        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                        <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">{{\n                          item.label\n                        }}</span>\n                      </div>\n                    </template>\n                    <div class=\"pv-sidebar-nav-nested\" :data-sidebar-collapsed=\"isCollapsed || undefined\">\n                      <template v-for=\"child in item.children\" :key=\"child.value\">\n                        <!-- Nested items - expanded-only flyout on the right; the collapsed flyout handles its own -->\n                        <PvPopoverV2\n                          v-if=\"child.children?.length\"\n                          v-model=\"nestedNavPopoverOpen[child.value]\"\n                          show-on-hover\n                          enable-group-sync\n                          enable-click-toggle\n                          :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                          :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                          position=\"right-top\"\n                          :offset=\"8\"\n                          :disabled=\"isCollapsed\"\n                          :css-custom-properties=\"{ width: '100%' }\"\n                        >\n                          <template #trigger>\n                            <a\n                              :href=\"child.url\"\n                              v-bind=\"child.linkAttrs\"\n                              :role=\"child.url ? undefined : 'button'\"\n                              :tabindex=\"child.url ? undefined : 0\"\n                              :aria-current=\"isNavItemActive(child) ? 'page' : undefined\"\n                              aria-haspopup=\"true\"\n                              :aria-expanded=\"Boolean(nestedNavPopoverOpen[child.value])\"\n                              :title=\"child.label\"\n                            >\n                              <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                                <span\n                                  class=\"pv-truncate pv-flex-item\"\n                                  :class=\"{ 'pv-link-external': child.external }\"\n                                  >{{ child.label }}</span\n                                >\n                                <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                                  child.badge.toUpperCase()\n                                }}</span>\n                              </span>\n                              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n                            </a>\n                          </template>\n                          <template #content>\n                            <PvSidebarNavFlyout :items=\"child.children\" :disabled=\"isCollapsed\" />\n                          </template>\n                        </PvPopoverV2>\n                        <a\n                          v-else\n                          :href=\"child.url\"\n                          v-bind=\"child.linkAttrs\"\n                          :aria-current=\"child.active ? 'page' : undefined\"\n                          :title=\"child.label\"\n                        >\n                          <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                            <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': child.external }\">{{\n                              child.label\n                            }}</span>\n                            <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                              child.badge.toUpperCase()\n                            }}</span>\n                          </span>\n                        </a>\n                      </template>\n                    </div>\n                  </PvAccordion>\n                </template>\n                <template #content>\n                  <PvSidebarNavFlyout :items=\"item.children\" :disabled=\"!isCollapsed\" />\n                </template>\n              </PvPopoverV2>\n            </li>\n          </template>\n        </ul>\n        <div class=\"pv-sidebar-nav-footer pv-sticky\" style=\"--bottom: 0\">\n          <PvPopoverV2\n            v-if=\"hasHelpContent\"\n            v-model=\"helpPopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :show-on-hover=\"isCollapsed\"\n            enable-group-sync\n            enable-click-toggle\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                aria-label=\"Help\"\n                :aria-expanded=\"helpPopoverOpen\"\n                title=\"Help\"\n              >\n                <PvIcon name=\"help-circle\" class=\"pv-icon-20 pv-nav-icon\" />\n                <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">Help</span>\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\">\n                <slot name=\"sidebar-help-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n\n          <PvPopoverV2\n            v-if=\"hasProfileContent && profile\"\n            v-model=\"profilePopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                data-testid=\"pv-sidebar-profile-trigger\"\n                :aria-label=\"profile.name\"\n                :aria-expanded=\"profilePopoverOpen\"\n                :title=\"profile.name\"\n              >\n                <span class=\"pv-avatar-xs\" style=\"border-radius: 50%; flex-shrink: 0\">\n                  <img v-if=\"profile.avatarUrl\" :src=\"profile.avatarUrl\" alt=\"\" />\n                  <span v-else>{{ profile.name.slice(0, 1) }}</span>\n                </span>\n                <span\n                  class=\"pv-truncate\"\n                  data-sidebar-expanded-content\n                  :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                  >{{ profile.name }}</span\n                >\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\" style=\"--height: 750px\">\n                <slot name=\"sidebar-profile-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n        </div>\n      </div>\n    </div>\n    <div class=\"content-panel\">\n      <slot />\n    </div>\n    <div ref=\"popoverTeleportTarget\" class=\"pv-sidebar-popover-portal pv-sidebar-surface-secondary\"></div>\n  </div>\n</template>\n","import type { PvSidebarNavItem } from \"./types.ts\";\n\n/** True when the item itself or any of its descendants is the current page. */\nexport const isNavItemActive = (item: PvSidebarNavItem): boolean =>\n  Boolean(item.active || item.children?.some(isNavItemActive));\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport type { PvSidebarNavItem } from \"./types.ts\";\n\ndefineOptions({ name: \"PvSidebarV2NavFlyout\" });\n\ndefineProps<{\n  items: PvSidebarNavItem[];\n  /** Keeps nested flyouts closed while the surface hosting this list is inactive. */\n  disabled?: boolean;\n}>();\n\nconst openItems = ref<Record<string | number, boolean>>({});\n</script>\n\n<template>\n  <div class=\"pv-popover\" style=\"--position: static; --height: 350px\">\n    <ul role=\"list\" class=\"pv-popover-list\">\n      <li v-for=\"item in items\" :key=\"item.value\" :data-active=\"(!item.children?.length && item.active) || undefined\">\n        <!-- Nested items - another flyout on the right, rendered inside this one so hovering it keeps this open.\n             Not teleported: the nested surface has to stay a DOM descendant of this one for that to hold. -->\n        <PvPopoverV2\n          v-if=\"item.children?.length\"\n          v-model=\"openItems[item.value]\"\n          show-on-hover\n          enable-group-sync\n          enable-click-toggle\n          position=\"right-top\"\n          :offset=\"8\"\n          :disabled=\"disabled\"\n          :css-custom-properties=\"{ width: '100%' }\"\n        >\n          <template #trigger>\n            <a\n              :href=\"item.url\"\n              v-bind=\"item.linkAttrs\"\n              :role=\"item.url ? undefined : 'button'\"\n              :tabindex=\"item.url ? undefined : 0\"\n              :data-active=\"isNavItemActive(item) || undefined\"\n              aria-haspopup=\"true\"\n              :aria-expanded=\"Boolean(openItems[item.value])\"\n              style=\"flex-wrap: wrap\"\n            >\n              <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                item.label\n              }}</span>\n              <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n            </a>\n          </template>\n          <template #content>\n            <PvSidebarV2NavFlyout :items=\"item.children\" :disabled=\"disabled\" />\n          </template>\n        </PvPopoverV2>\n\n        <a v-else :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{ item.label }}</span>\n          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n        </a>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport type { PvSidebarNavItem } from \"./types.ts\";\n\ndefineOptions({ name: \"PvSidebarV2NavFlyout\" });\n\ndefineProps<{\n  items: PvSidebarNavItem[];\n  /** Keeps nested flyouts closed while the surface hosting this list is inactive. */\n  disabled?: boolean;\n}>();\n\nconst openItems = ref<Record<string | number, boolean>>({});\n</script>\n\n<template>\n  <div class=\"pv-popover\" style=\"--position: static; --height: 350px\">\n    <ul role=\"list\" class=\"pv-popover-list\">\n      <li v-for=\"item in items\" :key=\"item.value\" :data-active=\"(!item.children?.length && item.active) || undefined\">\n        <!-- Nested items - another flyout on the right, rendered inside this one so hovering it keeps this open.\n             Not teleported: the nested surface has to stay a DOM descendant of this one for that to hold. -->\n        <PvPopoverV2\n          v-if=\"item.children?.length\"\n          v-model=\"openItems[item.value]\"\n          show-on-hover\n          enable-group-sync\n          enable-click-toggle\n          position=\"right-top\"\n          :offset=\"8\"\n          :disabled=\"disabled\"\n          :css-custom-properties=\"{ width: '100%' }\"\n        >\n          <template #trigger>\n            <a\n              :href=\"item.url\"\n              v-bind=\"item.linkAttrs\"\n              :role=\"item.url ? undefined : 'button'\"\n              :tabindex=\"item.url ? undefined : 0\"\n              :data-active=\"isNavItemActive(item) || undefined\"\n              aria-haspopup=\"true\"\n              :aria-expanded=\"Boolean(openItems[item.value])\"\n              style=\"flex-wrap: wrap\"\n            >\n              <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                item.label\n              }}</span>\n              <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n            </a>\n          </template>\n          <template #content>\n            <PvSidebarV2NavFlyout :items=\"item.children\" :disabled=\"disabled\" />\n          </template>\n        </PvPopoverV2>\n\n        <a v-else :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{ item.label }}</span>\n          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n        </a>\n      </li>\n    </ul>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n  computed,\n  getCurrentInstance,\n  nextTick,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  useSlots,\n  watch,\n  type ComponentPublicInstance,\n  type CSSProperties,\n} from \"vue\";\nimport { useElementBounding } from \"@vueuse/core\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport PvSidebarV2NavFlyout from \"./PvSidebarV2NavFlyout.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport { hasHostSlotContent, useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport type { PvSidebarNavItem, PvSidebarOrgEntity, PvSidebarV2Props } from \"./types.ts\";\n\nconst props = defineProps<PvSidebarV2Props>();\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { present: hasAdditionalContent } = useSlotPresence(\"sidebar-additional-content\", {\n  host: customElementHost,\n});\nconst { present: hasAdditionalHeader } = useSlotPresence(\"sidebar-additional-header\", {\n  host: customElementHost,\n});\nconst { present: hasHelpContent } = useSlotPresence(\"sidebar-help-content\", { host: customElementHost });\nconst { present: hasProfileContent } = useSlotPresence(\"sidebar-profile-content\", { host: customElementHost });\nconst slots = useSlots();\nconst popoverTeleportTarget = ref<HTMLElement | null>(null);\nconst sidebarPanel = ref<HTMLElement | null>(null);\nconst hoverPanelOpen = ref<Record<string | number, boolean>>({});\nconst hoverPanelFocusRestore = ref<string | number>();\nconst hoverPanelSurfaces = new Map<string | number, HTMLElement>();\nconst hoverPanelTriggers = new Map<string | number, HTMLElement>();\nconst nativeSlotRevision = ref(0);\nconst sidebarBounds = useElementBounding(sidebarPanel);\nconst hoverPanelPositionStyles = computed<CSSProperties>(() => ({\n  \"--pv-sidebar-hover-panel-height\": `${sidebarBounds.height.value}px`,\n  \"--pv-sidebar-hover-panel-left\": `${sidebarBounds.right.value}px`,\n  \"--pv-sidebar-hover-panel-top\": `${sidebarBounds.top.value}px`,\n}));\n\nlet nativeSlotObserver: MutationObserver | undefined;\n\nconst hasHoverPanelSlot = (item: PvSidebarNavItem) => {\n  if (!item.hoverPanelSlot) return false;\n  if (!customElementHost) return Boolean(slots[item.hoverPanelSlot]);\n\n  void nativeSlotRevision.value;\n  return hasHostSlotContent(customElementHost, item.hoverPanelSlot);\n};\n\nconst setHoverPanelElement = (\n  elements: Map<string | number, HTMLElement>,\n  value: string | number,\n  element: Element | ComponentPublicInstance | null,\n) => {\n  if (element instanceof HTMLElement) elements.set(value, element);\n  else elements.delete(value);\n};\n\nconst focusableSelector =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst findFirstPanelControl = (value: string | number) => {\n  const surface = hoverPanelSurfaces.get(value);\n  const control = surface?.querySelector<HTMLElement>(focusableSelector);\n  if (control) return control;\n\n  for (const slot of surface?.querySelectorAll(\"slot\") ?? []) {\n    for (const element of slot.assignedElements({ flatten: true })) {\n      if (element.matches(focusableSelector)) return element as HTMLElement;\n      const slottedControl = element.querySelector<HTMLElement>(focusableSelector);\n      if (slottedControl) return slottedControl;\n    }\n  }\n};\n\nconst handleHoverPanelTab = (event: KeyboardEvent, value: string | number) => {\n  if (event.shiftKey) return;\n  const control = findFirstPanelControl(value);\n  if (!control) return;\n  event.preventDefault();\n  hoverPanelOpen.value[value] = true;\n  nextTick(() => control.focus());\n};\n\nconst closeHoverPanel = (value: string | number) => {\n  hoverPanelFocusRestore.value = value;\n  hoverPanelOpen.value[value] = false;\n  nextTick(() => {\n    hoverPanelTriggers.get(value)?.focus({ preventScroll: true });\n    nextTick(() => (hoverPanelFocusRestore.value = undefined));\n  });\n};\n\nconst handleHoverPanelClick = (event: MouseEvent, value: string | number) => {\n  if (\n    event\n      .composedPath()\n      .some((target) => target instanceof Element && target.hasAttribute(\"data-sidebar-nav-panel-close\"))\n  ) {\n    closeHoverPanel(value);\n  }\n};\n\nconst handleHoverPanelKeydown = (event: KeyboardEvent, value: string | number) => {\n  if (event.key !== \"Escape\") return;\n  event.preventDefault();\n  event.stopPropagation();\n  closeHoverPanel(value);\n};\n\nonMounted(() => {\n  if (!customElementHost) return;\n  nativeSlotObserver = new MutationObserver((mutations) => {\n    if (\n      mutations.some(\n        (mutation) =>\n          mutation.target === customElementHost ||\n          (mutation.type === \"attributes\" && mutation.target.parentNode === customElementHost),\n      )\n    ) {\n      nativeSlotRevision.value += 1;\n    }\n  });\n  nativeSlotObserver.observe(customElementHost, {\n    attributes: true,\n    attributeFilter: [\"slot\"],\n    childList: true,\n    subtree: true,\n  });\n});\n\nonBeforeUnmount(() => nativeSlotObserver?.disconnect());\n\nconst findActiveEntity = (entities: PvSidebarOrgEntity[]): PvSidebarOrgEntity | undefined => {\n  for (const entity of entities) {\n    if (entity.active) return entity;\n    const activeChild = entity.entities && findActiveEntity(entity.entities);\n    if (activeChild) return activeChild;\n  }\n  return undefined;\n};\n\nconst activeOrganization = computed(\n  () => (props.organizations && findActiveEntity(props.organizations)) ?? props.organizations?.[0],\n);\n\nconst initialOpenNavItems = (): Record<string | number, boolean> => {\n  const open: Record<string | number, boolean> = {};\n  props.navItems?.forEach((item) => {\n    if (isNavItemActive(item)) open[item.value] = true;\n  });\n  return open;\n};\n\nconst openNavItems = ref<Record<string | number, boolean>>(initialOpenNavItems());\n\n// Re-syncs whenever navItems changes (e.g. a client-side route change recomputes\n// `active` on the consumer's side), not just once at mount — merges in newly-active\n// items without forcing already-open/closed items the user has manually toggled.\nwatch(\n  () => props.navItems,\n  (items) => {\n    items?.forEach((item) => {\n      if (isNavItemActive(item)) {\n        openNavItems.value[item.value] = true;\n      }\n    });\n  },\n);\n\nconst isCollapsed = defineModel<boolean>({ default: false });\nconst isTransitioning = ref(false);\nconst isExpanding = computed(() => !isCollapsed.value && isTransitioning.value);\n\nconst emit = defineEmits<{\n  (e: \"change\", payload: { collapsed: boolean }): void;\n}>();\n\nconst helpPopoverOpen = ref(false);\nconst organizationPopoverOpen = ref(false);\nconst profilePopoverOpen = ref(false);\nconst nestedNavPopoverOpen = ref<Record<string | number, boolean>>({});\n\nconst closeSidebarPopovers = () => {\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  nestedNavPopoverOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n};\n\nwatch(helpPopoverOpen, (open) => {\n  if (!open) return;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n});\nwatch(organizationPopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  profilePopoverOpen.value = false;\n});\nwatch(profilePopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n});\nwatch(isCollapsed, () => {\n  closeSidebarPopovers();\n  isTransitioning.value = true;\n});\n\nconst toggle = () => {\n  isCollapsed.value = !isCollapsed.value;\n  emit(\"change\", { collapsed: isCollapsed.value });\n};\n\nconst handleTransitionEnd = (event: TransitionEvent) => {\n  if (event.target === event.currentTarget && event.propertyName === \"grid-template-columns\") {\n    isTransitioning.value = false;\n  }\n};\n\nconst hasActiveChildren = (children: PvSidebarNavItem[]) => {\n  return children.some(isNavItemActive);\n};\n\n// This trigger renders inside PvAccordion's native <summary>, which can't contain\n// a real <a> (invalid nesting of interactive content), so modifier-clicks have to\n// be replicated manually to keep new-tab/new-window behavior working for mouse users.\nconst handleRedirect = (event: MouseEvent, child: PvSidebarNavItem) => {\n  if (!child.url) return;\n  if (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1) {\n    window.open(child.url, \"_blank\", \"noopener\");\n    return;\n  }\n  window.location.href = child.url;\n};\n</script>\n\n<template>\n  <div\n    class=\"sidebar-layout sidebar-layout-new\"\n    :class=\"[\n      variant && `sidebar-layout-${variant}`,\n      {\n        'is-collapsed': isCollapsed,\n        'is-expanded': !isCollapsed,\n        'is-transitioning': isTransitioning,\n      },\n    ]\"\n    :style=\"hoverPanelPositionStyles\"\n    @transitionend=\"handleTransitionEnd\"\n  >\n    <div ref=\"sidebarPanel\" class=\"sidebar-panel\">\n      <div>\n        <div v-if=\"hasAdditionalHeader\" class=\"sidebar-additional-header\">\n          <slot name=\"sidebar-additional-header\" />\n        </div>\n        <div\n          class=\"sidebar-header\"\n          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n          :class=\"[{ 'pv-border-bottom': isCollapsed }]\"\n        >\n          <div class=\"sidebar-header-content pv-full-width\">\n            <div\n              v-if=\"organizations && organizations.length\"\n              class=\"pv-sidebar-nav-header\"\n              :class=\"variant && `pv-sidebar-surface-${variant}`\"\n            >\n              <PvPopoverV2\n                v-model=\"organizationPopoverOpen\"\n                :position=\"isCollapsed ? 'right-top' : 'bottom-left'\"\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvTooltipV2\n                    :description=\"activeOrganization?.label\"\n                    :disabled=\"!isCollapsed || isTransitioning || organizationPopoverOpen\"\n                    variant=\"white\"\n                    position=\"center-right\"\n                    :delay=\"250\"\n                    :offset=\"4\"\n                    enable-group-sync\n                    :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                    :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                    :css-custom-properties=\"{ width: '100%' }\"\n                  >\n                    <template #trigger>\n                      <button\n                        type=\"button\"\n                        class=\"pv-nav-list-item pv-full-width pv-space-between\"\n                        :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                        data-testid=\"pv-sidebar-org-switcher\"\n                        :aria-label=\"`Switch organization: ${activeOrganization?.label}`\"\n                        :aria-expanded=\"organizationPopoverOpen\"\n                      >\n                        <div class=\"pv-flex\" style=\"min-width: 0\">\n                          <span class=\"pv-avatar-xs\" style=\"border-radius: 4px; flex-shrink: 0\">\n                            <img\n                              v-if=\"activeOrganization?.avatarUrl\"\n                              :src=\"activeOrganization.avatarUrl\"\n                              alt=\"Organization Avatar\"\n                            />\n                            <span v-else>{{ activeOrganization?.label?.slice(0, 1) }}</span>\n                          </span>\n                          <span\n                            class=\"pv-text-title-lg pv-truncate\"\n                            data-sidebar-expanded-content\n                            :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                            :data-sidebar-expanding=\"isExpanding || undefined\"\n                            :title=\"activeOrganization?.label\"\n                            >{{ activeOrganization?.label }}</span\n                          >\n                        </div>\n                        <PvIcon\n                          name=\"chevron-down\"\n                          class=\"pv-icon-16\"\n                          data-sidebar-expanded-content\n                          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                          :data-sidebar-expanding=\"isExpanding || undefined\"\n                        />\n                      </button>\n                    </template>\n                  </PvTooltipV2>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"width: fit-content; max-width: 280px; margin-top: 4px\">\n                    <ul\n                      role=\"list\"\n                      class=\"pv-popover-list pv-flow\"\n                      style=\"--flow-size: 0.25rem\"\n                      data-testid=\"pv-sidebar-org-list\"\n                    >\n                      <template v-for=\"organization in organizations\" :key=\"organization.value\">\n                        <li :data-active=\"organization.active || undefined\">\n                          <a\n                            class=\"pv-flex\"\n                            :href=\"organization.url\"\n                            data-testid=\"pv-sidebar-org-option\"\n                            :data-org-value=\"organization.value\"\n                          >\n                            <div class=\"pv-avatar-xs\" style=\"border-radius: 4px\">\n                              <img\n                                v-if=\"organization.avatarUrl\"\n                                :src=\"organization.avatarUrl\"\n                                alt=\"Organization Avatar\"\n                              />\n                              <span v-else>{{ organization.label.slice(0, 1) }}</span>\n                            </div>\n                            <span class=\"pv-truncate pv-flex-item\" :title=\"organization.label\">{{\n                              organization.label\n                            }}</span>\n                          </a>\n                        </li>\n                        <li\n                          v-for=\"entity in organization.entities\"\n                          :key=\"entity.value\"\n                          style=\"padding-left: 0.5rem\"\n                          :data-active=\"entity.active || undefined\"\n                        >\n                          <a\n                            class=\"pv-flex pv-truncate\"\n                            :href=\"entity.url\"\n                            style=\"max-width: 100%\"\n                            data-testid=\"pv-sidebar-org-entity\"\n                            :data-org-value=\"entity.value\"\n                          >\n                            <PvIcon name=\"corner-down-right\" />\n                            <span class=\"pv-truncate\" :title=\"entity.label\">{{ entity.label }}</span>\n                          </a>\n                        </li>\n                      </template>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n            </div>\n          </div>\n          <PvTooltipV2 v-if=\"!disableToggle\" variant=\"white\" position=\"center-right\" :delay=\"1000\">\n            <template #trigger>\n              <PvButton\n                class=\"sidebar-toggle\"\n                :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                :data-sidebar-expanding=\"isExpanding || undefined\"\n                :left-icon=\"isCollapsed ? 'panel-left-open' : 'panel-left-close'\"\n                :aria-label=\"isCollapsed ? 'Open sidebar' : 'Close sidebar'\"\n                variant=\"ghost\"\n                @click=\"toggle\"\n              />\n            </template>\n            <template #content> {{ isCollapsed ? \"Expand navigation\" : \"Collapse navigation\" }} </template>\n          </PvTooltipV2>\n        </div>\n      </div>\n      <div class=\"pv-sidebar-nav\" :class=\"variant && `pv-sidebar-surface-${variant}`\">\n        <div v-if=\"hasAdditionalContent\">\n          <slot name=\"sidebar-additional-content\" />\n        </div>\n        <ul v-if=\"navItems && navItems.length\" role=\"list\" class=\"pv-full-width pv-flow\" style=\"--flow-size: 0.25rem\">\n          <template v-for=\"item in navItems\" :key=\"item.value\">\n            <li v-if=\"item.separatorAtTop\" class=\"pv-sidebar-nav-separator\" aria-hidden=\"true\"></li>\n            <li>\n              <!-- Slotted full-height panel - available while collapsed or expanded -->\n              <PvPopoverV2\n                v-if=\"hasHoverPanelSlot(item)\"\n                v-model=\"hoverPanelOpen[item.value]\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"hoverPanelFocusRestore === item.value\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <component\n                    :is=\"item.url ? 'a' : 'button'\"\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelTriggers, item.value, element)\n                    \"\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    :type=\"item.url ? undefined : 'button'\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :aria-expanded=\"Boolean(hoverPanelOpen[item.value])\"\n                    :aria-label=\"isCollapsed ? item.label : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                    @keydown.tab=\"handleHoverPanelTab($event, item.value)\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </component>\n                </template>\n                <template #content>\n                  <div\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelSurfaces, item.value, element)\n                    \"\n                    class=\"pv-sidebar-hover-panel\"\n                    @click=\"handleHoverPanelClick($event, item.value)\"\n                    @keydown=\"handleHoverPanelKeydown($event, item.value)\"\n                  >\n                    <slot :name=\"item.hoverPanelSlot\" />\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Leaf item - direct link with a collapsed interactive flyout -->\n              <PvPopoverV2\n                v-else-if=\"!item.children || item.children.length === 0\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <a\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </a>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"--position: static\">\n                    <ul role=\"list\" class=\"pv-popover-list\">\n                      <li :data-active=\"item.active || undefined\">\n                        <a :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n                          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                            item.label\n                          }}</span>\n                          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                        </a>\n                      </li>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Child items - accordion with a collapsed hover flyout -->\n              <PvPopoverV2\n                v-else\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvAccordion\n                    v-model=\"openNavItems[item.value]\"\n                    :default-open=\"isNavItemActive(item)\"\n                    :summary-attrs=\"{\n                      class: isCollapsed ? 'pv-sidebar-item-collapsed' : undefined,\n                      'aria-current': hasActiveChildren(item.children) && isCollapsed ? 'page' : undefined,\n                    }\"\n                    enable-trigger-slot\n                    enable-trigger-full-width\n                  >\n                    <template #trigger>\n                      <div\n                        class=\"pv-flex\"\n                        @click=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                        @auxclick=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                      >\n                        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                        <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">{{\n                          item.label\n                        }}</span>\n                      </div>\n                    </template>\n                    <div class=\"pv-sidebar-nav-nested\" :data-sidebar-collapsed=\"isCollapsed || undefined\">\n                      <template v-for=\"child in item.children\" :key=\"child.value\">\n                        <!-- Nested items - expanded-only flyout on the right; the collapsed flyout handles its own -->\n                        <PvPopoverV2\n                          v-if=\"child.children?.length\"\n                          v-model=\"nestedNavPopoverOpen[child.value]\"\n                          show-on-hover\n                          enable-group-sync\n                          enable-click-toggle\n                          :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                          :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                          position=\"right-top\"\n                          :offset=\"8\"\n                          :disabled=\"isCollapsed\"\n                          :css-custom-properties=\"{ width: '100%' }\"\n                        >\n                          <template #trigger>\n                            <a\n                              :href=\"child.url\"\n                              v-bind=\"child.linkAttrs\"\n                              :role=\"child.url ? undefined : 'button'\"\n                              :tabindex=\"child.url ? undefined : 0\"\n                              :aria-current=\"isNavItemActive(child) ? 'page' : undefined\"\n                              aria-haspopup=\"true\"\n                              :aria-expanded=\"Boolean(nestedNavPopoverOpen[child.value])\"\n                              :title=\"child.label\"\n                            >\n                              <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                                <span\n                                  class=\"pv-truncate pv-flex-item\"\n                                  :class=\"{ 'pv-link-external': child.external }\"\n                                  >{{ child.label }}</span\n                                >\n                                <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                                  child.badge.toUpperCase()\n                                }}</span>\n                              </span>\n                              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n                            </a>\n                          </template>\n                          <template #content>\n                            <PvSidebarV2NavFlyout :items=\"child.children\" :disabled=\"isCollapsed\" />\n                          </template>\n                        </PvPopoverV2>\n                        <a\n                          v-else\n                          :href=\"child.url\"\n                          v-bind=\"child.linkAttrs\"\n                          :aria-current=\"child.active ? 'page' : undefined\"\n                          :title=\"child.label\"\n                        >\n                          <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                            <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': child.external }\">{{\n                              child.label\n                            }}</span>\n                            <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                              child.badge.toUpperCase()\n                            }}</span>\n                          </span>\n                        </a>\n                      </template>\n                    </div>\n                  </PvAccordion>\n                </template>\n                <template #content>\n                  <PvSidebarV2NavFlyout :items=\"item.children\" :disabled=\"!isCollapsed\" />\n                </template>\n              </PvPopoverV2>\n            </li>\n          </template>\n        </ul>\n        <div class=\"pv-sidebar-nav-footer pv-sticky\" style=\"--bottom: 0\">\n          <PvPopoverV2\n            v-if=\"hasHelpContent\"\n            v-model=\"helpPopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :show-on-hover=\"isCollapsed\"\n            enable-group-sync\n            enable-click-toggle\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                aria-label=\"Help\"\n                :aria-expanded=\"helpPopoverOpen\"\n                title=\"Help\"\n              >\n                <PvIcon name=\"help-circle\" class=\"pv-icon-20 pv-nav-icon\" />\n                <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">Help</span>\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\">\n                <slot name=\"sidebar-help-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n\n          <PvPopoverV2\n            v-if=\"hasProfileContent && profile\"\n            v-model=\"profilePopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                data-testid=\"pv-sidebar-profile-trigger\"\n                :aria-label=\"profile.name\"\n                :aria-expanded=\"profilePopoverOpen\"\n                :title=\"profile.name\"\n              >\n                <span class=\"pv-avatar-xs\" style=\"border-radius: 50%; flex-shrink: 0\">\n                  <img v-if=\"profile.avatarUrl\" :src=\"profile.avatarUrl\" alt=\"\" />\n                  <span v-else>{{ profile.name.slice(0, 1) }}</span>\n                </span>\n                <span\n                  class=\"pv-truncate\"\n                  data-sidebar-expanded-content\n                  :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                  >{{ profile.name }}</span\n                >\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\" style=\"--height: 750px\">\n                <slot name=\"sidebar-profile-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n        </div>\n      </div>\n    </div>\n    <div class=\"content-panel\">\n      <slot />\n    </div>\n    <div\n      ref=\"popoverTeleportTarget\"\n      class=\"pv-sidebar-popover-portal\"\n      :class=\"variant && `pv-sidebar-surface-${variant}`\"\n    ></div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n  computed,\n  getCurrentInstance,\n  nextTick,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  useSlots,\n  watch,\n  type ComponentPublicInstance,\n  type CSSProperties,\n} from \"vue\";\nimport { useElementBounding } from \"@vueuse/core\";\n\nimport PvAccordion from \"../PvAccordion/PvAccordion.vue\";\nimport PvButton from \"../PvButton/PvButton.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport PvPopoverV2 from \"../PvPopoverV2/PvPopoverV2.vue\";\nimport PvTooltipV2 from \"../PvTooltipV2/PvTooltipV2.vue\";\nimport PvSidebarV2NavFlyout from \"./PvSidebarV2NavFlyout.vue\";\nimport { isNavItemActive } from \"./helpers.ts\";\nimport { hasHostSlotContent, useSlotPresence } from \"@/composables/useSlotPresence.ts\";\nimport type { PvSidebarNavItem, PvSidebarOrgEntity, PvSidebarV2Props } from \"./types.ts\";\n\nconst props = defineProps<PvSidebarV2Props>();\n\nconst instance = getCurrentInstance();\nconst customElementHost =\n  typeof HTMLElement !== \"undefined\" && instance && \"ce\" in instance && instance.ce instanceof HTMLElement\n    ? instance.ce\n    : undefined;\nconst { present: hasAdditionalContent } = useSlotPresence(\"sidebar-additional-content\", {\n  host: customElementHost,\n});\nconst { present: hasAdditionalHeader } = useSlotPresence(\"sidebar-additional-header\", {\n  host: customElementHost,\n});\nconst { present: hasHelpContent } = useSlotPresence(\"sidebar-help-content\", { host: customElementHost });\nconst { present: hasProfileContent } = useSlotPresence(\"sidebar-profile-content\", { host: customElementHost });\nconst slots = useSlots();\nconst popoverTeleportTarget = ref<HTMLElement | null>(null);\nconst sidebarPanel = ref<HTMLElement | null>(null);\nconst hoverPanelOpen = ref<Record<string | number, boolean>>({});\nconst hoverPanelFocusRestore = ref<string | number>();\nconst hoverPanelSurfaces = new Map<string | number, HTMLElement>();\nconst hoverPanelTriggers = new Map<string | number, HTMLElement>();\nconst nativeSlotRevision = ref(0);\nconst sidebarBounds = useElementBounding(sidebarPanel);\nconst hoverPanelPositionStyles = computed<CSSProperties>(() => ({\n  \"--pv-sidebar-hover-panel-height\": `${sidebarBounds.height.value}px`,\n  \"--pv-sidebar-hover-panel-left\": `${sidebarBounds.right.value}px`,\n  \"--pv-sidebar-hover-panel-top\": `${sidebarBounds.top.value}px`,\n}));\n\nlet nativeSlotObserver: MutationObserver | undefined;\n\nconst hasHoverPanelSlot = (item: PvSidebarNavItem) => {\n  if (!item.hoverPanelSlot) return false;\n  if (!customElementHost) return Boolean(slots[item.hoverPanelSlot]);\n\n  void nativeSlotRevision.value;\n  return hasHostSlotContent(customElementHost, item.hoverPanelSlot);\n};\n\nconst setHoverPanelElement = (\n  elements: Map<string | number, HTMLElement>,\n  value: string | number,\n  element: Element | ComponentPublicInstance | null,\n) => {\n  if (element instanceof HTMLElement) elements.set(value, element);\n  else elements.delete(value);\n};\n\nconst focusableSelector =\n  'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nconst findFirstPanelControl = (value: string | number) => {\n  const surface = hoverPanelSurfaces.get(value);\n  const control = surface?.querySelector<HTMLElement>(focusableSelector);\n  if (control) return control;\n\n  for (const slot of surface?.querySelectorAll(\"slot\") ?? []) {\n    for (const element of slot.assignedElements({ flatten: true })) {\n      if (element.matches(focusableSelector)) return element as HTMLElement;\n      const slottedControl = element.querySelector<HTMLElement>(focusableSelector);\n      if (slottedControl) return slottedControl;\n    }\n  }\n};\n\nconst handleHoverPanelTab = (event: KeyboardEvent, value: string | number) => {\n  if (event.shiftKey) return;\n  const control = findFirstPanelControl(value);\n  if (!control) return;\n  event.preventDefault();\n  hoverPanelOpen.value[value] = true;\n  nextTick(() => control.focus());\n};\n\nconst closeHoverPanel = (value: string | number) => {\n  hoverPanelFocusRestore.value = value;\n  hoverPanelOpen.value[value] = false;\n  nextTick(() => {\n    hoverPanelTriggers.get(value)?.focus({ preventScroll: true });\n    nextTick(() => (hoverPanelFocusRestore.value = undefined));\n  });\n};\n\nconst handleHoverPanelClick = (event: MouseEvent, value: string | number) => {\n  if (\n    event\n      .composedPath()\n      .some((target) => target instanceof Element && target.hasAttribute(\"data-sidebar-nav-panel-close\"))\n  ) {\n    closeHoverPanel(value);\n  }\n};\n\nconst handleHoverPanelKeydown = (event: KeyboardEvent, value: string | number) => {\n  if (event.key !== \"Escape\") return;\n  event.preventDefault();\n  event.stopPropagation();\n  closeHoverPanel(value);\n};\n\nonMounted(() => {\n  if (!customElementHost) return;\n  nativeSlotObserver = new MutationObserver((mutations) => {\n    if (\n      mutations.some(\n        (mutation) =>\n          mutation.target === customElementHost ||\n          (mutation.type === \"attributes\" && mutation.target.parentNode === customElementHost),\n      )\n    ) {\n      nativeSlotRevision.value += 1;\n    }\n  });\n  nativeSlotObserver.observe(customElementHost, {\n    attributes: true,\n    attributeFilter: [\"slot\"],\n    childList: true,\n    subtree: true,\n  });\n});\n\nonBeforeUnmount(() => nativeSlotObserver?.disconnect());\n\nconst findActiveEntity = (entities: PvSidebarOrgEntity[]): PvSidebarOrgEntity | undefined => {\n  for (const entity of entities) {\n    if (entity.active) return entity;\n    const activeChild = entity.entities && findActiveEntity(entity.entities);\n    if (activeChild) return activeChild;\n  }\n  return undefined;\n};\n\nconst activeOrganization = computed(\n  () => (props.organizations && findActiveEntity(props.organizations)) ?? props.organizations?.[0],\n);\n\nconst initialOpenNavItems = (): Record<string | number, boolean> => {\n  const open: Record<string | number, boolean> = {};\n  props.navItems?.forEach((item) => {\n    if (isNavItemActive(item)) open[item.value] = true;\n  });\n  return open;\n};\n\nconst openNavItems = ref<Record<string | number, boolean>>(initialOpenNavItems());\n\n// Re-syncs whenever navItems changes (e.g. a client-side route change recomputes\n// `active` on the consumer's side), not just once at mount — merges in newly-active\n// items without forcing already-open/closed items the user has manually toggled.\nwatch(\n  () => props.navItems,\n  (items) => {\n    items?.forEach((item) => {\n      if (isNavItemActive(item)) {\n        openNavItems.value[item.value] = true;\n      }\n    });\n  },\n);\n\nconst isCollapsed = defineModel<boolean>({ default: false });\nconst isTransitioning = ref(false);\nconst isExpanding = computed(() => !isCollapsed.value && isTransitioning.value);\n\nconst emit = defineEmits<{\n  (e: \"change\", payload: { collapsed: boolean }): void;\n}>();\n\nconst helpPopoverOpen = ref(false);\nconst organizationPopoverOpen = ref(false);\nconst profilePopoverOpen = ref(false);\nconst nestedNavPopoverOpen = ref<Record<string | number, boolean>>({});\n\nconst closeSidebarPopovers = () => {\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  nestedNavPopoverOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n};\n\nwatch(helpPopoverOpen, (open) => {\n  if (!open) return;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n  profilePopoverOpen.value = false;\n});\nwatch(organizationPopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  profilePopoverOpen.value = false;\n});\nwatch(profilePopoverOpen, (open) => {\n  if (!open) return;\n  helpPopoverOpen.value = false;\n  hoverPanelOpen.value = {};\n  organizationPopoverOpen.value = false;\n});\nwatch(isCollapsed, () => {\n  closeSidebarPopovers();\n  isTransitioning.value = true;\n});\n\nconst toggle = () => {\n  isCollapsed.value = !isCollapsed.value;\n  emit(\"change\", { collapsed: isCollapsed.value });\n};\n\nconst handleTransitionEnd = (event: TransitionEvent) => {\n  if (event.target === event.currentTarget && event.propertyName === \"grid-template-columns\") {\n    isTransitioning.value = false;\n  }\n};\n\nconst hasActiveChildren = (children: PvSidebarNavItem[]) => {\n  return children.some(isNavItemActive);\n};\n\n// This trigger renders inside PvAccordion's native <summary>, which can't contain\n// a real <a> (invalid nesting of interactive content), so modifier-clicks have to\n// be replicated manually to keep new-tab/new-window behavior working for mouse users.\nconst handleRedirect = (event: MouseEvent, child: PvSidebarNavItem) => {\n  if (!child.url) return;\n  if (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1) {\n    window.open(child.url, \"_blank\", \"noopener\");\n    return;\n  }\n  window.location.href = child.url;\n};\n</script>\n\n<template>\n  <div\n    class=\"sidebar-layout sidebar-layout-new\"\n    :class=\"[\n      variant && `sidebar-layout-${variant}`,\n      {\n        'is-collapsed': isCollapsed,\n        'is-expanded': !isCollapsed,\n        'is-transitioning': isTransitioning,\n      },\n    ]\"\n    :style=\"hoverPanelPositionStyles\"\n    @transitionend=\"handleTransitionEnd\"\n  >\n    <div ref=\"sidebarPanel\" class=\"sidebar-panel\">\n      <div>\n        <div v-if=\"hasAdditionalHeader\" class=\"sidebar-additional-header\">\n          <slot name=\"sidebar-additional-header\" />\n        </div>\n        <div\n          class=\"sidebar-header\"\n          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n          :class=\"[{ 'pv-border-bottom': isCollapsed }]\"\n        >\n          <div class=\"sidebar-header-content pv-full-width\">\n            <div\n              v-if=\"organizations && organizations.length\"\n              class=\"pv-sidebar-nav-header\"\n              :class=\"variant && `pv-sidebar-surface-${variant}`\"\n            >\n              <PvPopoverV2\n                v-model=\"organizationPopoverOpen\"\n                :position=\"isCollapsed ? 'right-top' : 'bottom-left'\"\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvTooltipV2\n                    :description=\"activeOrganization?.label\"\n                    :disabled=\"!isCollapsed || isTransitioning || organizationPopoverOpen\"\n                    variant=\"white\"\n                    position=\"center-right\"\n                    :delay=\"250\"\n                    :offset=\"4\"\n                    enable-group-sync\n                    :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                    :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                    :css-custom-properties=\"{ width: '100%' }\"\n                  >\n                    <template #trigger>\n                      <button\n                        type=\"button\"\n                        class=\"pv-nav-list-item pv-full-width pv-space-between\"\n                        :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                        data-testid=\"pv-sidebar-org-switcher\"\n                        :aria-label=\"`Switch organization: ${activeOrganization?.label}`\"\n                        :aria-expanded=\"organizationPopoverOpen\"\n                      >\n                        <div class=\"pv-flex\" style=\"min-width: 0\">\n                          <span class=\"pv-avatar-xs\" style=\"border-radius: 4px; flex-shrink: 0\">\n                            <img\n                              v-if=\"activeOrganization?.avatarUrl\"\n                              :src=\"activeOrganization.avatarUrl\"\n                              alt=\"Organization Avatar\"\n                            />\n                            <span v-else>{{ activeOrganization?.label?.slice(0, 1) }}</span>\n                          </span>\n                          <span\n                            class=\"pv-text-title-lg pv-truncate\"\n                            data-sidebar-expanded-content\n                            :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                            :data-sidebar-expanding=\"isExpanding || undefined\"\n                            :title=\"activeOrganization?.label\"\n                            >{{ activeOrganization?.label }}</span\n                          >\n                        </div>\n                        <PvIcon\n                          name=\"chevron-down\"\n                          class=\"pv-icon-16\"\n                          data-sidebar-expanded-content\n                          :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                          :data-sidebar-expanding=\"isExpanding || undefined\"\n                        />\n                      </button>\n                    </template>\n                  </PvTooltipV2>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"width: fit-content; max-width: 280px; margin-top: 4px\">\n                    <ul\n                      role=\"list\"\n                      class=\"pv-popover-list pv-flow\"\n                      style=\"--flow-size: 0.25rem\"\n                      data-testid=\"pv-sidebar-org-list\"\n                    >\n                      <template v-for=\"organization in organizations\" :key=\"organization.value\">\n                        <li :data-active=\"organization.active || undefined\">\n                          <a\n                            class=\"pv-flex\"\n                            :href=\"organization.url\"\n                            data-testid=\"pv-sidebar-org-option\"\n                            :data-org-value=\"organization.value\"\n                          >\n                            <div class=\"pv-avatar-xs\" style=\"border-radius: 4px\">\n                              <img\n                                v-if=\"organization.avatarUrl\"\n                                :src=\"organization.avatarUrl\"\n                                alt=\"Organization Avatar\"\n                              />\n                              <span v-else>{{ organization.label.slice(0, 1) }}</span>\n                            </div>\n                            <span class=\"pv-truncate pv-flex-item\" :title=\"organization.label\">{{\n                              organization.label\n                            }}</span>\n                          </a>\n                        </li>\n                        <li\n                          v-for=\"entity in organization.entities\"\n                          :key=\"entity.value\"\n                          style=\"padding-left: 0.5rem\"\n                          :data-active=\"entity.active || undefined\"\n                        >\n                          <a\n                            class=\"pv-flex pv-truncate\"\n                            :href=\"entity.url\"\n                            style=\"max-width: 100%\"\n                            data-testid=\"pv-sidebar-org-entity\"\n                            :data-org-value=\"entity.value\"\n                          >\n                            <PvIcon name=\"corner-down-right\" />\n                            <span class=\"pv-truncate\" :title=\"entity.label\">{{ entity.label }}</span>\n                          </a>\n                        </li>\n                      </template>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n            </div>\n          </div>\n          <PvTooltipV2 v-if=\"!disableToggle\" variant=\"white\" position=\"center-right\" :delay=\"1000\">\n            <template #trigger>\n              <PvButton\n                class=\"sidebar-toggle\"\n                :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                :data-sidebar-expanding=\"isExpanding || undefined\"\n                :left-icon=\"isCollapsed ? 'panel-left-open' : 'panel-left-close'\"\n                :aria-label=\"isCollapsed ? 'Open sidebar' : 'Close sidebar'\"\n                variant=\"ghost\"\n                @click=\"toggle\"\n              />\n            </template>\n            <template #content> {{ isCollapsed ? \"Expand navigation\" : \"Collapse navigation\" }} </template>\n          </PvTooltipV2>\n        </div>\n      </div>\n      <div class=\"pv-sidebar-nav\" :class=\"variant && `pv-sidebar-surface-${variant}`\">\n        <div v-if=\"hasAdditionalContent\">\n          <slot name=\"sidebar-additional-content\" />\n        </div>\n        <ul v-if=\"navItems && navItems.length\" role=\"list\" class=\"pv-full-width pv-flow\" style=\"--flow-size: 0.25rem\">\n          <template v-for=\"item in navItems\" :key=\"item.value\">\n            <li v-if=\"item.separatorAtTop\" class=\"pv-sidebar-nav-separator\" aria-hidden=\"true\"></li>\n            <li>\n              <!-- Slotted full-height panel - available while collapsed or expanded -->\n              <PvPopoverV2\n                v-if=\"hasHoverPanelSlot(item)\"\n                v-model=\"hoverPanelOpen[item.value]\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"hoverPanelFocusRestore === item.value\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <component\n                    :is=\"item.url ? 'a' : 'button'\"\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelTriggers, item.value, element)\n                    \"\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    :type=\"item.url ? undefined : 'button'\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :aria-expanded=\"Boolean(hoverPanelOpen[item.value])\"\n                    :aria-label=\"isCollapsed ? item.label : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                    @keydown.tab=\"handleHoverPanelTab($event, item.value)\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </component>\n                </template>\n                <template #content>\n                  <div\n                    :ref=\"\n                      (element: Element | ComponentPublicInstance | null) =>\n                        setHoverPanelElement(hoverPanelSurfaces, item.value, element)\n                    \"\n                    class=\"pv-sidebar-hover-panel\"\n                    @click=\"handleHoverPanelClick($event, item.value)\"\n                    @keydown=\"handleHoverPanelKeydown($event, item.value)\"\n                  >\n                    <slot :name=\"item.hoverPanelSlot\" />\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Leaf item - direct link with a collapsed interactive flyout -->\n              <PvPopoverV2\n                v-else-if=\"!item.children || item.children.length === 0\"\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <a\n                    class=\"pv-nav-list-item\"\n                    :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                    :href=\"item.url\"\n                    v-bind=\"item.linkAttrs\"\n                    :aria-current=\"item.active ? 'page' : undefined\"\n                    :title=\"isCollapsed ? undefined : item.label\"\n                  >\n                    <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                    <span\n                      class=\"pv-flex pv-space-between pv-full-width\"\n                      data-sidebar-expanded-content\n                      :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                      style=\"flex-wrap: wrap\"\n                    >\n                      <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                        item.label\n                      }}</span>\n                      <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                    </span>\n                  </a>\n                </template>\n                <template #content>\n                  <div class=\"pv-popover\" style=\"--position: static\">\n                    <ul role=\"list\" class=\"pv-popover-list\">\n                      <li :data-active=\"item.active || undefined\">\n                        <a :href=\"item.url\" v-bind=\"item.linkAttrs\" style=\"flex-wrap: wrap\">\n                          <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': item.external }\">{{\n                            item.label\n                          }}</span>\n                          <span v-if=\"item.badge\" class=\"pv-tag-purple pv-tag-sm\">{{ item.badge.toUpperCase() }}</span>\n                        </a>\n                      </li>\n                    </ul>\n                  </div>\n                </template>\n              </PvPopoverV2>\n\n              <!-- Child items - accordion with a collapsed hover flyout -->\n              <PvPopoverV2\n                v-else\n                show-on-hover\n                enable-group-sync\n                enable-click-toggle\n                :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                position=\"right-top\"\n                :disabled=\"!isCollapsed\"\n                :css-custom-properties=\"{ width: '100%' }\"\n              >\n                <template #trigger>\n                  <PvAccordion\n                    v-model=\"openNavItems[item.value]\"\n                    :default-open=\"isNavItemActive(item)\"\n                    :summary-attrs=\"{\n                      class: isCollapsed ? 'pv-sidebar-item-collapsed' : undefined,\n                      'aria-current': hasActiveChildren(item.children) && isCollapsed ? 'page' : undefined,\n                    }\"\n                    enable-trigger-slot\n                    enable-trigger-full-width\n                  >\n                    <template #trigger>\n                      <div\n                        class=\"pv-flex\"\n                        @click=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                        @auxclick=\"item.children.length === 1 && handleRedirect($event, item.children[0])\"\n                      >\n                        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" class=\"pv-nav-icon\" />\n                        <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">{{\n                          item.label\n                        }}</span>\n                      </div>\n                    </template>\n                    <div class=\"pv-sidebar-nav-nested\" :data-sidebar-collapsed=\"isCollapsed || undefined\">\n                      <template v-for=\"child in item.children\" :key=\"child.value\">\n                        <!-- Nested items - expanded-only flyout on the right; the collapsed flyout handles its own -->\n                        <PvPopoverV2\n                          v-if=\"child.children?.length\"\n                          v-model=\"nestedNavPopoverOpen[child.value]\"\n                          show-on-hover\n                          enable-group-sync\n                          enable-click-toggle\n                          :use-teleport=\"Boolean(popoverTeleportTarget)\"\n                          :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n                          position=\"right-top\"\n                          :offset=\"8\"\n                          :disabled=\"isCollapsed\"\n                          :css-custom-properties=\"{ width: '100%' }\"\n                        >\n                          <template #trigger>\n                            <a\n                              :href=\"child.url\"\n                              v-bind=\"child.linkAttrs\"\n                              :role=\"child.url ? undefined : 'button'\"\n                              :tabindex=\"child.url ? undefined : 0\"\n                              :aria-current=\"isNavItemActive(child) ? 'page' : undefined\"\n                              aria-haspopup=\"true\"\n                              :aria-expanded=\"Boolean(nestedNavPopoverOpen[child.value])\"\n                              :title=\"child.label\"\n                            >\n                              <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                                <span\n                                  class=\"pv-truncate pv-flex-item\"\n                                  :class=\"{ 'pv-link-external': child.external }\"\n                                  >{{ child.label }}</span\n                                >\n                                <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                                  child.badge.toUpperCase()\n                                }}</span>\n                              </span>\n                              <PvIcon name=\"chevron-right\" class=\"pv-icon-16\" />\n                            </a>\n                          </template>\n                          <template #content>\n                            <PvSidebarV2NavFlyout :items=\"child.children\" :disabled=\"isCollapsed\" />\n                          </template>\n                        </PvPopoverV2>\n                        <a\n                          v-else\n                          :href=\"child.url\"\n                          v-bind=\"child.linkAttrs\"\n                          :aria-current=\"child.active ? 'page' : undefined\"\n                          :title=\"child.label\"\n                        >\n                          <span class=\"pv-flex pv-space-between pv-full-width\" style=\"flex-wrap: wrap\">\n                            <span class=\"pv-truncate pv-flex-item\" :class=\"{ 'pv-link-external': child.external }\">{{\n                              child.label\n                            }}</span>\n                            <span v-if=\"child.badge\" class=\"pv-tag-purple pv-tag-sm\">{{\n                              child.badge.toUpperCase()\n                            }}</span>\n                          </span>\n                        </a>\n                      </template>\n                    </div>\n                  </PvAccordion>\n                </template>\n                <template #content>\n                  <PvSidebarV2NavFlyout :items=\"item.children\" :disabled=\"!isCollapsed\" />\n                </template>\n              </PvPopoverV2>\n            </li>\n          </template>\n        </ul>\n        <div class=\"pv-sidebar-nav-footer pv-sticky\" style=\"--bottom: 0\">\n          <PvPopoverV2\n            v-if=\"hasHelpContent\"\n            v-model=\"helpPopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :show-on-hover=\"isCollapsed\"\n            enable-group-sync\n            enable-click-toggle\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                aria-label=\"Help\"\n                :aria-expanded=\"helpPopoverOpen\"\n                title=\"Help\"\n              >\n                <PvIcon name=\"help-circle\" class=\"pv-icon-20 pv-nav-icon\" />\n                <span data-sidebar-expanded-content :data-sidebar-collapsed=\"isCollapsed || undefined\">Help</span>\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\">\n                <slot name=\"sidebar-help-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n\n          <PvPopoverV2\n            v-if=\"hasProfileContent && profile\"\n            v-model=\"profilePopoverOpen\"\n            :position=\"isCollapsed ? 'right-bottom' : 'top-left'\"\n            :use-teleport=\"Boolean(popoverTeleportTarget)\"\n            :teleport-location=\"popoverTeleportTarget ?? 'body'\"\n            :offset=\"4\"\n            :css-custom-properties=\"{ width: '100%' }\"\n          >\n            <template #trigger>\n              <button\n                type=\"button\"\n                class=\"pv-nav-list-item\"\n                :class=\"{ 'pv-sidebar-item-collapsed': isCollapsed }\"\n                data-testid=\"pv-sidebar-profile-trigger\"\n                :aria-label=\"profile.name\"\n                :aria-expanded=\"profilePopoverOpen\"\n                :title=\"profile.name\"\n              >\n                <span class=\"pv-avatar-xs\" style=\"border-radius: 50%; flex-shrink: 0\">\n                  <img v-if=\"profile.avatarUrl\" :src=\"profile.avatarUrl\" alt=\"\" />\n                  <span v-else>{{ profile.name.slice(0, 1) }}</span>\n                </span>\n                <span\n                  class=\"pv-truncate\"\n                  data-sidebar-expanded-content\n                  :data-sidebar-collapsed=\"isCollapsed || undefined\"\n                  >{{ profile.name }}</span\n                >\n              </button>\n            </template>\n            <template #content>\n              <div class=\"pv-popover pv-text-default pv-text-body-md\" style=\"--height: 750px\">\n                <slot name=\"sidebar-profile-content\" />\n              </div>\n            </template>\n          </PvPopoverV2>\n        </div>\n      </div>\n    </div>\n    <div class=\"content-panel\">\n      <slot />\n    </div>\n    <div\n      ref=\"popoverTeleportTarget\"\n      class=\"pv-sidebar-popover-portal\"\n      :class=\"variant && `pv-sidebar-surface-${variant}`\"\n    ></div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvTableOfContentsItem } from \"./types\";\n\ninterface PvTableOfContentsProps {\n  /** Items to display in the table of contents */\n  items: PvTableOfContentsItem[];\n}\n\ndefineProps<PvTableOfContentsProps>();\n\nconst modelValue = defineModel<string>({ required: false });\nconst emit = defineEmits<{\n  (e: \"handle-select\", item: PvTableOfContentsItem): void;\n}>();\n\nconst handleSelect = (event: MouseEvent, item: PvTableOfContentsItem) => {\n  if (!item.href) {\n    event.preventDefault();\n  }\n  modelValue.value = item.id;\n  emit(\"handle-select\", item);\n};\n</script>\n\n<template>\n  <ul class=\"pv-toc\" role=\"list\" style=\"min-width: 160px\">\n    <li v-for=\"item in items\" :key=\"item.id\" :aria-current=\"modelValue === item.id ? 'true' : undefined\">\n      <a :href=\"item.href ?? '#'\" @click=\"handleSelect($event, item)\">\n        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" />\n        {{ item.label }}\n      </a>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport type { PvTableOfContentsItem } from \"./types\";\n\ninterface PvTableOfContentsProps {\n  /** Items to display in the table of contents */\n  items: PvTableOfContentsItem[];\n}\n\ndefineProps<PvTableOfContentsProps>();\n\nconst modelValue = defineModel<string>({ required: false });\nconst emit = defineEmits<{\n  (e: \"handle-select\", item: PvTableOfContentsItem): void;\n}>();\n\nconst handleSelect = (event: MouseEvent, item: PvTableOfContentsItem) => {\n  if (!item.href) {\n    event.preventDefault();\n  }\n  modelValue.value = item.id;\n  emit(\"handle-select\", item);\n};\n</script>\n\n<template>\n  <ul class=\"pv-toc\" role=\"list\" style=\"min-width: 160px\">\n    <li v-for=\"item in items\" :key=\"item.id\" :aria-current=\"modelValue === item.id ? 'true' : undefined\">\n      <a :href=\"item.href ?? '#'\" @click=\"handleSelect($event, item)\">\n        <PvIcon v-if=\"item.icon\" :name=\"item.icon\" />\n        {{ item.label }}\n      </a>\n    </li>\n  </ul>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { PvStepperItem, StepperProps } from \"./types.ts\";\n\ndefineEmits<{\n  (e: \"update:active\", index: number): void;\n}>();\n\nconst props = withDefaults(defineProps<StepperProps>(), {\n  variant: \"dots\",\n  count: 5,\n  active: 0,\n  clickable: false,\n  showCounter: true,\n});\n\nconst stepCount = computed(() =>\n  props.variant === \"buttons\" || props.variant === \"progress\" ? (props.items?.length ?? 0) : props.count,\n);\n\nconst counterBadgeStyle = (active: boolean) => {\n  if (active) {\n    return {\n      \"--color-background-brand-inverse\": \"#073A46\",\n    };\n  }\n\n  return {\n    \"--color-text-tertiary\": \"#4A4641\",\n    \"--color-text-secondary-lighten-5\": \"#E2DDD6\",\n  };\n};\n\nif (props.active < 0 || props.active >= stepCount.value) {\n  console.warn(`PvStepper: \"active\" (${props.active}) is out of range for the number of steps (${stepCount.value}).`);\n}\n\nconst wrapperStyle = computed(() => {\n  if (props.variant === \"buttons\") {\n    return {\n      \"--flex-gap\": \"0.25rem\",\n    };\n  }\n\n  return {\n    \"--flex-gap\": \"0.5rem\",\n  };\n});\n\nconst STEPPER_VARIANT_CLASSES_MAP: Record<NonNullable<PvStepperItem[\"variant\"]>, { icon: string; text: string }> = {\n  current: {\n    icon: \"pv-text-brand\",\n    text: \"pv-text-brand\",\n  },\n  success: {\n    icon: \"pv-text-success\",\n    text: \"pv-text-success\",\n  },\n  next: {\n    icon: \"pv-text-quaternary\",\n    text: \"pv-text-quaternary\",\n  },\n  error: {\n    icon: \"pv-text-critical\",\n    text: \"pv-text-brand\",\n  },\n};\n\nconst STEPPER_VARIANT_ICONS: Record<NonNullable<PvStepperItem[\"variant\"]>, string> = {\n  current: \"circle-dot\",\n  success: \"check-circle\",\n  next: \"circle\",\n  error: \"alert-circle\",\n};\n\nconst STEPPER_DIVIDER_CLASSES: Record<NonNullable<PvStepperItem[\"variant\"]>, string> = {\n  current: \"pv-stepper-progress-divider-default\",\n  success: \"pv-stepper-progress-divider-success\",\n  next: \"pv-stepper-progress-divider-default\",\n  error: \"pv-stepper-progress-divider-default\",\n};\n\n/**\n * Remove this Tokens when we move to new theme\n */\nconst NEW_V3_TOKENS_PROGRESS = {\n  \"--color-text-success\": \"#59762E\",\n  \"--color-text-brand\": \"#073A46\",\n  \"--color-text-red\": \"#E85E33\",\n  \"--color-text-quaternary\": \"#928C84\",\n  \"--stepper-progress-divider-success-color\": \"#59762E\",\n  \"--stepper-progress-divider-color\": \"#E7E2D9\",\n};\n\nconst NEW_V3_TOKENS_BUTTONS = {\n  \"--stepper-button-active-background-color\": \"#F3F1EB\",\n  \"--stepper-button-active-text-color\": \"#121313\",\n  \"--stepper-button-inactive-text-color\": \"#6E6962\",\n  \"--stepper-button-inactive-background-color\": \"#ECE8E2\",\n  \"--stepper-button-inactive-active-background-color\": \"#D8D2CA\",\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\" :style=\"wrapperStyle\">\n    <template v-if=\"variant === 'buttons'\">\n      <button\n        v-for=\"(item, index) in items\"\n        :key=\"index\"\n        type=\"button\"\n        class=\"pv-stepper-button pv-flex\"\n        :class=\"index === active ? 'pv-stepper-button-active' : 'pv-stepper-button-inactive'\"\n        :style=\"{ ...counterBadgeStyle(index === active), ...NEW_V3_TOKENS_BUTTONS }\"\n        :data-clickable=\"clickable\"\n        @click=\"clickable && $emit('update:active', index)\"\n      >\n        <PvCounterBadge\n          v-if=\"showCounter\"\n          :variant=\"index === active ? 'primary' : 'tertiary'\"\n          :value=\"index + 1\"\n          rounded\n        />\n        <span>\n          {{ item.label }}\n        </span>\n      </button>\n    </template>\n    <template v-else-if=\"variant === 'dots'\">\n      <div\n        v-for=\"(_, index) in count\"\n        :key=\"index\"\n        :data-clickable=\"clickable\"\n        :class=\"index === active ? 'pv-stepper-active' : 'pv-stepper-inactive'\"\n        @click=\"clickable && $emit('update:active', index)\"\n      ></div>\n    </template>\n    <template v-else>\n      <template v-for=\"(item, index) in items\" :key=\"index\">\n        <div\n          class=\"pv-flex pv-full-width\"\n          :class=\"[\n            {\n              'pv-flex-item': index === stepCount - 1,\n            },\n          ]\"\n          style=\"--flex-gap: 0.25rem\"\n        >\n          <div\n            class=\"pv-flex\"\n            :data-clickable=\"clickable\"\n            @click=\"clickable && $emit('update:active', index)\"\n            :style=\"{ ...NEW_V3_TOKENS_PROGRESS, '--flex-gap': '0.25rem' }\"\n          >\n            <PvIcon\n              :name=\"STEPPER_VARIANT_ICONS[item.variant ?? 'current']\"\n              :class=\"STEPPER_VARIANT_CLASSES_MAP[item.variant ?? 'current'].icon\"\n            />\n            <span class=\"pv-text-body-md\" :class=\"STEPPER_VARIANT_CLASSES_MAP[item.variant ?? 'current'].text\">{{\n              item.label\n            }}</span>\n          </div>\n          <div\n            v-if=\"index < stepCount - 1\"\n            class=\"pv-stepper-progress-divider\"\n            :class=\"STEPPER_DIVIDER_CLASSES[item.variant ?? 'current']\"\n          ></div>\n        </div>\n      </template>\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport PvCounterBadge from \"../PvCounterBadge/PvCounterBadge.vue\";\nimport PvIcon from \"../PvIcon/PvIcon.vue\";\nimport { PvStepperItem, StepperProps } from \"./types.ts\";\n\ndefineEmits<{\n  (e: \"update:active\", index: number): void;\n}>();\n\nconst props = withDefaults(defineProps<StepperProps>(), {\n  variant: \"dots\",\n  count: 5,\n  active: 0,\n  clickable: false,\n  showCounter: true,\n});\n\nconst stepCount = computed(() =>\n  props.variant === \"buttons\" || props.variant === \"progress\" ? (props.items?.length ?? 0) : props.count,\n);\n\nconst counterBadgeStyle = (active: boolean) => {\n  if (active) {\n    return {\n      \"--color-background-brand-inverse\": \"#073A46\",\n    };\n  }\n\n  return {\n    \"--color-text-tertiary\": \"#4A4641\",\n    \"--color-text-secondary-lighten-5\": \"#E2DDD6\",\n  };\n};\n\nif (props.active < 0 || props.active >= stepCount.value) {\n  console.warn(`PvStepper: \"active\" (${props.active}) is out of range for the number of steps (${stepCount.value}).`);\n}\n\nconst wrapperStyle = computed(() => {\n  if (props.variant === \"buttons\") {\n    return {\n      \"--flex-gap\": \"0.25rem\",\n    };\n  }\n\n  return {\n    \"--flex-gap\": \"0.5rem\",\n  };\n});\n\nconst STEPPER_VARIANT_CLASSES_MAP: Record<NonNullable<PvStepperItem[\"variant\"]>, { icon: string; text: string }> = {\n  current: {\n    icon: \"pv-text-brand\",\n    text: \"pv-text-brand\",\n  },\n  success: {\n    icon: \"pv-text-success\",\n    text: \"pv-text-success\",\n  },\n  next: {\n    icon: \"pv-text-quaternary\",\n    text: \"pv-text-quaternary\",\n  },\n  error: {\n    icon: \"pv-text-critical\",\n    text: \"pv-text-brand\",\n  },\n};\n\nconst STEPPER_VARIANT_ICONS: Record<NonNullable<PvStepperItem[\"variant\"]>, string> = {\n  current: \"circle-dot\",\n  success: \"check-circle\",\n  next: \"circle\",\n  error: \"alert-circle\",\n};\n\nconst STEPPER_DIVIDER_CLASSES: Record<NonNullable<PvStepperItem[\"variant\"]>, string> = {\n  current: \"pv-stepper-progress-divider-default\",\n  success: \"pv-stepper-progress-divider-success\",\n  next: \"pv-stepper-progress-divider-default\",\n  error: \"pv-stepper-progress-divider-default\",\n};\n\n/**\n * Remove this Tokens when we move to new theme\n */\nconst NEW_V3_TOKENS_PROGRESS = {\n  \"--color-text-success\": \"#59762E\",\n  \"--color-text-brand\": \"#073A46\",\n  \"--color-text-red\": \"#E85E33\",\n  \"--color-text-quaternary\": \"#928C84\",\n  \"--stepper-progress-divider-success-color\": \"#59762E\",\n  \"--stepper-progress-divider-color\": \"#E7E2D9\",\n};\n\nconst NEW_V3_TOKENS_BUTTONS = {\n  \"--stepper-button-active-background-color\": \"#F3F1EB\",\n  \"--stepper-button-active-text-color\": \"#121313\",\n  \"--stepper-button-inactive-text-color\": \"#6E6962\",\n  \"--stepper-button-inactive-background-color\": \"#ECE8E2\",\n  \"--stepper-button-inactive-active-background-color\": \"#D8D2CA\",\n};\n</script>\n\n<template>\n  <div class=\"pv-flex\" :style=\"wrapperStyle\">\n    <template v-if=\"variant === 'buttons'\">\n      <button\n        v-for=\"(item, index) in items\"\n        :key=\"index\"\n        type=\"button\"\n        class=\"pv-stepper-button pv-flex\"\n        :class=\"index === active ? 'pv-stepper-button-active' : 'pv-stepper-button-inactive'\"\n        :style=\"{ ...counterBadgeStyle(index === active), ...NEW_V3_TOKENS_BUTTONS }\"\n        :data-clickable=\"clickable\"\n        @click=\"clickable && $emit('update:active', index)\"\n      >\n        <PvCounterBadge\n          v-if=\"showCounter\"\n          :variant=\"index === active ? 'primary' : 'tertiary'\"\n          :value=\"index + 1\"\n          rounded\n        />\n        <span>\n          {{ item.label }}\n        </span>\n      </button>\n    </template>\n    <template v-else-if=\"variant === 'dots'\">\n      <div\n        v-for=\"(_, index) in count\"\n        :key=\"index\"\n        :data-clickable=\"clickable\"\n        :class=\"index === active ? 'pv-stepper-active' : 'pv-stepper-inactive'\"\n        @click=\"clickable && $emit('update:active', index)\"\n      ></div>\n    </template>\n    <template v-else>\n      <template v-for=\"(item, index) in items\" :key=\"index\">\n        <div\n          class=\"pv-flex pv-full-width\"\n          :class=\"[\n            {\n              'pv-flex-item': index === stepCount - 1,\n            },\n          ]\"\n          style=\"--flex-gap: 0.25rem\"\n        >\n          <div\n            class=\"pv-flex\"\n            :data-clickable=\"clickable\"\n            @click=\"clickable && $emit('update:active', index)\"\n            :style=\"{ ...NEW_V3_TOKENS_PROGRESS, '--flex-gap': '0.25rem' }\"\n          >\n            <PvIcon\n              :name=\"STEPPER_VARIANT_ICONS[item.variant ?? 'current']\"\n              :class=\"STEPPER_VARIANT_CLASSES_MAP[item.variant ?? 'current'].icon\"\n            />\n            <span class=\"pv-text-body-md\" :class=\"STEPPER_VARIANT_CLASSES_MAP[item.variant ?? 'current'].text\">{{\n              item.label\n            }}</span>\n          </div>\n          <div\n            v-if=\"index < stepCount - 1\"\n            class=\"pv-stepper-progress-divider\"\n            :class=\"STEPPER_DIVIDER_CLASSES[item.variant ?? 'current']\"\n          ></div>\n        </div>\n      </template>\n    </template>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvEmptyStateEmits, PvEmptyStateProps } from \"./types\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\n\ndefineProps<PvEmptyStateProps>();\ndefineEmits<PvEmptyStateEmits>();\n</script>\n\n<template>\n  <div class=\"pv-flex-vertical pv-flow\" style=\"--flow-size: 1.5rem; --flex-gap: 0\">\n    <img v-if=\"src\" :src=\"src\" :alt=\"alt ?? ''\" />\n    <div class=\"pv-flex-vertical\" style=\"max-width: 450px\">\n      <h2 v-if=\"header\" class=\"pv-heading-2\">{{ header }}</h2>\n      <span v-if=\"description\" class=\"pv-text-body-md pv-text-subdued pv-text-center\">{{ description }}</span>\n    </div>\n    <div v-if=\"primaryLabel || secondaryLabel\" class=\"pv-flex-vertical\">\n      <PvButton\n        v-if=\"primaryLabel\"\n        variant=\"primary\"\n        size=\"xl\"\n        :label=\"primaryLabel\"\n        @click=\"$emit('handle-primary-click')\"\n      />\n      <PvButton\n        v-if=\"secondaryLabel\"\n        variant=\"ghost\"\n        size=\"xl\"\n        :label=\"secondaryLabel\"\n        @click=\"$emit('handle-secondary-click')\"\n      />\n    </div>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { PvEmptyStateEmits, PvEmptyStateProps } from \"./types\";\nimport PvButton from \"@/components/base/PvButton/PvButton.vue\";\n\ndefineProps<PvEmptyStateProps>();\ndefineEmits<PvEmptyStateEmits>();\n</script>\n\n<template>\n  <div class=\"pv-flex-vertical pv-flow\" style=\"--flow-size: 1.5rem; --flex-gap: 0\">\n    <img v-if=\"src\" :src=\"src\" :alt=\"alt ?? ''\" />\n    <div class=\"pv-flex-vertical\" style=\"max-width: 450px\">\n      <h2 v-if=\"header\" class=\"pv-heading-2\">{{ header }}</h2>\n      <span v-if=\"description\" class=\"pv-text-body-md pv-text-subdued pv-text-center\">{{ description }}</span>\n    </div>\n    <div v-if=\"primaryLabel || secondaryLabel\" class=\"pv-flex-vertical\">\n      <PvButton\n        v-if=\"primaryLabel\"\n        variant=\"primary\"\n        size=\"xl\"\n        :label=\"primaryLabel\"\n        @click=\"$emit('handle-primary-click')\"\n      />\n      <PvButton\n        v-if=\"secondaryLabel\"\n        variant=\"ghost\"\n        size=\"xl\"\n        :label=\"secondaryLabel\"\n        @click=\"$emit('handle-secondary-click')\"\n      />\n    </div>\n  </div>\n</template>\n","import Aura from \"@primeuix/themes/aura\";\n\nexport const PvComponentsConfig = {\n  theme: {\n    preset: Aura,\n    options: {\n      darkModeSelector: false || \"none\",\n      cssLayer: {\n        name: \"primevue\",\n        order: \"pit-viper-v2, primevue\",\n      },\n    },\n  },\n};\n","import { PrimeVue } from \"@primevue/core\";\nimport { App } from \"vue\";\nimport { PvComponentsConfig } from \"./primeVue.config.ts\";\n\nexport const usePvComponents = (app: App<Element>) => {\n  app.use(PrimeVue, PvComponentsConfig);\n};\n","import { ref, computed, CSSProperties } from \"vue\";\n\nexport interface PopoverComponent {\n  popoverRef: PopoverRefElement;\n}\n\nexport interface TriggerComponent {\n  triggerRef: HTMLElement | null;\n}\n\nexport interface PopoverRefElement {\n  popoverRoot: HTMLElement | null;\n}\n\nexport const useMenuPosition = ({\n  alignment,\n  useTeleport = true,\n  popoverCssProperties,\n}: {\n  alignment?: \"top\" | \"right\" | \"top right\";\n  useTeleport?: boolean;\n  popoverCssProperties?: CSSProperties;\n} = {}) => {\n  const triggerRect = ref<DOMRect | null>(null);\n  const popoverRect = ref<DOMRect | null>(null);\n  const triggerRef = ref<HTMLElement | null>(null);\n  const popoverRef = ref<PopoverRefElement | null>(null);\n\n  const getPositionedAncestor = (element: HTMLElement): HTMLElement | null => {\n    let parent = element.parentElement;\n    while (parent && parent !== document.body) {\n      const computedStyle = window.getComputedStyle(parent);\n      if (computedStyle.position !== \"static\") {\n        return parent;\n      }\n      parent = parent.parentElement;\n    }\n    return null;\n  };\n\n  const leftOffset = computed(() => {\n    if (!triggerRect.value || !popoverRect.value || !popoverRef.value?.popoverRoot) return 0;\n\n    let left = triggerRect.value.left + window.scrollX;\n    if (alignment === \"right\" || alignment === \"top right\") {\n      left = triggerRect.value.left + triggerRect.value.width + window.scrollX;\n    }\n\n    const positionedAncestor = getPositionedAncestor(popoverRef.value.popoverRoot);\n    if (positionedAncestor) {\n      const ancestorRect = positionedAncestor.getBoundingClientRect();\n      left -= ancestorRect.left + window.scrollX - positionedAncestor.scrollLeft;\n    }\n\n    return left;\n  });\n\n  const topOffset = computed(() => {\n    if (!triggerRect.value || !popoverRect.value || !popoverRef.value?.popoverRoot) return 0;\n\n    let top = triggerRect.value.top + window.scrollY;\n    if (!(alignment === \"top\" || alignment === \"top right\")) {\n      top += triggerRect.value.height;\n    }\n\n    const positionedAncestor = getPositionedAncestor(popoverRef.value.popoverRoot);\n    if (positionedAncestor) {\n      const ancestorRect = positionedAncestor.getBoundingClientRect();\n      top -= ancestorRect.top + window.scrollY - positionedAncestor.scrollTop;\n    }\n\n    return top;\n  });\n\n  const popoverPositionStyle = computed(() => {\n    if (!useTeleport) {\n      return popoverCssProperties;\n    }\n\n    const teleportStyles = {\n      position: \"absolute\",\n      left: `${leftOffset.value}px`,\n      top: `${topOffset.value}px`,\n      zIndex: 10,\n    } as CSSProperties;\n    // combine styles, prioritize teleportStyles\n    const combinedStyles: CSSProperties = {\n      ...popoverCssProperties,\n      ...teleportStyles,\n    };\n    return combinedStyles;\n  });\n\n  const updateRects = () => {\n    if (triggerRef.value) {\n      triggerRect.value = triggerRef.value.getBoundingClientRect();\n    }\n    if (popoverRef.value?.popoverRoot) {\n      popoverRect.value = popoverRef.value.popoverRoot.getBoundingClientRect();\n    }\n  };\n\n  return {\n    triggerRef,\n    popoverRef,\n    triggerRect,\n    popoverRect,\n    popoverPositionStyle,\n    updateRects,\n  };\n};\n","import { computed, toValue, type ComputedRef, type MaybeRefOrGetter } from \"vue\";\nimport { resolveColorTheme, type PvColorTheme } from \"@/functions/colorThemes\";\n\n/**\n * Reactively resolves a color theme id (for example a stored selection) to its label, key colors\n * and full chart palette. Unknown or malformed ids resolve to Turquoise.\n */\nexport function useColorTheme(id: MaybeRefOrGetter<string | null | undefined>): ComputedRef<PvColorTheme> {\n  return computed(() => resolveColorTheme(toValue(id)));\n}\n","import { computed, toValue, type ComputedRef, type MaybeRefOrGetter } from \"vue\";\nimport {\n  createCustomColorTheme,\n  getCustomColorThemeColors,\n  isCustomColorThemeId,\n  type PvColorTheme,\n  type PvCustomColorThemeId,\n} from \"@/functions/colorThemes\";\n\n/** 1-4 key colors (`#RRGGBB`, `#RGB`, with or without `#`), one color, or a custom theme id. */\nexport type PvCustomColorThemeSource = readonly string[] | string | null | undefined;\n\nexport interface UseCustomColorThemeReturn {\n  /** The generated theme, or `undefined` when no color is valid. */\n  theme: ComputedRef<PvColorTheme | undefined>;\n  /** The theme id to store or pass to a `theme`/`colorTheme` prop, e.g. `custom:04D7C6-EC5A62`. */\n  id: ComputedRef<PvCustomColorThemeId | undefined>;\n  /** The full 15-color chart palette, in series order. Empty when no color is valid. */\n  palette: ComputedRef<string[]>;\n  /** Notes on key colors that were adjusted for contrast or to stay distinct. */\n  notes: ComputedRef<string[]>;\n  /** The same notes grouped by key color: `pickNotes[i]` is about `theme.colors[i]`. */\n  pickNotes: ComputedRef<string[][]>;\n}\n\nconst toColors = (source: PvCustomColorThemeSource): string[] => {\n  if (!source) return [];\n  if (typeof source !== \"string\") return [...source];\n  return isCustomColorThemeId(source) ? getCustomColorThemeColors(source) : [source];\n};\n\n/**\n * Reactively builds a 15-color custom theme from 1-4 key colors or a custom theme id.\n * Invalid colors are dropped and colors past the fourth are ignored.\n */\nexport function useCustomColorTheme(source: MaybeRefOrGetter<PvCustomColorThemeSource>): UseCustomColorThemeReturn {\n  const generated = computed(() => createCustomColorTheme(toColors(toValue(source))));\n  const theme = computed(() => generated.value.theme);\n  return {\n    theme,\n    id: computed(() => theme.value?.id as PvCustomColorThemeId | undefined),\n    palette: computed(() => theme.value?.palette ?? []),\n    notes: computed(() => generated.value.notes),\n    pickNotes: computed(() => generated.value.pickNotes),\n  };\n}\n","import { colorDistance } from \"@/functions/colorPalette\";\n\nexport interface ExtractImageColorsOptions {\n  /** How many colors to return at most: 1 or 2. Defaults to 2. */\n  maxColors?: number;\n}\n\n/** An image to read colors from: a file or blob (e.g. an upload), or an image URL. */\nexport type PvImageColorSource = Blob | string;\n\nexport interface ExtractColorsFromImageOptions extends ExtractImageColorsOptions {\n  /** Stops loading the image; the promise then rejects with the signal's reason. */\n  signal?: AbortSignal;\n  /** Largest file or blob accepted, in bytes. Defaults to 10 MB. */\n  maxBytes?: number;\n}\n\n/** Largest file or blob read by default, in bytes. Bounds decode memory for user uploads. */\nexport const MAX_IMAGE_COLOR_BYTES = 10 * 1024 * 1024;\n\n// Pixels lighter than this on every channel count as background (white or near-white).\nconst BACKGROUND_MIN_CHANNEL = 235;\nconst MIN_ALPHA = 128;\n// Below this chroma (max channel minus min channel, 0-1), a pixel counts as gray.\nconst MIN_CHROMA = 0.18;\n// Colors share a cluster when they are closer than this (OKLab distance).\nconst CLUSTER_DISTANCE = 0.08;\n// The second color must differ this much from the first (OKLab distance).\nconst MIN_SECOND_COLOR_DISTANCE = 0.15;\n// The second color must cover at least this share of the counted pixels. Filters anti-aliasing.\nconst MIN_SECOND_COLOR_SHARE = 0.08;\n// Gray pixels only count when the image has almost no color.\nconst MIN_CHROMATIC_SHARE = 0.03;\n/** Longest side, in pixels, an image is scaled down to before its colors are read. */\nconst SAMPLE_SIZE = 96;\n\ninterface Cluster {\n  count: number;\n  r: number;\n  g: number;\n  b: number;\n  hex: string;\n}\n\nconst toHex = (r: number, g: number, b: number) =>\n  \"#\" +\n  [r, g, b]\n    .map((channel) => Math.round(channel).toString(16).padStart(2, \"0\"))\n    .join(\"\")\n    .toUpperCase();\n\nconst addBucket = (buckets: Map<number, Cluster>, r: number, g: number, b: number) => {\n  const key = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);\n  const bucket = buckets.get(key);\n  if (bucket) {\n    bucket.count += 1;\n    bucket.r += r;\n    bucket.g += g;\n    bucket.b += b;\n  } else {\n    buckets.set(key, { count: 1, r, g, b, hex: \"\" });\n  }\n};\n\n// Merges near-identical buckets, largest first, so one logo color split across buckets counts once.\nconst toClusters = (buckets: Map<number, Cluster>): Cluster[] => {\n  const clusters: Cluster[] = [];\n  const sorted = [...buckets.values()].sort((a, b) => b.count - a.count);\n  for (const bucket of sorted) {\n    const hex = toHex(bucket.r / bucket.count, bucket.g / bucket.count, bucket.b / bucket.count);\n    const match = clusters.find((cluster) => colorDistance(cluster.hex, hex) < CLUSTER_DISTANCE);\n    if (match) {\n      match.count += bucket.count;\n      match.r += bucket.r;\n      match.g += bucket.g;\n      match.b += bucket.b;\n    } else {\n      clusters.push({ ...bucket, hex });\n    }\n  }\n  return clusters\n    .map((cluster) => ({\n      ...cluster,\n      hex: toHex(cluster.r / cluster.count, cluster.g / cluster.count, cluster.b / cluster.count),\n    }))\n    .sort((a, b) => b.count - a.count);\n};\n\n/**\n * Picks the 1-2 dominant brand colors from RGBA pixel data, e.g. a logo's `ImageData.data`.\n * Transparent and near-white (background) pixels are ignored. Gray pixels only count when the\n * image has almost no color, so a black-and-teal logo gives teal. A second color is only returned\n * when it is clearly different from the first and covers a real share of the image.\n * Returns `#RRGGBB` colors, most dominant first, or `[]` when every pixel is background.\n */\nexport function extractImageColors(\n  pixels: ArrayLike<number>,\n  { maxColors = 2 }: ExtractImageColorsOptions = {},\n): string[] {\n  const limit = Math.min(2, Math.max(1, Math.floor(maxColors)));\n  const chromatic = new Map<number, Cluster>();\n  const neutral = new Map<number, Cluster>();\n  let chromaticCount = 0;\n  let neutralCount = 0;\n\n  for (let index = 0; index + 3 < pixels.length; index += 4) {\n    const r = pixels[index];\n    const g = pixels[index + 1];\n    const b = pixels[index + 2];\n    if (pixels[index + 3] < MIN_ALPHA) continue;\n    const min = Math.min(r, g, b);\n    if (min > BACKGROUND_MIN_CHANNEL) continue;\n    if ((Math.max(r, g, b) - min) / 255 >= MIN_CHROMA) {\n      addBucket(chromatic, r, g, b);\n      chromaticCount += 1;\n    } else {\n      addBucket(neutral, r, g, b);\n      neutralCount += 1;\n    }\n  }\n\n  const useChromatic = chromaticCount > 0 && chromaticCount >= (chromaticCount + neutralCount) * MIN_CHROMATIC_SHARE;\n  const total = useChromatic ? chromaticCount : neutralCount;\n  if (!total) return [];\n  const [first, ...rest] = toClusters(useChromatic ? chromatic : neutral);\n  const second = rest.find(\n    (cluster) =>\n      cluster.count >= total * MIN_SECOND_COLOR_SHARE &&\n      colorDistance(cluster.hex, first.hex) >= MIN_SECOND_COLOR_DISTANCE,\n  );\n  return [first, second]\n    .filter((cluster): cluster is Cluster => !!cluster)\n    .slice(0, limit)\n    .map((cluster) => cluster.hex);\n}\n\nconst loadImage = (src: string, signal?: AbortSignal) =>\n  new Promise<HTMLImageElement>((resolve, reject) => {\n    const image = new Image();\n    const onAbort = () => {\n      // Clearing the source stops the download and decode.\n      image.removeAttribute(\"src\");\n      reject(signal?.reason);\n    };\n    image.crossOrigin = \"anonymous\";\n    image.decoding = \"async\";\n    image.onload = () => {\n      signal?.removeEventListener(\"abort\", onAbort);\n      resolve(image);\n    };\n    image.onerror = () => {\n      signal?.removeEventListener(\"abort\", onAbort);\n      reject(new Error(\"The image could not be loaded.\"));\n    };\n    signal?.addEventListener(\"abort\", onAbort, { once: true });\n    image.src = src;\n  });\n\n/**\n * Loads an image (a file, blob or URL) in the browser and picks its 1-2 dominant brand colors.\n * See `extractImageColors`. URLs on other origins must allow CORS, or reading the pixels fails.\n * Files and blobs must be images no larger than `maxBytes`.\n */\nexport async function extractColorsFromImage(\n  source: PvImageColorSource,\n  { signal, maxBytes = MAX_IMAGE_COLOR_BYTES, ...options }: ExtractColorsFromImageOptions = {},\n): Promise<string[]> {\n  signal?.throwIfAborted();\n  if (typeof source !== \"string\") {\n    if (source.type && !source.type.startsWith(\"image/\")) throw new Error(\"The file is not an image.\");\n    if (source.size > maxBytes) throw new Error(\"The image file is too large.\");\n  }\n  const url = typeof source === \"string\" ? source : URL.createObjectURL(source);\n  try {\n    const image = await loadImage(url, signal);\n    signal?.throwIfAborted();\n    // SVGs without a width or height report 0; draw them at the sample size.\n    const width = image.naturalWidth || SAMPLE_SIZE;\n    const height = image.naturalHeight || SAMPLE_SIZE;\n    const scale = Math.min(1, SAMPLE_SIZE / Math.max(width, height));\n    const canvas = document.createElement(\"canvas\");\n    canvas.width = Math.max(1, Math.round(width * scale));\n    canvas.height = Math.max(1, Math.round(height * scale));\n    const context = canvas.getContext(\"2d\", { willReadFrequently: true });\n    if (!context) throw new Error(\"Canvas is not available.\");\n    context.drawImage(image, 0, 0, canvas.width, canvas.height);\n    return extractImageColors(context.getImageData(0, 0, canvas.width, canvas.height).data, options);\n  } finally {\n    if (typeof source !== \"string\") URL.revokeObjectURL(url);\n  }\n}\n","import { ref, toValue, watch, type MaybeRefOrGetter, type Ref } from \"vue\";\nimport { extractColorsFromImage, type PvImageColorSource } from \"@/functions/imageColors\";\n\nexport interface UseImageColorsOptions {\n  /** How many colors to return at most: 1 or 2. Defaults to 2. */\n  maxColors?: MaybeRefOrGetter<number | undefined>;\n}\n\nexport interface UseImageColorsReturn {\n  /** The image's dominant colors as `#RRGGBB`, most dominant first. Empty until loaded. */\n  colors: Readonly<Ref<string[]>>;\n  /** True while the image loads. */\n  loading: Readonly<Ref<boolean>>;\n  /** Set when the image cannot be loaded or read. */\n  error: Readonly<Ref<Error | undefined>>;\n}\n\n/**\n * Reactively picks the 1-2 dominant brand colors from an image, e.g. an uploaded logo.\n * Accepts a `File`/`Blob` (an image up to 10 MB) or an image URL (other origins must allow CORS).\n * Changing the source cancels the previous load, as does unmounting. Pass the colors to\n * `useCustomColorTheme` to build a full palette.\n */\nexport function useImageColors(\n  source: MaybeRefOrGetter<PvImageColorSource | null | undefined>,\n  options: UseImageColorsOptions = {},\n): UseImageColorsReturn {\n  const colors = ref<string[]>([]);\n  const loading = ref(false);\n  const error = ref<Error | undefined>();\n\n  // Each change aborts the previous load, so a stale image stops downloading and never writes.\n  watch(\n    () => [toValue(source), toValue(options.maxColors) ?? 2] as const,\n    async ([image, maxColors], _, onCleanup) => {\n      const controller = new AbortController();\n      onCleanup(() => controller.abort());\n      error.value = undefined;\n      if (!image) {\n        colors.value = [];\n        loading.value = false;\n        return;\n      }\n      loading.value = true;\n      try {\n        const extracted = await extractColorsFromImage(image, { maxColors, signal: controller.signal });\n        if (!controller.signal.aborted) colors.value = extracted;\n      } catch (cause) {\n        if (controller.signal.aborted) return;\n        colors.value = [];\n        error.value = cause instanceof Error ? cause : new Error(String(cause));\n      } finally {\n        if (!controller.signal.aborted) loading.value = false;\n      }\n    },\n    { immediate: true },\n  );\n\n  return { colors, loading, error };\n}\n","/**\n * Thin runtime-optional wrapper around Datadog Browser RUM's `addAction`.\n *\n * The SDK is loaded by the host application (e.g. via a CDN snippet) and is\n * not a dependency of this library. If `window.DD_RUM` is unavailable, calls\n * are no-ops so component code can emit telemetry unconditionally.\n *\n * Hosts configure emission through the `RumContextKey` provide/inject pair\n * (see `useRumContext`) rather than props:\n *\n * - `consumer` tags every event so the same shared component can produce\n *   events differentiated by host app (e.g. \"Analyze\", \"Contracting\"),\n *   filterable in Datadog as `@action.context.consumer:Analyze`.\n * - `enabled: false` suppresses every RUM custom action emitted by\n *   pv-components — for hosts that run the Datadog SDK site-wide (views,\n *   errors, replays) but don't want component-level telemetry. Defaults to\n *   enabled. The `data-dd-action-name` attributes are inert markup and are\n *   not affected; disable Datadog's `trackUserInteractions` to silence those.\n */\n\nimport { inject, type InjectionKey, type Ref } from \"vue\";\n\n/**\n * Host-provided configuration for pv-components' RUM emission. A plain\n * string is shorthand for `{ consumer: <string> }`.\n */\nexport type PvRumContext = {\n  /** Tag merged into every event as the `consumer` property. */\n  consumer?: string;\n  /** Set false to suppress all pv-components RUM custom actions. Default: enabled. */\n  enabled?: boolean;\n};\n\ntype DatadogRumLike = {\n  addAction: (name: string, context?: Record<string, unknown>) => void;\n};\n\ndeclare global {\n  interface Window {\n    DD_RUM?: DatadogRumLike;\n  }\n}\n\n/**\n * Provide this from a host (typically once at the top of a page/view) to\n * configure the Datadog RUM custom actions emitted by pv-components rendered\n * beneath it. Examples:\n *\n *   provide(RumContextKey, ref(\"Analyze\"));                          // tag only\n *   provide(RumContextKey, ref({ consumer: \"Analyze\" }));            // same\n *   provide(RumContextKey, ref({ enabled: false }));                 // opt out\n *\n * The value is a `Ref` and is read at emit time, so hosts can change the\n * consumer or flip `enabled` at runtime.\n */\n// Symbol.for (global registry) rather than Symbol(): the library ships as\n// separate base and visualizations bundles that each include a copy of this\n// module, and host apps import from one of them. A plain Symbol would have a\n// different identity per copy, silently breaking provide/inject across\n// bundle boundaries.\nexport const RumContextKey: InjectionKey<Ref<string | PvRumContext | undefined>> = Symbol.for(\"pv.rum-context\");\n\n/**\n * Resolve the host-provided RUM context at a call site. Returns a resolver\n * function rather than a snapshot: call it at emit time so runtime changes\n * to the provided ref (consumer switch, enabled toggle) take effect.\n * Resolves to an empty context when no host provided one.\n */\nexport const useRumContext = (): (() => PvRumContext) => {\n  const injected = inject(RumContextKey, undefined);\n  return () => {\n    const raw = injected?.value;\n    if (typeof raw === \"string\") return { consumer: raw };\n    return raw ?? {};\n  };\n};\n\nexport const addRumAction = (\n  name: string,\n  properties: Record<string, unknown> = {},\n  context: PvRumContext = {},\n): void => {\n  try {\n    if (context.enabled === false) {\n      return;\n    }\n    if (typeof window === \"undefined\" || !window.DD_RUM?.addAction) {\n      return;\n    }\n\n    const payload: Record<string, unknown> =\n      context.consumer != null ? { ...properties, consumer: context.consumer } : properties;\n\n    window.DD_RUM.addAction(name, payload);\n  } catch {\n    // Telemetry must never break the app — swallow anything the RUM SDK throws.\n  }\n};\n\n/**\n * Run a telemetry block on a microtask, isolated from the calling code path.\n *\n * Call sites snapshot whatever state they need synchronously, then hand the\n * diff/format/emit work to this helper. The surrounding handler (filter\n * flush, chart option update, ...) finishes first, and an exception inside\n * the task stops here instead of unwinding app code — so a bug in event\n * assembly can never affect the interaction being measured.\n */\nexport const deferRumTask = (task: () => void): void => {\n  queueMicrotask(() => {\n    try {\n      task();\n    } catch {\n      // Swallow: RUM telemetry must never affect app behavior.\n    }\n  });\n};\n","export const askTqBuddyEmotes = [\n  \"idle\",\n  \"curious\",\n  \"greeting\",\n  \"listening\",\n  \"thinking\",\n  \"working\",\n  \"talking\",\n  \"happy\",\n  \"confused\",\n  \"sleeping\",\n  \"boo\",\n] as const;\n\nexport const askTqBuddySizes = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport const askTqBuddyVariants = [\"default\", \"mono\", \"solid\", \"outline\"] as const;\nexport const askTqBuddyThemes = [\"default\", \"halloween\"] as const;\n\nexport type AskTqBuddyEmote = (typeof askTqBuddyEmotes)[number];\nexport type AskTqBuddySize = (typeof askTqBuddySizes)[number];\nexport type AskTqBuddyVariant = (typeof askTqBuddyVariants)[number];\nexport type AskTqBuddyTheme = (typeof askTqBuddyThemes)[number];\n\nexport interface AskTqBuddyProps {\n  /** Enables continuous emote motion. Defaults to a static pose. */\n  animated?: boolean;\n  /**\n   * Quieter idle for always-visible placements such as a header button: no breathing, one slow blink or glance\n   * every 12-18 seconds, idle motion at half speed, and pointer tracking at three-quarter speed.\n   */\n  calm?: boolean;\n  /** Expression and motion state shown by the AI buddy. `boo` is a jump scare designed for the halloween theme. */\n  emote?: AskTqBuddyEmote;\n  /** Display size of the AI buddy. */\n  size?: AskTqBuddySize;\n  /** Seasonal look applied to the buddy's shape, colors, and eyes. */\n  theme?: AskTqBuddyTheme;\n  /**\n   * Rendering style. `default` is the full gradient mascot; `mono`, `solid`, and `outline` are flat,\n   * untextured icon versions. `mono` and `outline` draw in `currentColor`; `solid` uses turquoise.\n   */\n  variant?: AskTqBuddyVariant;\n}\n"],"x_google_ignoreList":[11,12,13,14,15,16],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,IAAM,IAA6C;GACjD,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL,EAEK,IAAwD;GAC5D,SAAS;GACT,MAAM;GACN,OAAO;GACR;yBASC,EAA+G,OAAA;GAA1G,eAAY;GAAc,OAAK,EAAE,EAAoB,EAAA,SAAO;GAAI,OAAK,EAAA,EAAA,UAAc,EAAY,EAAA,OAAI,CAAA;;;IE7B7F,KAAiC,CAAC,QAAQ,EAEjD,KAA2D;CAC/D,IAAI;CACJ,IAAI,KAAA;CACJ,IAAI;CACL,EAEY,MAAuB,MAC9B,KAAQ,QAAQ,CAAC,GAAe,eAAe,EAAK,GAC/C,OAEF,GAAe,MAAS;;;ACQjC,SAAgB,KAAoB;CAClC,IAAM,IAAO,EAAI,GAAM,EAEjB,IADW,GAAoB,EACd,QAAQ,EAAE;AAIjC,QAHI,UAAU,KAAQ,EAAK,SAAS,OAClC,EAAK,QAAQ,KAER;;;;ACRT,IAAa,KAAkC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACP,EAEY,KAAc;CAAC,KAAA;CAAW;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAG;;;;;;;ECtBlE,IAAM,IAAQ,GACR,IAAQ,IAAmB,EAE3B,IAAuC,EAAI,KAAK,EAEhD,IAAU,SAAgB;GAC9B,WAAW;IACV,WAAW,EAAM,SAAS,EAAM,QAAQ,QAAQ,GAAY,S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