@automattic/charts 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.cjs +541 -84
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.css +122 -34
  5. package/dist/index.d.cts +97 -7
  6. package/dist/index.d.ts +97 -7
  7. package/dist/index.js +539 -87
  8. package/dist/index.js.map +1 -1
  9. package/package.json +8 -8
  10. package/src/charts/area-chart/area-chart.module.scss +3 -1
  11. package/src/charts/area-chart/area-chart.tsx +5 -2
  12. package/src/charts/bar-chart/bar-chart.module.scss +6 -2
  13. package/src/charts/bar-chart/bar-chart.tsx +29 -22
  14. package/src/charts/bar-chart/private/comparison-bars.tsx +7 -0
  15. package/src/charts/bar-chart/private/use-bar-chart-options.ts +4 -1
  16. package/src/charts/bar-chart/test/bar-chart.test.tsx +141 -3
  17. package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +15 -12
  18. package/src/charts/geo-chart/geo-chart.tsx +6 -1
  19. package/src/charts/geo-chart/test/geo-chart.test.tsx +11 -1
  20. package/src/charts/heatmap-chart/heatmap-chart.module.scss +103 -0
  21. package/src/charts/heatmap-chart/heatmap-chart.tsx +422 -0
  22. package/src/charts/heatmap-chart/index.ts +4 -0
  23. package/src/charts/heatmap-chart/private/build-calendar-data.ts +81 -0
  24. package/src/charts/heatmap-chart/private/heatmap-legend.tsx +53 -0
  25. package/src/charts/heatmap-chart/private/index.ts +5 -0
  26. package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +45 -0
  27. package/src/charts/heatmap-chart/test/build-calendar-data.test.ts +88 -0
  28. package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +301 -0
  29. package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +34 -0
  30. package/src/charts/heatmap-chart/types.ts +42 -0
  31. package/src/charts/index.ts +1 -0
  32. package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +18 -6
  33. package/src/charts/line-chart/line-chart.module.scss +6 -4
  34. package/src/charts/line-chart/line-chart.tsx +6 -2
  35. package/src/charts/line-chart/private/line-chart-annotation.tsx +16 -3
  36. package/src/charts/private/grid-control/grid-control.module.scss +1 -4
  37. package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +1 -1
  38. package/src/charts/private/with-responsive/test/with-responsive.test.tsx +14 -0
  39. package/src/charts/private/with-responsive/with-responsive.tsx +12 -0
  40. package/src/charts/private/x-zoom.module.scss +6 -3
  41. package/src/components/legend/private/base-legend.module.scss +3 -1
  42. package/src/components/tooltip/base-tooltip.module.scss +4 -1
  43. package/src/components/trend-indicator/trend-indicator.module.scss +5 -3
  44. package/src/hooks/use-xychart-theme.ts +24 -0
  45. package/src/index.ts +12 -0
  46. package/src/providers/chart-context/themes.ts +29 -16
  47. package/src/types.ts +19 -2
  48. package/src/utils/color-utils.ts +36 -0
  49. package/src/utils/test/color-utils.test.ts +33 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["d3Color","d3Hsl","color","d3Hsl","d3Hsl","_formatErrorMessage","STYLE_HASH_ATTRIBUTE","getRuntime","documentContainsStyleHash","injectStyle","registerDocument","registerStyle","style_default","forwardRef","Text","forwardRef","styles","styles","styles","formatDateTick","toNumber","validateData","getScaleBandwidth","BarChartUnresponsive","replace","kebabCase","memoize","forwardRef","warn","useRef","createContext","useContext","useRef","warn","useMemo","isDevelopment","parse","getRegisteredStyles","isDevelopment","unitless","asTemplateStringsArr","templateStringsArr","hashString","isDevelopment","Insertion","getRegisteredStyles","jsx","Emotion","css","merge","getRegisteredStyles","useEmotionCache","useCallback","innerCx","warn","getRegisteredStyles","forwardRef","component_default","useState","useMemo","css","CONFIG","View","Grid","validateData","styles","getStringWidth","Icon","styles"],"sources":["../src/charts/private/single-chart-context/single-chart-context.tsx","../src/charts/private/single-chart-context/use-single-chart-context.ts","../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts","../src/utils/resolve-font-size.ts","../src/providers/chart-context/private/get-chart-color.ts","../src/providers/chart-context/themes.ts","../src/providers/chart-context/global-charts-provider.tsx","../src/providers/chart-context/hooks/use-global-charts-context.ts","../src/providers/chart-context/hooks/use-chart-id.ts","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/hooks/use-deep-memo.ts","../src/hooks/use-xychart-theme.ts","../src/hooks/use-chart-data-transform.ts","../src/hooks/use-chart-margin.tsx","../src/hooks/use-element-size.ts","../src/hooks/use-text-truncation.ts","../src/hooks/use-zero-value-display.ts","../src/hooks/use-data-with-percentages.ts","../src/hooks/use-interactive-legend-data.ts","../src/hooks/use-prefers-reduced-motion.ts","../src/providers/chart-context/hooks/use-chart-registration.ts","../src/providers/chart-context/hooks/use-global-charts-theme.ts","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/mergeObjects.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/formatErrorMessage.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useRefWithInit.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useMergedRefs.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/reactVersion.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/warn.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/empty.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/internals/useRenderElement.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js","../../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/stack/stack.mjs","../../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/text/text.mjs","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/legend.tsx","../src/components/legend/hooks/use-chart-legend-items.ts","../src/components/tooltip/base-tooltip.tsx","../src/components/tooltip/accessible-tooltip.tsx","../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts","../src/charts/private/chart-layout/chart-layout.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/private/center/center.tsx","../src/charts/private/svg-empty-state/svg-empty-state.tsx","../src/charts/private/time-axis.ts","../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/x-zoom.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx","../src/charts/line-chart/line-chart.tsx","../src/charts/area-chart/private/validate-data.ts","../src/charts/area-chart/private/overlays.tsx","../src/charts/area-chart/area-chart.tsx","../src/charts/bar-chart/private/truncated-tick-component.tsx","../src/charts/bar-chart/private/use-bar-chart-options.ts","../src/charts/bar-chart/private/comparison-bars-geometry.ts","../src/charts/bar-chart/private/comparison-constants.ts","../src/charts/bar-chart/private/comparison-bars.tsx","../src/charts/bar-chart/bar-chart.tsx","../src/charts/bar-list-chart/bar-list-chart.tsx","../src/charts/conversion-funnel-chart/private/use-funnel-selection.ts","../src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx","../src/utils/sanitize-html.ts","../src/charts/geo-chart/geo-chart.tsx","../../../../node_modules/.pnpm/@wordpress+warning@3.48.1/node_modules/@wordpress/warning/build-module/utils.mjs","../../../../node_modules/.pnpm/@wordpress+warning@3.48.1/node_modules/@wordpress/warning/build-module/index.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs","../../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js","../../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js","../../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js","../../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js","../../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js","../../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs","../../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js","../../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@18.3.1/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs","../../../../node_modules/.pnpm/@emotion+is-prop-valid@1.4.0/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js","../../../../node_modules/.pnpm/@emotion+styled@11.14.1_@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1__@types+react@18.3.28_react@18.3.1/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs","../../../../node_modules/.pnpm/@wordpress+components@35.0.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs","../src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts","../src/charts/leaderboard-chart/leaderboard-chart.tsx","../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx","../src/charts/pie-chart/pie-chart.tsx","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx","../src/charts/sparkline/sparkline.tsx","../src/components/trend-indicator/trend-indicator.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface ChartInstanceRef {\n\tgetScales: () => { xScale: unknown; yScale: unknown } | null;\n\tgetChartDimensions: () => {\n\t\twidth: number;\n\t\theight: number;\n\t\tmargin: { top?: number; right?: number; bottom?: number; left?: number };\n\t};\n}\n\n// Local context for chart implicit state sharing\nexport interface ChartInstanceContextValue {\n\tchartId: string;\n\tchartRef?: React.RefObject< ChartInstanceRef >;\n\tchartWidth?: number;\n\tchartHeight?: number;\n}\n\nexport const ChartInstanceContext = createContext< ChartInstanceContextValue | null >( null );\n\n// Backward compatibility exports\nexport const SingleChartContext = ChartInstanceContext;\nexport type SingleChartContextValue = ChartInstanceContextValue;\nexport type SingleChartRef = ChartInstanceRef;\n","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './single-chart-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n\nexport const useSingleChartContext = useChartInstanceContext;\n","/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\tconst tIndex = dateString.indexOf( 'T' );\n\tif ( tIndex === -1 ) {\n\t\treturn false;\n\t}\n\n\tif ( dateString.endsWith( 'Z' ) ) {\n\t\treturn true;\n\t}\n\n\treturn /[+-]\\d{2}:?\\d{2}$/.test( dateString.slice( tIndex + 1 ) );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { BarStyles, ChartTheme, LegendShape, SeriesData } from '../types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility to get consolidated bar styles for a series by semantic type.\n * Mirrors getSeriesLineStyles: a series with `options.type` (e.g. 'comparison')\n * resolves to `theme.barChart.barStyles[ type ]`.\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {BarStyles} The consolidated bar styles for the series\n */\nexport function getSeriesBarStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): BarStyles {\n\tconst type = seriesData.options?.type;\n\treturn ( type && providerTheme?.barChart?.barStyles?.[ type ] ) ?? {};\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\t// For non-line legends (e.g. bar 'rect'), reflect the comparison bar's opacity on the\n\t// swatch so the legend marker matches the translucent comparison bar. Line-type legends\n\t// convey comparison via the dashed stroke (lineStyles) instead.\n\tconst barOpacity =\n\t\tlegendShape !== 'line' ? getSeriesBarStyles( series, index, theme ).opacity : undefined;\n\tconst barShapeStyles = barOpacity !== undefined ? { opacity: barOpacity } : {};\n\tconst themeShapeStyles = theme.legend?.shapeStyles?.[ index ];\n\n\t// Series-level styles (custom shape style + line styles) take precedence; otherwise fall\n\t// back to the per-index theme shape styles.\n\tconst explicitStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\tconst hasExplicitStyles = Object.values( explicitStyles ).some(\n\t\tvalue => value !== undefined && value !== null && value !== ''\n\t);\n\tconst baseShapeStyles = hasExplicitStyles ? explicitStyles : themeShapeStyles ?? {};\n\n\t// Layer the comparison bar opacity on top so the swatch matches the translucent bar\n\t// without discarding the base (custom or theme) shape styles.\n\treturn { ...baseShapeStyles, ...barShapeStyles };\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @deprecated Use normalizeColorToHex() instead, which handles all color formats including rgb() and rgba().\n * @param rgbString - RGB color string (not RGBA)\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\t// This is intentional - use normalizeColorToHex for rgba() support\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex, HSL, HSLA, RGB, RGBA, named CSS colors, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @param _depth - Internal recursion depth counter to prevent infinite loops\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null,\n\t_depth = 0\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved && resolved !== color && _depth < 10 ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss, _depth + 1 );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL, HSLA, RGB, and RGBA strings using d3-color\n\tif (\n\t\ttrimmed.startsWith( 'hsl(' ) ||\n\t\ttrimmed.startsWith( 'hsla(' ) ||\n\t\ttrimmed.startsWith( 'rgb(' ) ||\n\t\ttrimmed.startsWith( 'rgba(' )\n\t) {\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Attempt d3-color for any remaining format (e.g. named CSS colors like \"steelblue\")\n\tconst parsed = d3Color( trimmed );\n\tif ( parsed ) {\n\t\treturn parsed.formatHex();\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = (\n\tvalue: string,\n\telement?: HTMLElement | null\n): string | null => {\n\tif ( ! value ) {\n\t\treturn null;\n\t}\n\n\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t// Parse manually to avoid regex backtracking vulnerabilities\n\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\tconst parsed = parseVarExpression( value );\n\n\t\tif ( parsed ) {\n\t\t\tconst resolved = resolveVariableName( parsed.varName, element );\n\n\t\t\treturn resolved || parsed.fallback;\n\t\t}\n\t}\n\n\t// Check if it's a plain variable name (starts with --)\n\tif ( value.startsWith( '--' ) ) {\n\t\treturn resolveVariableName( value, element );\n\t}\n\n\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\treturn value;\n};\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Resolves a plain CSS variable name to its computed value.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param element - Optional DOM element to resolve from\n * @return The computed value or null\n */\nfunction resolveVariableName( varName: string, element?: HTMLElement | null ): string | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst targetElement = element || document.documentElement;\n\t\tconst computedValue = getComputedStyle( targetElement ).getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Return null if getComputedStyle throws (e.g., detached element)\n\t\treturn null;\n\t}\n}\n","/**\n * Resolve a theme `fontSize` value into a plain number suitable for\n * canvas-based measurement (e.g. `getStringWidth`).\n *\n * Accepts:\n * - A number — returned as-is\n * - A pixel string like `\"12px\"` — parsed and returned as a number\n *\n * Returns `undefined` for any other input (missing value, NaN, or\n * relative units like `rem`/`em`/`%`/`vh`) so callers can fall back to\n * their own default. Relative units are intentionally rejected because\n * we cannot resolve them to absolute pixels here without a parent\n * computed style, and silently returning the unitless prefix\n * (`parseFloat(\"0.875rem\") === 0.875`) would produce nearly-zero\n * widths in measurement code.\n * @param val - Raw font size value from a theme, axis style, or props\n * @return Parsed numeric font size in pixels, or `undefined` when unresolvable\n */\nexport const resolveFontSize = ( val?: number | string ): number | undefined => {\n\tif ( typeof val === 'number' ) {\n\t\treturn isNaN( val ) ? undefined : val;\n\t}\n\n\tif ( typeof val === 'string' ) {\n\t\t// Only accept plain numeric strings or pixel values.\n\t\t// Reject rem, em, %, vh, vw, etc. — they cannot be resolved to\n\t\t// absolute pixels without a computed style context.\n\t\tconst match = val.trim().match( /^(-?\\d+\\.?\\d*|-?\\.\\d+)(px)?$/ );\n\t\tif ( ! match ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst parsed = parseFloat( match[ 1 ] );\n\t\treturn isNaN( parsed ) ? undefined : parsed;\n\t}\n\n\treturn undefined;\n};\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { getColorDistance } from '../../../utils';\n\nexport interface ColorCache {\n\tcolors: string[];\n\thues: number[];\n\texistingHslColors: Array< [ number, number, number ] >;\n\tminHue: number;\n\tmaxHue: number;\n}\n\n/**\n * Golden ratio for mathematically pleasing color distribution\n * Used to generate evenly spaced hues that are visually distinct\n */\nconst GOLDEN_RATIO = 0.618033988749;\n\n/**\n * Minimum perceptual distance between colors to ensure visual distinction\n * Based on weighted HSL distance calculation optimized for chart readability\n */\nconst MIN_COLOR_DISTANCE = 25;\n\n/**\n * Maximum attempts to find a sufficiently different color\n * Prevents infinite loops while allowing reasonable search space\n */\nconst MAX_COLOR_GENERATION_ATTEMPTS = 50;\n\n/**\n * Color variation attempt offset\n * Small increment to explore slightly different color variations per attempt\n */\nconst VARIATION_ATTEMPT_OFFSET = 0.1;\n\n// Saturation configuration for generated colors\n\n/**\n * Base saturation percentage for generated colors\n * 45% provides muted, professional colors without being washed out\n */\nconst BASE_SATURATION = 45;\n\n/**\n * Number of saturation variation steps\n * Creates 3 different saturation levels for variety\n */\nconst SATURATION_VARIATION_STEPS = 3;\n\n/**\n * Saturation increment per variation step\n * 10% increments provide subtle variation while keeping colors muted\n * Results in saturation levels: 45%, 55%, 65%\n */\nconst SATURATION_INCREMENT = 10;\n\n// Lightness configuration for WCAG AA accessibility compliance\n\n/**\n * Base lightness percentage for generated colors\n * 35% ensures sufficient contrast against white backgrounds for WCAG AA compliance\n * WCAG AA requires 4.5:1 contrast ratio for normal text\n */\nconst BASE_LIGHTNESS = 35;\n\n/**\n * Number of lightness variation steps\n * Creates 4 different lightness levels for variety\n */\nconst LIGHTNESS_VARIATION_STEPS = 4;\n\n/**\n * Lightness increment per variation step\n * 8% increments provide subtle lightness variation while maintaining accessibility\n * Results in lightness levels: 35%, 43%, 51%, 59%\n * All levels maintain WCAG AA compliance against white backgrounds\n */\nconst LIGHTNESS_INCREMENT = 8;\n\n// Hue range expansion and constraints\n\n/**\n * Minimum hue range in degrees to ensure sufficient color variety\n * 60 degrees provides reasonable color spread even for narrow palettes\n */\nconst MIN_HUE_RANGE_DEGREES = 60;\n\n/**\n * Hue range expansion factor\n * 1.3x expansion provides slightly more variety than the original palette\n */\nconst HUE_RANGE_EXPANSION_FACTOR = 1.3;\n\n/**\n * Threshold for detecting hue wrap-around (color wheel boundary crossing)\n * 180 degrees indicates the colors span more than half the color wheel\n */\nconst HUE_WRAP_THRESHOLD_DEGREES = 180;\n\n/**\n * Full color wheel rotation in degrees\n */\nconst FULL_HUE_ROTATION_DEGREES = 360;\n\n/**\n * Factor for single color hue range\n */\nconst SINGLE_COLOR_HUE_RANGE_FACTOR = 0.33;\n\n/**\n * Get a color from the colors array or generate a new color using the golden ratio\n *\n * @param index - the index of the color to get\n * @param colorCache - pre-computed color data for performance\n * @return a color from the colors array or a new color using the golden ratio\n */\nexport const getChartColor = ( index: number, colorCache: ColorCache ): string => {\n\tconst {\n\t\tcolors,\n\t\thues,\n\t\texistingHslColors,\n\t\tminHue: cachedMinHue,\n\t\tmaxHue: cachedMaxHue,\n\t} = colorCache;\n\n\tif ( index < colors.length ) {\n\t\treturn colors[ index ];\n\t}\n\n\tlet minHue = cachedMinHue;\n\tlet maxHue = cachedMaxHue;\n\n\t// Generate additional colors using golden ratio, avoiding similar colors\n\tfor ( let attempt = 0; attempt < MAX_COLOR_GENERATION_ATTEMPTS; attempt++ ) {\n\t\t// Calculate hue using golden ratio distribution with variation per attempt\n\t\t// Formula: ((base_index + attempt_variation) * golden_ratio * 360°) mod 360°\n\t\t// This ensures mathematically pleasing spacing while allowing slight shifts per attempt\n\t\tlet hue =\n\t\t\t( ( index - colors.length + attempt * VARIATION_ATTEMPT_OFFSET ) *\n\t\t\t\tGOLDEN_RATIO *\n\t\t\t\tFULL_HUE_ROTATION_DEGREES ) %\n\t\t\tFULL_HUE_ROTATION_DEGREES;\n\n\t\t// If we have existing colors, constrain new colors to their hue range\n\t\tif ( hues.length > 0 ) {\n\t\t\t// Handle hue wrap-around (e.g., if colors span across 0 degrees)\n\t\t\tlet hueRange = maxHue - minHue;\n\n\t\t\t// If there's only one color, use a set hue range for limited variety\n\t\t\tif ( hues.length === 1 ) {\n\t\t\t\thueRange = FULL_HUE_ROTATION_DEGREES * SINGLE_COLOR_HUE_RANGE_FACTOR;\n\t\t\t} else if ( hueRange > HUE_WRAP_THRESHOLD_DEGREES ) {\n\t\t\t\t// If the range is very large, it might be wrapping around the color wheel\n\t\t\t\t// Check if a smaller range exists when considering wrap-around\n\t\t\t\tconst altMinHue = Math.min( ...hues.filter( h => h > HUE_WRAP_THRESHOLD_DEGREES ) );\n\t\t\t\tconst altMaxHue =\n\t\t\t\t\tMath.max( ...hues.filter( h => h < HUE_WRAP_THRESHOLD_DEGREES ) ) +\n\t\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t\t\tconst altRange = altMaxHue - altMinHue;\n\n\t\t\t\tif ( altRange < hueRange ) {\n\t\t\t\t\tminHue = altMinHue;\n\t\t\t\t\tmaxHue = altMaxHue;\n\t\t\t\t\thueRange = altRange;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Expand the range slightly to provide some variation\n\t\t\tconst expandedRange = Math.max(\n\t\t\t\thueRange * HUE_RANGE_EXPANSION_FACTOR,\n\t\t\t\tMIN_HUE_RANGE_DEGREES\n\t\t\t);\n\t\t\tconst rangeCenter = ( minHue + maxHue ) / 2;\n\t\t\tconst expandedMin = rangeCenter - expandedRange / 2;\n\n\t\t\t// Map the generated hue to the expanded range\n\t\t\thue = expandedMin + ( hue / FULL_HUE_ROTATION_DEGREES ) * expandedRange;\n\n\t\t\t// Normalize to 0-360 range\n\t\t\thue =\n\t\t\t\t( ( hue % FULL_HUE_ROTATION_DEGREES ) + FULL_HUE_ROTATION_DEGREES ) %\n\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t}\n\n\t\tconst saturation =\n\t\t\tBASE_SATURATION + ( ( index + attempt ) % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\t\tconst lightness =\n\t\t\tBASE_LIGHTNESS + ( ( index + attempt ) % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\n\t\tconst candidateHsl: [ number, number, number ] = [ hue, saturation, lightness ];\n\n\t\t// Check if this color is sufficiently different from existing colors\n\t\tlet isSufficientlyDifferent = true;\n\t\tfor ( const existingHsl of existingHslColors ) {\n\t\t\tif ( getColorDistance( candidateHsl, existingHsl ) < MIN_COLOR_DISTANCE ) {\n\t\t\t\tisSufficientlyDifferent = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( isSufficientlyDifferent ) {\n\t\t\t// d3-color uses 0-1 scale for saturation and lightness\n\t\t\treturn d3Hsl( Math.round( hue ), saturation / 100, lightness / 100 ).formatHex();\n\t\t}\n\t}\n\n\t// Fallback if we couldn't find a sufficiently different color\n\t// Formula: ((base_index) * golden_ratio * 360°) mod 360°\n\t// This ensures mathematically pleasing spacing while maintaining consistency\n\tconst fallbackHue =\n\t\t( ( index - colors.length ) * GOLDEN_RATIO * FULL_HUE_ROTATION_DEGREES ) %\n\t\tFULL_HUE_ROTATION_DEGREES;\n\tconst fallbackSaturation =\n\t\tBASE_SATURATION + ( index % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\tconst fallbackLightness =\n\t\tBASE_LIGHTNESS + ( index % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\t// d3-color uses 0-1 scale for saturation and lightness\n\treturn d3Hsl(\n\t\tMath.round( fallbackHue ),\n\t\tfallbackSaturation / 100,\n\t\tfallbackLightness / 100\n\t).formatHex();\n};\n","import type { CompleteChartTheme } from '../../types';\n\n/**\n * Default theme configuration\n */\nconst defaultTheme: CompleteChartTheme = {\n\tbackgroundColor: '#FFFFFF', // chart background color\n\tlabelBackgroundColor: 'transparent', // label background color (transparent by default)\n\tlabelTextColor: '#FFFFFF', // label text color (white to match original behavior)\n\tcolors: [ '#98C8DF', '#006DAB', '#A6DC80', '#1F9828', '#FF8C8F' ],\n\tgridStyles: {\n\t\tstroke: '#DCDCDE',\n\t\tstrokeWidth: 1,\n\t},\n\ttickLength: 4,\n\tgridColor: '',\n\tgridColorDark: '',\n\txTickLineStyles: { stroke: 'black' },\n\txAxisLineStyles: { stroke: '#DCDCDE', strokeWidth: 1 },\n\tlegend: {\n\t\tlabelStyles: {\n\t\t\tcolor: 'var(--jp-gray-80, #2c3338)',\n\t\t},\n\t\tcontainerStyles: {},\n\t\tshapeStyles: [],\n\t},\n\tseriesLineStyles: [],\n\tglyphs: [],\n\t// `fontFamily: 'inherit'` overrides visx's hardcoded default font stack\n\t// (`-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif`)\n\t// that `buildChartTheme` injects as an inline style on SVG `<text>`\n\t// elements for axis labels and ticks. Setting `inherit` lets SVG text\n\t// pick up the host application's font-family via normal CSS inheritance.\n\tsvgLabelSmall: { fill: 'var(--jp-gray-80, #2c3338)', fontFamily: 'inherit' },\n\tsvgLabelBig: { fontFamily: 'inherit' },\n\tannotationStyles: {\n\t\tlabel: {\n\t\t\tanchorLineStroke: 'var(--jp-gray-80, #2c3338)',\n\t\t\tbackgroundFill: '#fff',\n\t\t},\n\t\tconnector: {\n\t\t\tstroke: 'var(--jp-gray-80, #2c3338)',\n\t\t},\n\t\tcircleSubject: {\n\t\t\tstroke: 'transparent',\n\t\t\tfill: 'var(--jp-gray-80, #2c3338)',\n\t\t\tradius: 5,\n\t\t},\n\t},\n\tgeoChart: {\n\t\tfeatureFillColor: 'var(--jp-gray-0, #f6f7f7)',\n\t},\n\tleaderboardChart: {\n\t\trowGap: 12,\n\t\tcolumnGap: 4,\n\t\tlabelSpacing: 'xs',\n\t\tdeltaColors: [ '#FF8C8F', '#757575', '#1F9828' ], // [negative, neutral, positive]\n\t},\n\tconversionFunnelChart: {\n\t\tbackgroundColor: '#F3F4F6',\n\t\tpositiveChangeColor: '#1F9828',\n\t\tnegativeChangeColor: '#FF8C8F',\n\t},\n\tlineChart: {\n\t\tlineStyles: {\n\t\t\tcomparison: {\n\t\t\t\tstrokeDasharray: '4 4',\n\t\t\t\tstrokeLinecap: 'square',\n\t\t\t},\n\t\t},\n\t},\n\tbarChart: {\n\t\tbarStyles: {\n\t\t\tcomparison: {\n\t\t\t\twidthFactor: 1.5,\n\t\t\t\topacity: 0.5,\n\t\t\t},\n\t\t},\n\t},\n\tsparkline: {\n\t\tmargin: { top: 2, right: 2, bottom: 2, left: 2 },\n\t\tstrokeWidth: 1.5,\n\t},\n};\n\nexport { defaultTheme };\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n} from 'react';\nimport {\n\tgetItemShapeStyles,\n\tgetSeriesBarStyles,\n\tgetSeriesLineStyles,\n\tmergeThemes,\n\tresolveCssVariable,\n\tnormalizeColorToHex,\n} from '../../utils';\nimport { getChartColor, type ColorCache } from './private/get-chart-color';\nimport { defaultTheme } from './themes';\nimport type { GlobalChartsContextValue, ChartRegistration } from './types';\nimport type { ChartTheme, CompleteChartTheme } from '../../types';\nimport type { FC, ReactNode } from 'react';\n\nexport const GlobalChartsContext = createContext< GlobalChartsContextValue | null >( null );\n\nexport interface GlobalChartsProviderProps {\n\tchildren: ReactNode;\n\ttheme?: Partial< ChartTheme >;\n}\n\nexport const GlobalChartsProvider: FC< GlobalChartsProviderProps > = ( { children, theme } ) => {\n\tconst [ charts, setCharts ] = useState< Map< string, ChartRegistration > >( () => new Map() );\n\t// Track hidden series per chart: chartId -> Set<seriesLabel>\n\tconst [ hiddenSeries, setHiddenSeries ] = useState< Map< string, Set< string > > >(\n\t\t() => new Map()\n\t);\n\n\t// Ref to the wrapper element for resolving scoped CSS variables\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst providerTheme: CompleteChartTheme = useMemo( () => {\n\t\treturn theme ? mergeThemes( defaultTheme, theme ) : defaultTheme;\n\t}, [ theme ] );\n\n\t// Cache expensive color computations that only change when theme colors change\n\t// Using useState + useLayoutEffect instead of useMemo to ensure CSS variables\n\t// in <style> tags are applied to the DOM before we try to resolve them\n\tconst [ colorCache, setColorCache ] = useState< ColorCache >( () => ( {\n\t\tcolors: [],\n\t\thues: [],\n\t\texistingHslColors: [],\n\t\tminHue: 360,\n\t\tmaxHue: 0,\n\t} ) );\n\n\t// Track if the color palette has been resolved from the DOM\n\t// Useful for animations that should only run after the color palette is resolved\n\tconst [ isColorPaletteResolved, setIsColorPaletteResolved ] = useState( false );\n\n\t// Compute color cache after DOM is updated (so CSS variables are available)\n\t// Resolves CSS variables from the wrapper element's scope to handle scoped variables\n\t// Note: Only re-runs when providerTheme changes, not when wrapper element changes.\n\t// This is intentional, as wrapperRef is expected to be stable for the lifetime of the provider.\n\tuseLayoutEffect( () => {\n\t\tsetIsColorPaletteResolved( false );\n\t\tconst { colors } = providerTheme;\n\t\tconst resolvedColors: string[] = [];\n\t\tconst hues: number[] = [];\n\t\tconst existingHslColors: Array< [ number, number, number ] > = [];\n\t\tlet minHue = 360;\n\t\tlet maxHue = 0;\n\n\t\t// Process all colors once and cache the results\n\t\tif ( Array.isArray( colors ) ) {\n\t\t\tfor ( const color of colors ) {\n\t\t\t\tif ( color && typeof color === 'string' ) {\n\t\t\t\t\t// Normalize color to hex format, handling CSS variables, RGB, HSL, etc.\n\t\t\t\t\t// This uses normalizeColorToHex which resolves CSS variables and converts\n\t\t\t\t\t// rgb(), rgba(), hsl() formats to hex\n\t\t\t\t\tconst normalizedColor = normalizeColorToHex(\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\twrapperRef.current,\n\t\t\t\t\t\tresolveCssVariable\n\t\t\t\t\t);\n\n\t\t\t\t\t// Only process valid hex colors\n\t\t\t\t\tif ( normalizedColor.startsWith( '#' ) ) {\n\t\t\t\t\t\tresolvedColors.push( normalizedColor );\n\t\t\t\t\t\tconst hslColor = d3Hsl( normalizedColor );\n\t\t\t\t\t\t// d3Hsl returns NaN values for invalid colors\n\t\t\t\t\t\tif ( ! isNaN( hslColor.h ) ) {\n\t\t\t\t\t\t\tconst hslTuple: [ number, number, number ] = [\n\t\t\t\t\t\t\t\thslColor.h,\n\t\t\t\t\t\t\t\thslColor.s * 100,\n\t\t\t\t\t\t\t\thslColor.l * 100,\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\thues.push( hslTuple[ 0 ] );\n\t\t\t\t\t\t\texistingHslColors.push( hslTuple );\n\t\t\t\t\t\t\tminHue = Math.min( minHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t\tmaxHue = Math.max( maxHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetColorCache( {\n\t\t\tcolors: resolvedColors,\n\t\t\thues,\n\t\t\texistingHslColors,\n\t\t\tminHue,\n\t\t\tmaxHue,\n\t\t} );\n\t}, [ providerTheme ] );\n\n\tuseEffect( () => {\n\t\tif ( colorCache.colors.length > 0 ) {\n\t\t\tsetIsColorPaletteResolved( true );\n\t\t}\n\t}, [ colorCache ] );\n\n\tconst [ groupToColorMap, setGroupToColorMap ] = useState< Map< string, string > >(\n\t\t() => new Map()\n\t);\n\n\t// Reset group color mappings when theme colors change\n\tuseEffect( () => {\n\t\t// Create a completely new Map instance to trigger dependencies, e.g. useChartLegendItems\n\t\tsetGroupToColorMap( new Map() );\n\t}, [ providerTheme.colors ] );\n\n\tconst registerChart = useCallback( ( id: string, data: ChartRegistration ) => {\n\t\tsetCharts( prev => new Map( prev ).set( id, data ) );\n\t}, [] );\n\n\tconst unregisterChart = useCallback( ( id: string ) => {\n\t\tsetCharts( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tnewMap.delete( id );\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst getChartData = useCallback(\n\t\t( id: string ) => {\n\t\t\treturn charts.get( id );\n\t\t},\n\t\t[ charts ]\n\t);\n\n\tconst resolveColor = useCallback(\n\t\t( {\n\t\t\tgroup,\n\t\t\tindex,\n\t\t\toverrideColor,\n\t\t}: {\n\t\t\tgroup?: string;\n\t\t\tindex: number;\n\t\t\toverrideColor?: string;\n\t\t} ): string => {\n\t\t\t// Highest precedence: eg. explicit series stroke or chart color prop\n\t\t\tif ( overrideColor ) {\n\t\t\t\treturn normalizeColorToHex( overrideColor, wrapperRef.current, resolveCssVariable );\n\t\t\t}\n\n\t\t\t// If group provided, maintain a stable assignment\n\t\t\tif ( group ) {\n\t\t\t\tconst existing = groupToColorMap.get( group );\n\n\t\t\t\tif ( existing ) {\n\t\t\t\t\treturn existing;\n\t\t\t\t}\n\n\t\t\t\t// Use map size as index to assign colors sequentially (0, 1, 2...)\n\t\t\t\t// ensuring each new group gets the next available palette color\n\t\t\t\tconst assignedCount = groupToColorMap.size;\n\t\t\t\tconst color = getChartColor( assignedCount, colorCache );\n\t\t\t\tgroupToColorMap.set( group, color );\n\n\t\t\t\treturn color;\n\t\t\t}\n\n\t\t\treturn getChartColor( index, colorCache );\n\t\t},\n\t\t[ colorCache, groupToColorMap ]\n\t);\n\n\tconst getElementStyles = useCallback< GlobalChartsContextValue[ 'getElementStyles' ] >(\n\t\t( { data, index, overrideColor, legendShape } ) => {\n\t\t\tconst isSeriesData = data && typeof data === 'object' && 'data' in data && 'options' in data;\n\t\t\t// DataPointPercentage has a numeric 'value' directly, unlike SeriesData which has 'data' array\n\t\t\tconst isPointPercentageData =\n\t\t\t\tdata &&\n\t\t\t\ttypeof data === 'object' &&\n\t\t\t\t'value' in data &&\n\t\t\t\ttypeof data.value === 'number' &&\n\t\t\t\t! ( 'data' in data );\n\n\t\t\treturn {\n\t\t\t\tcolor: resolveColor( {\n\t\t\t\t\tgroup: data?.group,\n\t\t\t\t\tindex,\n\t\t\t\t\toverrideColor:\n\t\t\t\t\t\toverrideColor ||\n\t\t\t\t\t\t( isSeriesData && data?.options?.stroke ) ||\n\t\t\t\t\t\t( isPointPercentageData && data?.color ),\n\t\t\t\t} ),\n\t\t\t\tlineStyles: isSeriesData ? getSeriesLineStyles( data, index, providerTheme ) : {},\n\t\t\t\tbarStyles: isSeriesData ? getSeriesBarStyles( data, index, providerTheme ) : {},\n\t\t\t\tglyph: providerTheme.glyphs?.[ index ],\n\t\t\t\tshapeStyles: isSeriesData\n\t\t\t\t\t? getItemShapeStyles( data, index, providerTheme, legendShape )\n\t\t\t\t\t: {},\n\t\t\t};\n\t\t},\n\t\t[ providerTheme, resolveColor ]\n\t);\n\n\t// Series visibility management methods\n\tconst toggleSeriesVisibility = useCallback( ( chartId: string, seriesLabel: string ) => {\n\t\tsetHiddenSeries( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tconst chartHidden = newMap.get( chartId ) || new Set();\n\t\t\tconst newSet = new Set( chartHidden );\n\n\t\t\tif ( newSet.has( seriesLabel ) ) {\n\t\t\t\tnewSet.delete( seriesLabel );\n\t\t\t} else {\n\t\t\t\tnewSet.add( seriesLabel );\n\t\t\t}\n\n\t\t\tif ( newSet.size === 0 ) {\n\t\t\t\tnewMap.delete( chartId );\n\t\t\t} else {\n\t\t\t\tnewMap.set( chartId, newSet );\n\t\t\t}\n\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst isSeriesVisible = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tconst chartHidden = hiddenSeries.get( chartId );\n\t\t\treturn ! chartHidden || ! chartHidden.has( seriesLabel );\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst getHiddenSeries = useCallback(\n\t\t( chartId: string ): Set< string > => {\n\t\t\tconst set = hiddenSeries.get( chartId );\n\t\t\treturn set ? new Set( set ) : new Set< string >();\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst value: GlobalChartsContextValue = useMemo(\n\t\t() => ( {\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\ttheme: providerTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t} ),\n\t\t[\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\tproviderTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t]\n\t);\n\n\treturn (\n\t\t<GlobalChartsContext.Provider value={ value }>\n\t\t\t<div ref={ wrapperRef } style={ { display: 'contents' } }>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</GlobalChartsContext.Provider>\n\t);\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport type { GlobalChartsContextValue } from '../types';\n\nexport const useGlobalChartsContext = (): GlobalChartsContextValue => {\n\tconst context = useContext( GlobalChartsContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useGlobalChartsContext must be used within a GlobalChartsProvider' );\n\t}\n\treturn context;\n};\n","import { useId } from 'react';\n\nexport const useChartId = ( providedId?: string ): string => {\n\tconst generatedId = useId();\n\treturn providedId || generatedId;\n};\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import isEqual from 'fast-deep-equal';\nimport { useRef } from 'react';\n\n/**\n * Custom hook to memoize a value using deep equality comparison.\n * Prevents unnecessary re-renders when objects have the same content but different references.\n *\n * @param value - The value to memoize with deep equality comparison\n * @return The memoized value that only changes when deeply different\n */\nexport const useDeepMemo = < T >( value: T ): T => {\n\tconst ref = useRef< T >( value );\n\n\tif ( ! isEqual( ref.current, value ) ) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n};\n","import { buildChartTheme } from '@visx/xychart';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../providers';\nimport type { SeriesData } from '../types';\n\nexport const useXYChartTheme = ( data: SeriesData[] ) => {\n\tconst theme = useGlobalChartsTheme();\n\n\treturn useMemo( () => {\n\t\tconst seriesColors = ( data ?? [] )\n\t\t\t.map( series => series.options?.stroke )\n\t\t\t.filter( ( color ): color is string => Boolean( color ) );\n\n\t\treturn buildChartTheme( {\n\t\t\t...theme,\n\t\t\tcolors: [ ...seriesColors, ...( theme.colors ?? [] ) ],\n\t\t} );\n\t}, [ theme, data ] );\n};\n","import { useMemo } from 'react';\nimport { parseAsLocalDate } from '../utils';\nimport type { SeriesData } from '../types';\n\n/**\n * Hook that transforms and sorts chart data, handling date parsing and sorting\n *\n * This hook extracts the common data transformation logic used in both line-chart\n * and bar-chart components. It:\n * 1. Parses date strings into Date objects using parseAsLocalDate\n * 2. Sorts data points by date when date properties are present\n * 3. Returns the original data unchanged when no date properties are found\n *\n * @param {SeriesData[]} data - The raw chart data to transform\n * @return {SeriesData[]} The transformed and sorted data\n */\nexport const useChartDataTransform = ( data: SeriesData[] ) => {\n\treturn useMemo( () => {\n\t\t// Check if the first data point has date or dateString properties\n\t\tconst firstPoint = data?.[ 0 ]?.data?.[ 0 ];\n\t\tconst hasDateProperties = firstPoint && ( 'date' in firstPoint || 'dateString' in firstPoint );\n\n\t\t// If no date properties found, return data unchanged\n\t\tif ( ! hasDateProperties ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Transform and sort data with date properties\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data\n\t\t\t\t.map( point => {\n\t\t\t\t\tlet date: Date | undefined;\n\n\t\t\t\t\tif ( 'date' in point && point.date ) {\n\t\t\t\t\t\tdate = point.date;\n\t\t\t\t\t} else if ( 'dateString' in point && point.dateString ) {\n\t\t\t\t\t\tdate = parseAsLocalDate( point.dateString );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.sort( ( a, b ) => {\n\t\t\t\t\tif ( ! a.date || ! b.date ) return 0;\n\t\t\t\t\treturn a.date.getTime() - b.date.getTime();\n\t\t\t\t} ),\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { createScale, getTicks } from '@visx/scale';\nimport { useMemo } from 'react';\nimport { getLongestTickWidth, resolveFontSize } from '../utils';\nimport type { BaseChartProps, DataPointDate, SeriesData } from '../types';\nimport type { XYChartTheme } from '@visx/xychart';\n\n/**\n * Base top margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_TOP = 10;\n\n/**\n * Base right margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_RIGHT = 20;\n\n/**\n * Base bottom margin used for charts with a bottom X-axis.\n * This is large enough for typical font sizes and will be increased\n * dynamically when tick labels require more space.\n */\nconst DEFAULT_MARGIN_BOTTOM = 20;\n\n/**\n * Base left margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_LEFT = 20;\n\n/**\n * Bottom margin to use when the X-axis is rendered at the top.\n * We only need a small buffer below the chart in that case.\n */\nconst DEFAULT_BOTTOM_FOR_TOP_AXIS = 10;\n\n/**\n * Fallback font size used when we cannot derive a font size\n * from the theme or axis styles for X-axis tick labels.\n */\nconst DEFAULT_FONT_SIZE = 12;\n\n/**\n * Fallback tick length used when tickLength is not provided\n * by the theme for either axis.\n */\nconst DEFAULT_TICK_LENGTH = 8;\n\n/**\n * Fallback width used for Y-axis tick labels when we cannot\n * measure them via getLongestTickWidth.\n */\nconst DEFAULT_Y_TICK_WIDTH = 40;\n\nconst getXAxisLabelMetrics = ( theme: XYChartTheme, orientation: 'top' | 'bottom' ) => {\n\tconst xAxisStyles =\n\t\torientation === 'top' ? theme.axisStyles?.x?.top : theme.axisStyles?.x?.bottom;\n\n\tconst fontSize =\n\t\tresolveFontSize( xAxisStyles?.axisLabel?.fontSize ) ||\n\t\tresolveFontSize( theme.svgLabelSmall?.fontSize ) ||\n\t\tDEFAULT_FONT_SIZE;\n\n\tconst tickLength = xAxisStyles?.tickLength ?? DEFAULT_TICK_LENGTH;\n\n\treturn { fontSize, tickLength };\n};\n\nexport const useChartMargin = (\n\theight: number,\n\toptions: BaseChartProps[ 'options' ],\n\tdata: SeriesData[],\n\ttheme: XYChartTheme,\n\thorizontal: boolean = false\n) => {\n\tconst yTicks = useMemo( () => {\n\t\tconst allDataPoints = data.flatMap( series => series.data as DataPointDate[] );\n\n\t\tif ( horizontal ) {\n\t\t\t// When horizontal, y ticks renders fixed tick labels.\n\t\t\treturn allDataPoints.map(\n\t\t\t\td => d.label || options.axis?.y?.tickFormat( d.date.getTime(), 0, [] )\n\t\t\t);\n\t\t}\n\n\t\tif ( options.axis?.y?.tickValues?.length ) {\n\t\t\treturn options.axis.y.tickValues;\n\t\t}\n\n\t\tconst minY = Math.min( ...allDataPoints.map( d => d.value ) );\n\t\tconst maxY = Math.max( ...allDataPoints.map( d => d.value ) );\n\t\tconst yScale = createScale( {\n\t\t\t...options.yScale,\n\t\t\tdomain: [ minY, maxY ],\n\t\t\trange: [ height, 0 ],\n\t\t} );\n\n\t\treturn getTicks( yScale, options.axis?.y?.numTicks );\n\t}, [ options, data, height, horizontal ] );\n\n\treturn useMemo( () => {\n\t\t// Default margin is for bottom axis labels.\n\t\tconst defaultMargin = {\n\t\t\ttop: DEFAULT_MARGIN_TOP,\n\t\t\tright: DEFAULT_MARGIN_RIGHT,\n\t\t\tbottom: DEFAULT_MARGIN_BOTTOM,\n\t\t\tleft: DEFAULT_MARGIN_LEFT,\n\t\t};\n\n\t\t// Auto-calculate margin for y axis labels based on orientation and tick width.\n\t\tconst yAxisOrientation = options.axis?.y?.orientation;\n\t\tconst yAxisStyles =\n\t\t\tyAxisOrientation === 'right' ? theme.axisStyles.y.right : theme.axisStyles.y.left;\n\t\tconst yTickWidth = getLongestTickWidth(\n\t\t\tyTicks,\n\t\t\toptions.axis?.y?.tickFormat,\n\t\t\tyAxisStyles.axisLabel\n\t\t);\n\t\tconst yMarginValue = ( yTickWidth ?? DEFAULT_Y_TICK_WIDTH ) + ( yAxisStyles?.tickLength ?? 0 );\n\n\t\tif ( yAxisOrientation === 'right' ) {\n\t\t\tdefaultMargin.right = yMarginValue;\n\t\t} else {\n\t\t\tdefaultMargin.left = yMarginValue;\n\t\t}\n\n\t\t// Dynamically compute X-axis margin (bottom by default, or top if orientation is 'top').\n\t\t// This mirrors Y-axis behavior where margin is based on label size and tick length,\n\t\t// but keeps the padding minimal so consumers can control container spacing themselves.\n\t\tconst xOrientation = options.axis?.x?.orientation === 'top' ? 'top' : 'bottom';\n\t\tconst { fontSize, tickLength } = getXAxisLabelMetrics( theme, xOrientation );\n\t\tconst computedXMargin = fontSize + tickLength;\n\n\t\tif ( xOrientation === 'top' ) {\n\t\t\tdefaultMargin.top = Math.max( defaultMargin.top, computedXMargin );\n\t\t\tdefaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;\n\t\t} else {\n\t\t\tdefaultMargin.bottom = Math.max( defaultMargin.bottom, computedXMargin );\n\t\t}\n\n\t\treturn defaultMargin;\n\t}, [ options, theme, yTicks ] );\n};\n","import { useState, useCallback, useRef } from 'react';\n\n/**\n * Hook to measure the width and height of a DOM element.\n * Returns a ref callback to attach to the element and the current dimensions in pixels.\n *\n * @param {object} props - Optional props.\n * @param {number} props.initialWidth - The initial width to use.\n * @param {number} props.initialHeight - The initial height to use.\n *\n * @return {[Function, number, number]} A tuple containing a ref callback, width, and height in pixels\n */\nexport function useElementSize< T extends HTMLElement = HTMLDivElement >( {\n\tinitialWidth = 0,\n\tinitialHeight = 0,\n}: {\n\tinitialWidth?: number;\n\tinitialHeight?: number;\n} = {} ): [ ( node: T | null ) => void, number, number ] {\n\tconst [ width, setWidth ] = useState( initialWidth );\n\tconst [ height, setHeight ] = useState( initialHeight );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback( ( node: T | null ) => {\n\t\tif ( observerRef.current ) {\n\t\t\tobserverRef.current.disconnect();\n\t\t\tobserverRef.current = null;\n\t\t}\n\t\tif ( node ) {\n\t\t\tconst handleResize = () => {\n\t\t\t\tconst rect = node.getBoundingClientRect();\n\t\t\t\tsetWidth( rect.width || 0 );\n\t\t\t\tsetHeight( rect.height || 0 );\n\t\t\t};\n\t\t\thandleResize();\n\t\t\tconst resizeObserver = new ResizeObserver( handleResize );\n\t\t\tresizeObserver.observe( node );\n\t\t\tobserverRef.current = resizeObserver;\n\t\t}\n\t}, [] );\n\n\treturn [ refCallback, width, height ];\n}\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * Hook to detect if text content is truncated within its container.\n * Uses ResizeObserver to dynamically track changes in element size.\n *\n * @param enabled - Whether truncation detection should be active. Defaults to true.\n * @return A tuple containing:\n * - [0] refCallback: Function to attach to the text element as a ref\n * - [1] isTruncated: Boolean indicating if the text is currently truncated\n *\n * @example\n * ```tsx\n * const [textRef, isTruncated] = useTextTruncation(true);\n *\n * return (\n * <span ref={textRef} title={isTruncated ? fullText : undefined}>\n * {text}\n * </span>\n * );\n * ```\n */\nexport function useTextTruncation(\n\tenabled: boolean = true\n): [ ( node: HTMLElement | null ) => void, boolean ] {\n\tconst [ isTruncated, setIsTruncated ] = useState( false );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\t// Cleanup existing observer\n\t\t\tif ( observerRef.current ) {\n\t\t\t\tobserverRef.current.disconnect();\n\t\t\t\tobserverRef.current = null;\n\t\t\t}\n\n\t\t\tif ( node && enabled ) {\n\t\t\t\tconst checkTruncation = () => {\n\t\t\t\t\t// Check if content width exceeds container width (indicates truncation)\n\t\t\t\t\tconst truncated = node.scrollWidth > node.clientWidth;\n\t\t\t\t\tsetIsTruncated( truncated );\n\t\t\t\t};\n\n\t\t\t\t// Initial check\n\t\t\t\tcheckTruncation();\n\n\t\t\t\t// Watch for size changes\n\t\t\t\tconst resizeObserver = new ResizeObserver( checkTruncation );\n\t\t\t\tresizeObserver.observe( node );\n\t\t\t\tobserverRef.current = resizeObserver;\n\t\t\t} else {\n\t\t\t\tsetIsTruncated( false );\n\t\t\t}\n\t\t},\n\t\t[ enabled ]\n\t);\n\n\treturn [ refCallback, isTruncated ];\n}\n","import { useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../types';\n\nexport type EnhancedDataPoint = DataPointDate & {\n\tvisualValue?: number;\n};\n\nexport interface EnhancedSeriesData extends Omit< SeriesData, 'data' > {\n\tdata: EnhancedDataPoint[];\n}\n\nexport interface UseZeroValueDisplayOptions {\n\tenabled: boolean;\n\t/**\n\t * The pixel length of the value axis (height for vertical charts, width for\n\t * horizontal charts). Used to calculate a minimum visible value that ensures\n\t * zero-value bars are at least MIN_PIXEL_HEIGHT pixels tall along that axis.\n\t */\n\tvalueAxisLength?: number;\n}\n\n/**\n * Minimum pixel size for near-zero bars (non-zero values that would render too small).\n * Using 3px to be visible but not misleading - larger values might look like actual data.\n */\nconst MIN_PIXEL_SIZE = 3;\n\n/**\n * Pixel size for zero-value bars (1px less than near-zero to be visually distinguishable).\n */\nconst ZERO_PIXEL_SIZE = MIN_PIXEL_SIZE - 1;\n\nexport const useZeroValueDisplay = (\n\tdata: SeriesData[],\n\toptions: UseZeroValueDisplayOptions = { enabled: false }\n): SeriesData[] | EnhancedSeriesData[] => {\n\tconst { enabled, valueAxisLength } = options;\n\n\treturn useMemo( () => {\n\t\tif ( ! enabled || ! valueAxisLength || valueAxisLength <= 0 ) return data;\n\n\t\t// Find max absolute value\n\t\tlet maxAbsoluteValue = 0;\n\t\tfor ( const series of data ) {\n\t\t\tfor ( const point of series.data ) {\n\t\t\t\tif ( point.value !== null && point.value !== 0 ) {\n\t\t\t\t\tmaxAbsoluteValue = Math.max( maxAbsoluteValue, Math.abs( point.value ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( maxAbsoluteValue === 0 ) return data;\n\n\t\t// Calculate values that render as specific pixel sizes, clamped to maxAbsoluteValue\n\t\t// to prevent visual distortion when valueAxisLength is very small\n\t\tconst minNonZeroValue = Math.min(\n\t\t\t( MIN_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\t\tconst zeroVisualValue = Math.min(\n\t\t\t( ZERO_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data.map( ( point: DataPointDate ): EnhancedDataPoint => {\n\t\t\t\t// Zero values get a smaller visual representation (2px)\n\t\t\t\tif ( point.value === 0 ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: zeroVisualValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Null values should remain untouched\n\t\t\t\tif ( point.value === null ) {\n\t\t\t\t\treturn point;\n\t\t\t\t}\n\n\t\t\t\tconst absValue = Math.abs( point.value );\n\n\t\t\t\t// Near-zero values that would render below MIN_PIXEL_SIZE get boosted to 3px\n\t\t\t\t// Preserve the sign for negative values\n\t\t\t\tif ( absValue < minNonZeroValue ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: Math.sign( point.value ) * minNonZeroValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn point;\n\t\t\t} ),\n\t\t} ) );\n\t}, [ data, enabled, valueAxisLength ] );\n};\n","import { useMemo } from 'react';\n\ninterface DataPointWithValue {\n\tvalue: number;\n}\n\n/**\n * Hook to calculate percentages from values for chart data.\n * Ensures percentages are always derived from values (single source of truth).\n *\n * @param data - Array of data points with values\n * @return Data with calculated percentages\n */\nexport const useDataWithPercentages = < T extends DataPointWithValue >(\n\tdata: T[]\n): ( T & { percentage: number } )[] => {\n\treturn useMemo( () => {\n\t\tconst totalValue = data.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn data.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { useMemo } from 'react';\n\n/**\n * Data point interface for charts with interactive legends.\n * Requires label for series identification, value for calculations,\n * and percentage (should be pre-calculated by the chart component).\n */\ninterface DataPointWithPercentage {\n\tlabel: string;\n\tvalue: number;\n\tpercentage: number;\n}\n\n/**\n * Parameters for the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataParams< T extends DataPointWithPercentage > {\n\t/** The chart data with pre-calculated percentages */\n\tdata: T[];\n\t/** Unique chart identifier, required for interactive legends */\n\tchartId: string | undefined;\n\t/** Whether interactive legend filtering is enabled */\n\tlegendInteractive: boolean;\n\t/** Function to check if a series is visible in the legend */\n\tisSeriesVisible: ( chartId: string, label: string ) => boolean;\n}\n\n/**\n * Return value from the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataResult< T extends DataPointWithPercentage > {\n\t/** Filtered data array containing only visible segments with recalculated percentages */\n\tvisibleData: T[];\n\t/** Boolean indicating if all segments are hidden */\n\tallSegmentsHidden: boolean;\n\t/**\n\t * Legend data with stable percentage formatting.\n\t * Hidden items keep their original percentage.\n\t * Visible items show recalculated percentages that total 100%.\n\t */\n\tlegendData: T[];\n}\n\n/**\n * Custom hook to filter and recalculate chart data for interactive legends.\n *\n * When interactive legends are enabled, this hook:\n * 1. Filters data to show only visible series based on legend selection\n * 2. Recalculates percentages so visible segments total 100%\n * 3. Tracks whether all segments are hidden to show empty state\n *\n * This is particularly useful for pie charts, donut charts, and semi-circle charts\n * where segment visibility and percentages need to be dynamically adjusted.\n *\n * @example\n * ```tsx\n * const { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData({\n * data: chartData,\n * chartId: 'my-pie-chart',\n * legendInteractive: true,\n * isSeriesVisible: (id, label) => context.isSeriesVisible(id, label),\n * });\n *\n * // Use legendData for creating legend items (shows recalculated percentages)\n * const legendItems = useChartLegendItems(legendData, legendOptions);\n *\n * if (allSegmentsHidden) {\n * return <EmptyState />;\n * }\n *\n * // Use visibleData for rendering the chart (only visible segments)\n * return <PieChart data={visibleData} />;\n * ```\n *\n * @param params - Configuration object for the hook\n * @param params.data - The chart data to filter\n * @param params.chartId - Unique identifier for the chart (required for interactive mode)\n * @param params.legendInteractive - Whether to enable interactive filtering\n * @param params.isSeriesVisible - Function to check series visibility\n * @return Object containing visibleData, allSegmentsHidden flag, and legendData with recalculated percentages\n */\nexport const useInteractiveLegendData = < T extends DataPointWithPercentage >( {\n\tdata,\n\tchartId,\n\tlegendInteractive,\n\tisSeriesVisible,\n}: UseInteractiveLegendDataParams< T > ): UseInteractiveLegendDataResult< T > => {\n\t// Filter and recalculate data for interactive legends\n\t// Note: data should already have percentages calculated by the chart component\n\tconst visibleData = useMemo( () => {\n\t\t// If interactive mode is disabled or no chartId, return data as-is\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Filter to only visible segments based on legend state\n\t\tconst filtered = data.filter( segment => isSeriesVisible( chartId, segment.label ) );\n\n\t\t// If no segments are visible, return empty array\n\t\tif ( filtered.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Recalculate percentages from values so visible segments total 100%\n\t\tconst totalValue = filtered.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn filtered.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all segments are hidden (only relevant in interactive mode)\n\tconst allSegmentsHidden = useMemo( () => {\n\t\treturn legendInteractive && visibleData.length === 0;\n\t}, [ legendInteractive, visibleData ] );\n\n\t// Prepare legend data with percentages\n\t// Hidden items keep their original percentage (calculated from all values)\n\t// Visible items show recalculated percentages (totaling 100%)\n\tconst legendData = useMemo( () => {\n\t\tif ( ! legendInteractive || ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Build a Map for O(1) lookups instead of O(n) find() calls\n\t\tconst visibleDataMap = new Map( visibleData.map( d => [ d.label, d ] ) );\n\n\t\treturn data.map( segment => {\n\t\t\tconst isVisible = isSeriesVisible( chartId, segment.label );\n\t\t\tif ( ! isVisible ) {\n\t\t\t\t// Hidden items keep original percentage\n\t\t\t\treturn segment;\n\t\t\t}\n\n\t\t\t// For visible items, get the recalculated percentage from visibleData\n\t\t\treturn visibleDataMap.get( segment.label ) || segment;\n\t\t} );\n\t}, [ data, visibleData, legendInteractive, chartId, isSeriesVisible ] );\n\n\treturn { visibleData, allSegmentsHidden, legendData };\n};\n","import { useState, useEffect } from 'react';\n\n// 'no-preference' returns false in unsupported browsers,\n// causing a safe fallback to reduced motion instead of animating.\nconst QUERY = '(prefers-reduced-motion: no-preference)';\n\nconst getInitialState = () => ! window.matchMedia( QUERY ).matches;\n\n/**\n * Custom hook to determine if the user prefers reduced motion.\n * @return {boolean} A boolean indicating the user's preference for reduced motion.\n */\nexport function usePrefersReducedMotion() {\n\tconst [ prefersReducedMotion, setPrefersReducedMotion ] = useState( getInitialState );\n\n\tuseEffect( () => {\n\t\tconst mediaQueryList = window.matchMedia( QUERY );\n\n\t\tconst listener = event => {\n\t\t\tsetPrefersReducedMotion( ! event.matches );\n\t\t};\n\n\t\tmediaQueryList.addEventListener( 'change', listener );\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener( 'change', listener );\n\t\t};\n\t}, [] );\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { useGlobalChartsContext } from './use-global-charts-context';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { ChartType } from '../../../types';\n\nexport const useChartRegistration = ( {\n\tchartId,\n\tlegendItems,\n\tchartType,\n\tisDataValid,\n\tmetadata,\n}: {\n\tchartId: string;\n\tlegendItems: BaseLegendItem[];\n\tchartType: ChartType;\n\tisDataValid: boolean;\n\tmetadata?: Record< string, unknown >;\n} ): void => {\n\tconst { registerChart, unregisterChart } = useGlobalChartsContext();\n\n\t// Memoize legendItems with deep comparison to prevent infinite loops\n\tconst stableLegendItems = useDeepMemo( legendItems );\n\n\t// Memoize metadata to prevent unnecessary re-renders\n\tconst memoizedMetadata = useMemo( () => metadata, [ metadata ] );\n\n\tuseEffect( () => {\n\t\t// Only register if data is valid\n\t\tif ( isDataValid ) {\n\t\t\tregisterChart( chartId, {\n\t\t\t\tlegendItems: stableLegendItems,\n\t\t\t\tchartType,\n\t\t\t\tmetadata: memoizedMetadata,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tunregisterChart( chartId );\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchartId,\n\t\tstableLegendItems,\n\t\tchartType,\n\t\tmemoizedMetadata,\n\t\tisDataValid,\n\t\t// Removed registerChart and unregisterChart from dependencies\n\t\t// They are stable functions created with useCallback and empty deps\n\t] );\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n/**\n * Hook to get the global chart theme from GlobalChartsProvider\n *\n * @return The global chart theme\n */\nexport const useGlobalChartsTheme = (): CompleteChartTheme => {\n\t// Get context but don't throw if it doesn't exist (for testing or standalone usage)\n\tconst context = useContext( GlobalChartsContext );\n\tconst globalTheme = context?.theme;\n\n\treturn globalTheme ?? defaultTheme;\n};\n","export function mergeObjects(a, b) {\n if (a && !b) {\n return a;\n }\n if (!a && b) {\n return b;\n }\n if (a || b) {\n return {\n ...a,\n ...b\n };\n }\n return undefined;\n}","import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}","/**\n * Creates a formatErrorMessage function with a custom URL and prefix.\n * @param baseUrl - The base URL for the error page (e.g., 'https://base-ui.com/production-error')\n * @param prefix - The prefix for the error message (e.g., 'Base UI')\n * @returns A function that formats error messages with the given URL and prefix\n */\nexport function createFormatErrorMessage(baseUrl, prefix) {\n return function formatErrorMessage(code, ...args) {\n const url = new URL(baseUrl);\n url.searchParams.set('code', code.toString());\n args.forEach(arg => url.searchParams.append('args[]', arg));\n return `${prefix} error #${code}; visit ${url} for the full message.`;\n };\n}\n\n/**\n * WARNING: Don't import this directly. It's imported by the code generated by\n * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`\n * constructors to ensure the plugin works as expected. Supported patterns include:\n * throw new Error('My message');\n * throw new Error(`My message: ${foo}`);\n * throw new Error(`My message: ${foo}` + 'another string');\n * ...\n */\nconst formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');\nexport default formatErrorMessage;","'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}","import { useRefWithInit } from \"./useRefWithInit.js\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}","import * as React from 'react';\nconst majorVersion = parseInt(React.version, 10);\nexport function isReactVersionAtLeast(reactVersionToCheck) {\n return majorVersion >= reactVersionToCheck;\n}","import * as React from 'react';\nimport { isReactVersionAtLeast } from \"./reactVersion.js\";\n\n/**\n * Extracts the `ref` from a React element, handling different React versions.\n */\nexport function getReactElementRef(element) {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n return null;\n }\n const reactElement = element;\n const propsWithRef = reactElement.props;\n return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;\n}","let set;\nif (process.env.NODE_ENV !== 'production') {\n set = new Set();\n}\nexport function warn(...messages) {\n if (process.env.NODE_ENV !== 'production') {\n const messageKey = messages.join(' ');\n if (!set.has(messageKey)) {\n set.add(messageKey);\n console.warn(`Base UI: ${messageKey}`);\n }\n }\n}","export function NOOP() {}\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});","export function getStateAttributesProps(state, customMapping) {\n const props = {};\n\n /* eslint-disable-next-line guard-for-in */\n for (const key in state) {\n const value = state[key];\n if (customMapping?.hasOwnProperty(key)) {\n const customProps = customMapping[key](value);\n if (customProps != null) {\n Object.assign(props, customProps);\n }\n continue;\n }\n if (value === true) {\n props[`data-${key.toLowerCase()}`] = '';\n } else if (value) {\n props[`data-${key.toLowerCase()}`] = value.toString();\n }\n }\n return props;\n}","/**\n * If the provided className is a string, it will be returned as is.\n * Otherwise, the function will call the className function with the state as the first argument.\n *\n * @param className\n * @param state\n */\nexport function resolveClassName(className, state) {\n return typeof className === 'function' ? className(state) : className;\n}","/**\n * If the provided style is an object, it will be returned as is.\n * Otherwise, the function will call the style function with the state as the first argument.\n *\n * @param style\n * @param state\n */\nexport function resolveStyle(style, state) {\n return typeof style === 'function' ? style(state) : style;\n}","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useMergedRefs, useMergedRefsN } from '@base-ui/utils/useMergedRefs';\nimport { getReactElementRef } from '@base-ui/utils/getReactElementRef';\nimport { mergeObjects } from '@base-ui/utils/mergeObjects';\nimport { warn } from '@base-ui/utils/warn';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getStateAttributesProps } from \"./getStateAttributesProps.js\";\nimport { resolveClassName } from \"../utils/resolveClassName.js\";\nimport { resolveStyle } from \"../utils/resolveStyle.js\";\nimport { mergeProps, mergePropsN, mergeClassNames } from \"../merge-props/index.js\";\nimport { createElement as _createElement } from \"react\";\n/**\n * Renders a Base UI element.\n *\n * @param element The default HTML element to render. Can be overridden by the `render` prop.\n * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored.\n * @param params Additional parameters for rendering the element.\n */\nexport function useRenderElement(element, componentProps, params = {}) {\n const renderProp = componentProps.render;\n const outProps = useRenderElementProps(componentProps, params);\n if (params.enabled === false) {\n return null;\n }\n const state = params.state ?? EMPTY_OBJECT;\n return evaluateRenderProp(element, renderProp, outProps, state);\n}\n\n/**\n * Computes render element final props.\n */\nfunction useRenderElementProps(componentProps, params = {}) {\n const {\n className: classNameProp,\n style: styleProp,\n render: renderProp\n } = componentProps;\n const {\n state = EMPTY_OBJECT,\n ref,\n props,\n stateAttributesMapping,\n enabled = true\n } = params;\n const className = enabled ? resolveClassName(classNameProp, state) : undefined;\n const style = enabled ? resolveStyle(styleProp, state) : undefined;\n const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;\n const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;\n\n // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.\n // This prevents potential TypeError when setting ref, className, or style properties,\n // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.\n const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;\n\n // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,\n // switching between them at runtime is safe. If this assertion fails, React will\n // throw at runtime anyway.\n // This also skips the `useMergedRefs` call on the server, which is fine because\n // refs are not used on the server side.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (typeof document !== 'undefined') {\n if (!enabled) {\n useMergedRefs(null, null);\n } else if (Array.isArray(ref)) {\n outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);\n } else {\n outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);\n }\n }\n if (!enabled) {\n return EMPTY_OBJECT;\n }\n if (className !== undefined) {\n outProps.className = mergeClassNames(outProps.className, className);\n }\n if (style !== undefined) {\n outProps.style = mergeObjects(outProps.style, style);\n }\n return outProps;\n}\nfunction resolveRenderFunctionProps(props) {\n if (Array.isArray(props)) {\n return mergePropsN(props);\n }\n return mergeProps(undefined, props);\n}\n\n// The symbol React uses internally for lazy components\n// https://github.com/facebook/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31\n//\n// TODO delete once https://github.com/facebook/react/issues/32392 is fixed\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\nconst COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;\nconst LOWERCASE_CHARACTER_PATTERN = /[a-z]/;\nfunction evaluateRenderProp(element, render, props, state) {\n if (render) {\n if (typeof render === 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warnIfRenderPropLooksLikeComponent(render);\n }\n return render(props, state);\n }\n const mergedProps = mergeProps(props, render.props);\n mergedProps.ref = props.ref;\n let newElement = render;\n\n // Workaround for https://github.com/facebook/react/issues/32392\n // This works because the toArray() logic unwrap lazy element type in\n // https://github.com/facebook/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/react/src/ReactChildren.js#L186\n if (newElement?.$$typeof === REACT_LAZY_TYPE) {\n const children = React.Children.toArray(render);\n newElement = children[0];\n }\n\n // There is a high number of indirections, the error message thrown by React.cloneElement() is\n // hard to use for developers, this logic provides a better context.\n //\n // Our general guideline is to never change the control flow depending on the environment.\n // However, React.cloneElement() throws if React.isValidElement() is false,\n // so we can throw before with custom message.\n if (process.env.NODE_ENV !== 'production') {\n if (! /*#__PURE__*/React.isValidElement(newElement)) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(['Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.', 'A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.', 'https://base-ui.com/r/invalid-render-prop'].join('\\n'));\n }\n }\n return /*#__PURE__*/React.cloneElement(newElement, mergedProps);\n }\n if (element) {\n if (typeof element === 'string') {\n return renderTag(element, props);\n }\n }\n // Unreachable, but the typings on `useRenderElement` need to be reworked\n // to annotate it correctly.\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: Render element or function are not defined.' : _formatErrorMessage(8));\n}\nfunction warnIfRenderPropLooksLikeComponent(renderFn) {\n const functionName = renderFn.name;\n if (functionName.length === 0) {\n return;\n }\n if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {\n return;\n }\n if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {\n return;\n }\n warn(`The \\`render\\` prop received a function named \\`${functionName}\\` that starts with an uppercase letter.`, 'This usually means a React component was passed directly as `render={Component}`.', 'Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.', 'If this is an intentional render callback, rename it to start with a lowercase letter.', 'Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.', 'https://base-ui.com/r/invalid-render-prop');\n}\nfunction renderTag(Tag, props) {\n if (Tag === 'button') {\n return /*#__PURE__*/_createElement(\"button\", {\n type: \"button\",\n ...props,\n key: props.key\n });\n }\n if (Tag === 'img') {\n return /*#__PURE__*/_createElement(\"img\", {\n alt: \"\",\n ...props,\n key: props.key\n });\n }\n return /*#__PURE__*/React.createElement(Tag, props);\n}","import { useRenderElement } from \"../internals/useRenderElement.js\";\n/**\n * Renders a Base UI element.\n *\n * @public\n */\nexport function useRender(params) {\n return useRenderElement(params.defaultTagName ?? 'div', params, params);\n}","// packages/ui/src/stack/stack.tsx\nimport { useRender, mergeProps } from \"@base-ui/react\";\nimport { forwardRef } from \"@wordpress/element\";\n\n// packages/style-runtime/src/index.ts\nvar STYLE_HASH_ATTRIBUTE = \"data-wp-hash\";\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: /* @__PURE__ */ new Map(),\n styles: /* @__PURE__ */ new Map(),\n injectedStyles: /* @__PURE__ */ new WeakMap()\n };\n if (typeof document !== \"undefined\") {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(\n `style[${STYLE_HASH_ATTRIBUTE}]`\n )) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = /* @__PURE__ */ new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement(\"style\");\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\nfunction registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(\n targetDocument,\n (runtime.documents.get(targetDocument) ?? 0) + 1\n );\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === void 0) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\nfunction registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}\n\n// packages/ui/src/stack/style.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"b51ff41489\", \"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}\");\n}\nvar style_default = { \"stack\": \"_19ce0419607e1896__stack\" };\n\n// packages/ui/src/stack/stack.tsx\nvar gapTokens = {\n xs: \"var(--wpds-dimension-gap-xs, 4px)\",\n sm: \"var(--wpds-dimension-gap-sm, 8px)\",\n md: \"var(--wpds-dimension-gap-md, 12px)\",\n lg: \"var(--wpds-dimension-gap-lg, 16px)\",\n xl: \"var(--wpds-dimension-gap-xl, 24px)\",\n \"2xl\": \"var(--wpds-dimension-gap-2xl, 32px)\",\n \"3xl\": \"var(--wpds-dimension-gap-3xl, 40px)\"\n};\nvar Stack = forwardRef(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {\n const style = {\n gap: gap && gapTokens[gap],\n alignItems: align,\n justifyContent: justify,\n flexDirection: direction,\n flexWrap: wrap\n };\n const element = useRender({\n render,\n ref,\n props: mergeProps(props, { style, className: style_default.stack })\n });\n return element;\n});\nexport {\n Stack\n};\n//# sourceMappingURL=stack.mjs.map\n","// packages/ui/src/text/text.tsx\nimport { useRender, mergeProps } from \"@base-ui/react\";\nimport clsx from \"clsx\";\nimport { forwardRef } from \"@wordpress/element\";\n\n// packages/style-runtime/src/index.ts\nvar STYLE_HASH_ATTRIBUTE = \"data-wp-hash\";\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: /* @__PURE__ */ new Map(),\n styles: /* @__PURE__ */ new Map(),\n injectedStyles: /* @__PURE__ */ new WeakMap()\n };\n if (typeof document !== \"undefined\") {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(\n `style[${STYLE_HASH_ATTRIBUTE}]`\n )) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = /* @__PURE__ */ new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement(\"style\");\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\nfunction registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(\n targetDocument,\n (runtime.documents.get(targetDocument) ?? 0) + 1\n );\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === void 0) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\nfunction registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}\n\n// packages/ui/src/text/style.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"0c8601dd83\", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}');\n}\nvar style_default = { \"text\": \"_83ed8a8da5dd50ea__text\", \"heading-2xl\": \"_14437cfb77831647__heading-2xl\", \"heading-xl\": \"_3c78b7fa9b4072dd__heading-xl\", \"heading-lg\": \"aa58f227716bcde2__heading-lg\", \"heading-md\": \"fc4da56d8dfe52c4__heading-md\", \"heading-sm\": \"a9b78c7c82e8dff7__heading-sm\", \"body-xl\": \"_305ff559e52180d5__body-xl\", \"body-lg\": \"ca1aa3fc2029e958__body-lg\", \"body-md\": \"_131101940be12424__body-md\", \"body-sm\": \"_0e8d87a42c1f75fa__body-sm\" };\n\n// packages/ui/src/utils/css/global-css-defense.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"1fb29d3a3c\", \"._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}\");\n}\nvar global_css_defense_default = { \"button\": \"_6defc79820e382c6__button\", \"input\": \"d2cff2e5dea83bd1__input\", \"textarea\": \"_547d86373d02e108__textarea\", \"div\": \"_8c15fd0ed9f28ba4__div\", \"p\": \"_43cec3e1eec1066d__p\", \"heading\": \"e97669c6d9a38497__heading\", \"a\": \"_2c0831b0499dbd6e__a\" };\n\n// packages/ui/src/text/text.tsx\nvar Text = forwardRef(function Text2({ variant = \"body-md\", render, className, ...props }, ref) {\n const element = useRender({\n render,\n defaultTagName: \"span\",\n ref,\n props: mergeProps(props, {\n className: clsx(\n style_default.text,\n global_css_defense_default.heading,\n global_css_defense_default.p,\n style_default[variant],\n className\n )\n })\n });\n return element;\n});\nexport {\n Text\n};\n//# sourceMappingURL=text.mjs.map\n","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\ttype RefAttributes,\n\ttype ForwardRefExoticComponent,\n\ttype KeyboardEvent,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n} from 'react';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport type { BaseLegendProps } from '../types';\n\nconst ALIGNMENT_TO_FLEX = {\n\tstart: 'flex-start',\n\tcenter: 'center',\n\tend: 'flex-end',\n} as const;\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ( {\n\ttext,\n\ttextOverflow,\n\tmaxWidth,\n}: {\n\ttext: string;\n\ttextOverflow: 'ellipsis' | 'wrap';\n\tmaxWidth?: string;\n} ) => {\n\tconst isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n\tconst [ textRef, isTruncated ] = useTextTruncation( Boolean( isEllipsis ) );\n\n\treturn (\n\t\t<span\n\t\t\tref={ textRef }\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'legend-item-text' ],\n\t\t\t\tmaxWidth != null && styles[ `legend-item-text--${ textOverflow }` ]\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...( maxWidth != null && {\n\t\t\t\t\tmaxWidth,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t} ),\n\t\t\t} }\n\t\t\ttitle={ isEllipsis && isTruncated ? text : undefined }\n\t\t>\n\t\t\t{ text }\n\t\t</span>\n\t);\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend: ForwardRefExoticComponent<\n\tBaseLegendProps & RefAttributes< HTMLDivElement >\n> = forwardRef< HTMLDivElement, BaseLegendProps >(\n\t(\n\t\t{\n\t\t\titems,\n\t\t\tclassName,\n\t\t\torientation = 'horizontal',\n\t\t\talignment = 'center',\n\t\t\tshape = 'rect',\n\t\t\tfill = valueOrIdentityString,\n\t\t\tsize = valueOrIdentityString,\n\t\t\tlabelFormat = valueOrIdentity,\n\t\t\tlabelTransform = labelTransformFactory,\n\t\t\titemStyles,\n\t\t\titemClassName,\n\t\t\tlabelStyles,\n\t\t\tlabelClassName,\n\t\t\tshapeStyles,\n\t\t\trender,\n\t\t\tinteractive = false,\n\t\t\tchartId,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { margin: itemMargin = '0', flexDirection: itemDirection = 'row' } = itemStyles ?? {};\n\t\tconst {\n\t\t\tjustifyContent: labelJustifyContent = 'flex-start',\n\t\t\tflex: labelFlex = '0 0 auto',\n\t\t\tmargin: labelMargin = '0 4px',\n\t\t\tmaxWidth,\n\t\t\ttextOverflow = 'wrap',\n\t\t} = labelStyles ?? {};\n\t\tconst {\n\t\t\twidth: shapeWidth = 16,\n\t\t\theight: shapeHeight = 16,\n\t\t\tmargin: shapeMargin = '2px 4px 2px 0',\n\t\t} = shapeStyles ?? {};\n\n\t\tconst theme = useGlobalChartsTheme();\n\t\tconst context = useContext( GlobalChartsContext );\n\n\t\tconst legendScale = scaleOrdinal( {\n\t\t\tdomain: items.map( item => item.label ),\n\t\t\trange: items.map( item => item.color ),\n\t\t} );\n\t\tconst domain = legendScale.domain();\n\n\t\tconst getShapeStyle = useCallback(\n\t\t\t( { index }: { index: number } ) => items[ index ]?.shapeStyle,\n\t\t\t[ items ]\n\t\t);\n\n\t\t// Handle legend item clicks for interactive mode\n\t\tconst handleLegendClick = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( interactive && chartId && context ) {\n\t\t\t\t\tcontext.toggleSeriesVisibility( chartId, seriesLabel );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Check if a series is visible\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( ! interactive || ! chartId || ! context ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn context.isSeriesVisible( chartId, seriesLabel );\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Create event handlers to avoid inline arrow functions\n\t\tconst createClickHandler = useCallback(\n\t\t\t( labelText: string ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn () => handleLegendClick( labelText );\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst createKeyDownHandler = useCallback(\n\t\t\t( labelText: string ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn ( event: KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\thandleLegendClick( labelText );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst flexAlignment = ALIGNMENT_TO_FLEX[ alignment ] ?? 'center';\n\n\t\treturn render ? (\n\t\t\trender( items )\n\t\t) : (\n\t\t\t<LegendOrdinal\n\t\t\t\tscale={ legendScale }\n\t\t\t\tlabelFormat={ labelFormat }\n\t\t\t\tlabelTransform={ labelTransform }\n\t\t\t>\n\t\t\t\t{ labels => (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tdirection={ orientation === 'vertical' ? 'column' : 'row' }\n\t\t\t\t\t\tgap={ orientation === 'vertical' ? 'sm' : 'lg' }\n\t\t\t\t\t\talign={ orientation === 'vertical' ? flexAlignment : undefined }\n\t\t\t\t\t\tjustify={ orientation === 'horizontal' ? flexAlignment : undefined }\n\t\t\t\t\t\twrap={ orientation === 'horizontal' ? 'wrap' : undefined }\n\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\tdata-testid={ `legend-${ orientation }` }\n\t\t\t\t\t\tclassName={ clsx( styles.legend, className ) }\n\t\t\t\t\t\tstyle={ theme.legend?.containerStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ labels.map( ( label, i ) => {\n\t\t\t\t\t\t\tconst visible = isSeriesVisible( label.text );\n\t\t\t\t\t\t\tconst handleClick = createClickHandler( label.text );\n\t\t\t\t\t\t\tconst handleKeyDown = createKeyDownHandler( label.text );\n\t\t\t\t\t\t\tconst matchedItem = items[ i ];\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LegendItem\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'visx-legend-item',\n\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item' ],\n\t\t\t\t\t\t\t\t\t\tinteractive && styles[ 'legend-item--interactive' ],\n\t\t\t\t\t\t\t\t\t\t! visible && styles[ 'legend-item--inactive' ],\n\t\t\t\t\t\t\t\t\t\titemClassName\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tdata-testid=\"legend-item\"\n\t\t\t\t\t\t\t\t\tkey={ `legend-${ label.text }-${ i }` }\n\t\t\t\t\t\t\t\t\tmargin={ itemMargin }\n\t\t\t\t\t\t\t\t\tflexDirection={\n\t\t\t\t\t\t\t\t\t\torientation === 'vertical' && alignment === 'end'\n\t\t\t\t\t\t\t\t\t\t\t? 'row-reverse'\n\t\t\t\t\t\t\t\t\t\t\t: itemDirection\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\t\t\t\t\trole={ interactive ? 'button' : undefined }\n\t\t\t\t\t\t\t\t\ttabIndex={ interactive ? 0 : undefined }\n\t\t\t\t\t\t\t\t\taria-pressed={ interactive ? visible : undefined }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\t\t\t\t\t? `${ label.text }: ${ visible ? 'visible' : 'hidden' }. Toggle visibility.`\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph ? (\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\twidth={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\theight={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-glyph\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey: `legend-glyph-${ label.text }`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdatum: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolor: fill( label ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsize: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\tx: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\ty: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<LegendShape\n\t\t\t\t\t\t\t\t\t\t\tshape={ shape }\n\t\t\t\t\t\t\t\t\t\t\theight={ shapeHeight }\n\t\t\t\t\t\t\t\t\t\t\twidth={ shapeWidth }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ shapeMargin }\n\t\t\t\t\t\t\t\t\t\t\titem={ domain[ i ] }\n\t\t\t\t\t\t\t\t\t\t\titemIndex={ i }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\tfill={ fill }\n\t\t\t\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\t\t\t\tshapeStyle={ getShapeStyle }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<LegendLabel\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-label\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'visx-legend-label',\n\t\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item-label' ],\n\t\t\t\t\t\t\t\t\t\t\tlabelClassName\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tflex: labelFlex,\n\t\t\t\t\t\t\t\t\t\t\tmargin: labelMargin,\n\t\t\t\t\t\t\t\t\t\t\t...theme.legend?.labelStyles,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Stack align=\"center\" gap=\"sm\" justify={ labelJustifyContent }>\n\t\t\t\t\t\t\t\t\t\t\t<LegendText\n\t\t\t\t\t\t\t\t\t\t\t\ttext={ label.text }\n\t\t\t\t\t\t\t\t\t\t\t\ttextOverflow={ textOverflow }\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ matchedItem?.value != null && matchedItem.value !== '' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'legend-item-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ '\\u00A0' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ matchedItem.value }\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</LegendLabel>\n\t\t\t\t\t\t\t\t</LegendItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\t\t\t</LegendOrdinal>\n\t\t);\n\t}\n);\n","import { useContext, useMemo, forwardRef } from 'react';\nimport { SingleChartContext } from '../../charts/private/single-chart-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport type { LegendProps } from './types';\nimport type { ChartType, LegendShape } from '../../types';\n\nconst defaultShapeByChartType: Partial<\n\tRecord< ChartType, Extract< LegendShape< unknown, unknown >, string > >\n> = {\n\tarea: 'rect',\n\tline: 'line',\n\tbar: 'rect',\n\tpie: 'circle',\n\t'pie-semi-circle': 'circle',\n\tleaderboard: 'circle',\n};\n\nexport const Legend = forwardRef< HTMLDivElement, LegendProps >(\n\t( { chartId, items, shape, ...props }, ref ) => {\n\t\t// Get context but don't throw if it doesn't exist\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst singleChartContext = useContext( SingleChartContext );\n\n\t\t// When chartId is used, it is standalone mode\n\t\t// When chartId is not provided, we use the context's chartId, meaning it is in a single chart context\n\t\tconst contextChartId = chartId ?? singleChartContext?.chartId;\n\n\t\tconst chartData = useMemo(\n\t\t\t() => ( contextChartId && context ? context.getChartData( contextChartId ) : undefined ),\n\t\t\t[ contextChartId, context ]\n\t\t);\n\n\t\tconst contextItems = chartData?.legendItems;\n\n\t\t// Derive the default legend shape from the chart type when no explicit shape is provided\n\t\tconst resolvedShape =\n\t\t\tshape ??\n\t\t\t( chartData?.chartType ? defaultShapeByChartType[ chartData.chartType ] : undefined );\n\n\t\t// Provided items take precedence over context items\n\t\tconst legendItems = ( items || contextItems ) as typeof items;\n\n\t\tif ( ! legendItems ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseLegend\n\t\t\t\tref={ ref }\n\t\t\t\titems={ legendItems }\n\t\t\t\tshape={ resolvedShape }\n\t\t\t\t{ ...props }\n\t\t\t\tchartId={ contextChartId }\n\t\t\t/>\n\t\t);\n\t}\n);\n","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type {\n\tSeriesData,\n\tDataPointDate,\n\tDataPointPercentageCalculated,\n\tLegendShape,\n} from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentageCalculated,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentageCalculated (pie chart data with calculated percentage)\n\tif ( 'percentage' in point ) {\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( point.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( point.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn point.valueDisplay || formatNumber( point.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\n/**\n * Processes SeriesData into legend items\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( series: SeriesData, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: series,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: series.label,\n\t\t\tvalue: showValues ? series.data?.length?.toString() || '0' : '',\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn seriesData.map( mapper );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentageCalculated )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentageCalculated, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentageCalculated,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentageCalculated[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentageCalculated (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentageCalculated )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n","import { formatNumber } from '@automattic/number-formatters';\nimport styles from './base-tooltip.module.scss';\nimport type { CSSProperties, ComponentType, ReactNode } from 'react';\n\ntype TooltipData = {\n\tlabel: string;\n\tvalue: number;\n\tvalueDisplay?: string;\n};\n\ntype TooltipComponentProps = {\n\tdata: TooltipData;\n\tclassName?: string;\n};\n\ntype TooltipCommonProps = {\n\ttop: number;\n\tleft: number;\n\tstyle?: CSSProperties;\n\tclassName?: string;\n\t/**\n\t * Whether to render the tooltip container div. When false, only renders the content.\n\t * Useful when the tooltip is rendered inside a portal or custom container.\n\t * @default true\n\t */\n\trenderContainer?: boolean;\n};\n\ntype DefaultDataTooltip = {\n\tdata: TooltipData;\n\tcomponent?: ComponentType< TooltipComponentProps >;\n\tchildren?: never;\n};\n\ntype CustomTooltip = {\n\tchildren: ReactNode;\n\tdata?: never;\n\tcomponent?: never;\n};\n\ntype BaseTooltipProps = TooltipCommonProps & ( DefaultDataTooltip | CustomTooltip );\n\nconst DefaultTooltipContent = ( { data }: TooltipComponentProps ) => (\n\t<>\n\t\t{ data?.label }: { data?.valueDisplay || formatNumber( data?.value ) }\n\t</>\n);\n\nexport const BaseTooltip = ( {\n\tdata,\n\ttop,\n\tleft,\n\tcomponent: Component = DefaultTooltipContent,\n\tchildren,\n\tclassName,\n\tstyle,\n\trenderContainer = true,\n}: BaseTooltipProps ) => {\n\tconst content = children || ( data && <Component data={ data } className={ className } /> );\n\n\tif ( ! renderContainer ) {\n\t\treturn content;\n\t}\n\n\treturn (\n\t\t<div className={ styles.tooltip } style={ { top, left, ...style } } role=\"tooltip\">\n\t\t\t{ content }\n\t\t</div>\n\t);\n};\n\nexport type { BaseTooltipProps, TooltipData };\n","import { Tooltip, TooltipContext } from '@visx/xychart';\nimport { useContext, useEffect, useCallback, useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../../types';\nimport type { RenderTooltipParams, XyChartTooltipProps } from '../../visx/types';\nimport type { ReactNode } from 'react';\n\n// Type for flattened tooltip data used in individual mode\nexport type FlattenedTooltipData = {\n\tdatum: DataPointDate;\n\tseriesLabel: string;\n\tseriesIndex: number;\n\tdataPointIndex: number;\n};\n\n// Enhanced tooltip with keyboard navigation and accessibility\ninterface AccessibleTooltipProps\n\textends Omit< XyChartTooltipProps< DataPointDate >, 'renderTooltip' > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\tselectedIndex?: number | undefined;\n\ttooltipRef?: ( element: HTMLDivElement | null ) => void;\n\tkeyboardFocusedClassName?: string;\n\t/**\n\t * Flattened tooltip data prepared by parent component\n\t * Each index corresponds to one tooltip to show\n\t */\n\ttooltipData?: FlattenedTooltipData[];\n\t/**\n\t * For line charts: series data to show all series at selected data point\n\t * When provided, shows all series instead of individual tooltips\n\t */\n\tseries?: SeriesData[];\n\t/**\n\t * Whether to combine tooltip information from multiple series into a single tooltip. This is useful for line charts.\n\t * Or to show individual tooltips for each series. This is useful for bar charts.\n\t */\n\tmode?: 'individual' | 'group';\n}\n\nexport const AccessibleTooltip: React.FC< AccessibleTooltipProps > = ( {\n\trenderTooltip,\n\tselectedIndex,\n\ttooltipRef,\n\tkeyboardFocusedClassName,\n\tseries = [],\n\tmode = 'group',\n\t...props\n} ) => {\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst tooltipData = useMemo( () => {\n\t\tif ( mode !== 'individual' ) return [];\n\t\tif ( series.length === 0 ) return [];\n\n\t\tconst maxDataPoints = Math.max( ...series.map( s => s.data.length ) );\n\t\tconst flattened: Array< {\n\t\t\tdatum: DataPointDate;\n\t\t\tseriesLabel: string;\n\t\t\tseriesIndex: number;\n\t\t\tdataPointIndex: number;\n\t\t} > = [];\n\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tfor ( let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++ ) {\n\t\t\tfor ( let seriesIndex = 0; seriesIndex < series.length; seriesIndex++ ) {\n\t\t\t\tconst seriesData = series[ seriesIndex ];\n\t\t\t\tif ( dataPointIndex < seriesData.data.length ) {\n\t\t\t\t\tflattened.push( {\n\t\t\t\t\t\tdatum: seriesData.data[ dataPointIndex ] as DataPointDate,\n\t\t\t\t\t\tseriesLabel: seriesData.label,\n\t\t\t\t\t\tseriesIndex,\n\t\t\t\t\t\tdataPointIndex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn flattened;\n\t}, [ series, mode ] );\n\n\t// Handle tooltip highlighting for keyboard navigation\n\tuseEffect( () => {\n\t\tif ( selectedIndex === undefined ) {\n\t\t\ttooltipContext?.hideTooltip();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( mode === 'group' ) {\n\t\t\t// Show all series at the selected data point index in single tooltip.\n\t\t\tseries.forEach( ( s, index ) => {\n\t\t\t\tif ( selectedIndex < s.data.length ) {\n\t\t\t\t\tconst datum = s.data[ selectedIndex ];\n\n\t\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\t\tdatum,\n\t\t\t\t\t\tkey: s.label,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( mode === 'individual' ) {\n\t\t\t// Show individual tooltips for each datapoint from each series.\n\t\t\tif ( selectedIndex < tooltipData.length ) {\n\t\t\t\tconst tooltipItem = tooltipData[ selectedIndex ];\n\n\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\tdatum: tooltipItem.datum,\n\t\t\t\t\tkey: tooltipItem.seriesLabel,\n\t\t\t\t\tindex: tooltipItem.seriesIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Don't include tooltipContext in the dependency array to avoid loop.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ selectedIndex, tooltipData, series ] );\n\n\t// Create a focusable renderTooltip that includes accessibility features\n\tconst focusableRenderTooltip = useMemo( () => {\n\t\tif ( ! renderTooltip ) return undefined;\n\n\t\treturn ( params: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst tooltipContent = renderTooltip( params );\n\n\t\t\tif ( selectedIndex !== undefined ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ tooltipRef }\n\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName={ keyboardFocusedClassName }\n\t\t\t\t\t\tdata-testid={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t\tkey={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div role=\"tooltip\" aria-live=\"polite\">\n\t\t\t\t\t{ tooltipContent }\n\t\t\t\t</div>\n\t\t\t);\n\t\t};\n\t}, [ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName ] );\n\n\treturn <Tooltip { ...props } renderTooltip={ focusableRenderTooltip } />;\n};\n\n// Keyboard navigation hook for charts\ninterface UseKeyboardNavigationProps {\n\tselectedIndex: number | undefined;\n\tsetSelectedIndex: ( index: number | undefined ) => void;\n\tisNavigating: boolean;\n\tsetIsNavigating: ( navigating: boolean ) => void;\n\tchartRef: React.RefObject< HTMLDivElement >;\n\t/**\n\t * Total number of navigation points (length of tooltip data array)\n\t */\n\ttotalPoints: number;\n}\n\nexport const useKeyboardNavigation = ( {\n\tselectedIndex,\n\tsetSelectedIndex,\n\tisNavigating,\n\tsetIsNavigating,\n\tchartRef,\n\ttotalPoints,\n}: UseKeyboardNavigationProps ) => {\n\t// Focus the tooltip as soon as it is rendered\n\tconst tooltipRef = useCallback(\n\t\t( element: HTMLDivElement | null ) => {\n\t\t\tif ( element && selectedIndex !== undefined ) {\n\t\t\t\telement.focus();\n\t\t\t}\n\t\t},\n\t\t[ selectedIndex ]\n\t);\n\n\t// On each focus of chart, reset the selectedIndex to 0, if keyboard navigation is not already active\n\tconst onChartFocus = useCallback( () => {\n\t\tif ( ! isNavigating && selectedIndex !== undefined ) {\n\t\t\tsetSelectedIndex( 0 );\n\t\t}\n\t}, [ isNavigating, selectedIndex, setSelectedIndex ] );\n\n\t// On each blur of chart, keyboard navigation should restart from first tooltip\n\tconst onChartBlur = useCallback( () => {\n\t\tsetIsNavigating( false );\n\t}, [ setIsNavigating ] );\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( totalPoints === 0 ) return;\n\n\t\t\t// Keep focus on the chart if tab is pressed\n\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst currentSelectedIndex = selectedIndex === undefined ? -1 : selectedIndex;\n\n\t\t\tif ( currentSelectedIndex + 1 >= totalPoints && [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex + 1 ) % totalPoints );\n\t\t\t} else if ( [ 'ArrowLeft' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex - 1 + totalPoints ) % totalPoints );\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\tchartRef.current?.focus();\n\t\t\t}\n\t\t},\n\t\t[ totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef ]\n\t);\n\n\treturn {\n\t\ttooltipRef,\n\t\tonChartFocus,\n\t\tonChartBlur,\n\t\tonChartKeyDown,\n\t};\n};\n\n// Re-export the base Tooltip for backwards compatibility\nexport { Tooltip };\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';\n","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n","import { Stack } from '@wordpress/ui';\nimport { useEffect } from 'react';\nimport { useElementSize } from '../../../hooks';\nimport { renderLegendSlot } from '../chart-composition';\nimport styles from './chart-layout.module.scss';\nimport type { GapSize, LegendPosition } from '../../../types';\nimport type { LegendChild } from '../chart-composition/use-chart-children';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Measurements provided to the render prop when ChartLayout handles resize listening.\n */\nexport interface ContentMeasurements {\n\t/** Measured width of the content area in pixels */\n\tcontentWidth: number;\n\t/** Measured height of the content area in pixels */\n\tcontentHeight: number;\n\t/** True when a non-zero contentHeight measurement is available */\n\tisMeasured: boolean;\n}\n\nexport interface ChartLayoutProps {\n\t/** Position for the prop-based legend element */\n\tlegendPosition: LegendPosition;\n\t/** The legend element rendered via the showLegend prop (false when hidden) */\n\tlegendElement?: ReactNode;\n\t/** Legend children from the composition API */\n\tlegendChildren: LegendChild[];\n\t/** Chart content — either a ReactNode or a render prop receiving content measurements */\n\tchildren: ReactNode | ( ( measurements: ContentMeasurements ) => ReactNode );\n\t/** Content rendered after the bottom legend (e.g., nonLegendChildren, htmlChildren, tooltips) */\n\ttrailingContent?: ReactNode;\n\t/** Called when the measured content height changes (for render-prop mode) */\n\tonContentHeightChange?: ( height: number ) => void;\n\t/** Gap between Stack items */\n\tgap?: GapSize;\n\t/** Additional class names */\n\tclassName?: string;\n\t/** Inline styles (width, height, etc.) */\n\tstyle?: CSSProperties;\n\t/** Test ID for the container */\n\t'data-testid'?: string;\n\t/** Chart ID attribute */\n\t'data-chart-id'?: string;\n}\n\nexport const ChartLayout = ( {\n\tlegendPosition,\n\tlegendElement,\n\tlegendChildren,\n\tchildren,\n\ttrailingContent,\n\tonContentHeightChange,\n\tgap,\n\tclassName,\n\tstyle,\n\t'data-testid': dataTestId,\n\t'data-chart-id': dataChartId,\n}: ChartLayoutProps ) => {\n\tconst [ contentRef, contentWidth, contentHeight ] = useElementSize< HTMLDivElement >();\n\tconst isRenderProp = typeof children === 'function';\n\tconst isMeasured = contentHeight > 0;\n\n\t// When using render-prop children, hide the layout until measurement is available\n\t// to prevent layout shift. Plain ReactNode children don't need this since they\n\t// don't depend on measured dimensions.\n\tconst visibilityStyle: { visibility?: 'hidden' | 'visible' } =\n\t\tisRenderProp && ! isMeasured ? { visibility: 'hidden' } : {};\n\n\tuseEffect( () => {\n\t\tif ( isRenderProp && onContentHeightChange && isMeasured ) {\n\t\t\tonContentHeightChange( contentHeight );\n\t\t}\n\t}, [ isRenderProp, contentHeight, isMeasured, onContentHeightChange ] );\n\tconst renderedChildren = isRenderProp\n\t\t? children( { contentWidth, contentHeight, isMeasured } )\n\t\t: children;\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={ gap }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { ...style, ...visibilityStyle } }\n\t\t\tdata-testid={ dataTestId }\n\t\t\tdata-chart-id={ dataChartId }\n\t\t>\n\t\t\t{ legendPosition === 'top' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'top' ) }\n\n\t\t\t{ isRenderProp ? (\n\t\t\t\t<div ref={ contentRef } className={ styles[ 'chart-layout__content' ] }>\n\t\t\t\t\t{ renderedChildren }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\trenderedChildren\n\t\t\t) }\n\n\t\t\t{ legendPosition === 'bottom' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'bottom' ) }\n\n\t\t\t{ trailingContent }\n\t\t</Stack>\n\t);\n};\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { RenderLineGlyphProps } from '../../line-chart';\n\nexport const DefaultGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\tconst { theme } = useContext( DataContext ) || {};\n\tconst position = props.position || 'start';\n\n\treturn (\n\t\t<circle\n\t\t\tcx={ props.x }\n\t\t\tcy={ props.y }\n\t\t\tr={ props.size }\n\t\t\tfill={ props.color }\n\t\t\tstroke={ theme?.backgroundColor }\n\t\t\tstrokeWidth={ 1.5 }\n\t\t\tpaintOrder=\"fill\"\n\t\t\tdata-testid={ `${ position }-glyph-${ props.index }` }\n\t\t\t{ ...props.glyphStyle }\n\t\t/>\n\t);\n};\n","import { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport styles from './center.module.scss';\n\nexport type CenterProps = ComponentPropsWithoutRef< typeof Stack >;\n\n/**\n * Centers its children on both axes and fills its parent.\n *\n * A thin wrapper around `Stack` with `align=\"center\"` and `justify=\"center\"`\n * defaults (both overridable) plus `width: 100%; height: 100%`. Reads more\n * honestly than a `Stack` with both axes centered, and lets call sites drop\n * ad-hoc `*__centering` classes. Forwards its ref and spreads remaining props\n * onto the underlying `Stack`.\n *\n * @param props - Stack props; `align`/`justify` default to `\"center\"`.\n * @param ref - Forwarded to the underlying element.\n * @return The centered layout element.\n */\nexport const Center = forwardRef< HTMLDivElement, CenterProps >(\n\t( { align = 'center', justify = 'center', className, ...props }, ref ) => (\n\t\t<Stack\n\t\t\tref={ ref }\n\t\t\talign={ align }\n\t\t\tjustify={ justify }\n\t\t\tclassName={ clsx( styles.center, className ) }\n\t\t\t{ ...props }\n\t\t/>\n\t)\n);\n\nCenter.displayName = 'Center';\n","import { Center } from '../center';\nimport styles from './svg-empty-state.module.scss';\nimport type { FC, ReactNode } from 'react';\n\ninterface SvgEmptyStateProps {\n\t/** X coordinate of the center point */\n\tx: number;\n\t/** Y coordinate of the center point */\n\ty: number;\n\t/** Available width for the text area */\n\twidth: number;\n\t/** Available height for the text area */\n\theight: number;\n\t/** Text content */\n\tchildren: ReactNode;\n}\n\n/**\n * Renders empty-state text inside an SVG using foreignObject so that the\n * message wraps onto multiple lines instead of being clipped.\n *\n * The component centers the text within the specified area.\n *\n * @param root0 - Component props\n * @param root0.x - X coordinate of the center point\n * @param root0.y - Y coordinate of the center point\n * @param root0.width - Available width for the text area\n * @param root0.height - Available height for the text area\n * @param root0.children - Text content\n * @return {JSX.Element} A foreignObject element containing the centered text.\n */\nexport const SvgEmptyState: FC< SvgEmptyStateProps > = ( { x, y, width, height, children } ) => {\n\treturn (\n\t\t<foreignObject x={ x - width / 2 } y={ y - height / 2 } width={ width } height={ height }>\n\t\t\t<Center className={ styles[ 'svg-empty-state' ] }>{ children }</Center>\n\t\t</foreignObject>\n\t);\n};\n","import { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { scaleTime } from '@visx/scale';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport type { useChartDataTransform } from '../../hooks';\nimport type { CurveType } from '../line-chart/types';\n\n// Approximate min pixel width for an x-axis tick label.\nconst X_TICK_WIDTH = 60;\n\n// Resolve the visx curve generator for a given `curveType` / `smoothing`\n// combination. Shared by LineChart and AreaChart so the two render\n// identically when given the same props.\n//\n// Explicit return type avoids a TS2742 portable-name error in the .d.ts\n// build: the inferred type traces back to `@types/d3-shape` (a transitive\n// dep), but `typeof curveLinear` resolves through `@visx/curve` which we\n// own directly.\nexport const getCurveType = ( type?: CurveType, smoothing?: boolean ): typeof curveLinear => {\n\tif ( ! type ) {\n\t\treturn smoothing ? curveCatmullRom : curveLinear;\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'smooth':\n\t\t\treturn curveCatmullRom;\n\t\tcase 'monotone':\n\t\t\treturn curveMonotoneX;\n\t\tcase 'linear':\n\t\t\treturn curveLinear;\n\t\tdefault:\n\t\t\treturn curveLinear;\n\t}\n};\n\nconst formatYearTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, { year: 'numeric' } );\n};\n\nconst formatDateTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, { month: 'short', day: 'numeric' } );\n};\n\nconst formatHourTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleTimeString( undefined, { hour: 'numeric', hour12: true } );\n};\n\n// Pick the most informative tick formatter for the data's time span: hours\n// within a day, calendar dates within a year, otherwise just years.\nexport const getFormatter = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\tconst minX = Math.min( ...sortedData.map( datom => datom.data.at( 0 )?.date ) );\n\tconst maxX = Math.max( ...sortedData.map( datom => datom.data.at( -1 )?.date ) );\n\n\tconst diffInHours = Math.abs( differenceInHours( maxX, minX ) );\n\tif ( diffInHours <= 24 ) {\n\t\treturn formatHourTick;\n\t}\n\n\tconst diffInYears = Math.abs( differenceInYears( maxX, minX ) );\n\tif ( diffInYears <= 1 ) {\n\t\treturn formatDateTick;\n\t}\n\n\treturn formatYearTick;\n};\n\n// Estimate the largest number of x-axis ticks that fit without producing\n// consecutive duplicate labels under the given formatter. Used so the axis\n// adapts to the data's resolution rather than picking a fixed count.\nexport const guessOptimalNumTicks = (\n\tdata: ReturnType< typeof useChartDataTransform >,\n\tchartWidth: number,\n\ttickFormatter: ( timestamp: number, index?: number, values?: unknown ) => string\n) => {\n\tconst minX = Math.min( ...data.map( datom => datom.data.at( 0 )?.date ) );\n\tconst maxX = Math.max( ...data.map( datom => datom.data.at( -1 )?.date ) );\n\tconst xScale = scaleTime( { domain: [ minX, maxX ] } );\n\n\tconst upperBound = Math.min(\n\t\tdata[ 0 ]?.data.length || 3,\n\t\tMath.ceil( chartWidth / X_TICK_WIDTH )\n\t);\n\tlet secondBestGuess = 1;\n\n\tfor ( let numTicks = upperBound; numTicks > 1; --numTicks ) {\n\t\tconst ticks = xScale.ticks( numTicks ).map( d => tickFormatter( d.getTime() ) );\n\n\t\tif ( ticks.length > upperBound ) continue;\n\n\t\tsecondBestGuess = Math.max( secondBestGuess, ticks.length );\n\n\t\tconst uniqueTicks = Array.from( new Set( ticks ) );\n\t\tif ( uniqueTicks.length === 1 ) return 1;\n\n\t\tconst hasConsecutiveDuplicate = ticks.some(\n\t\t\t( tick, idx ) => idx > 0 && tick === ticks[ idx - 1 ]\n\t\t);\n\t\tif ( hasConsecutiveDuplicate ) continue;\n\n\t\treturn ticks.length;\n\t}\n\n\treturn secondBestGuess;\n};\n","import { useParentSize } from '@visx/responsive';\nimport styles from './with-responsive.module.scss';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, height is calculated from width.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\nconst useResponsiveDimensions = ( {\n\tresizeDebounceTime = 300,\n\tmaxWidth = 1200,\n\taspectRatio,\n}: ResponsiveConfig ) => {\n\tconst {\n\t\tparentRef,\n\t\twidth: parentWidth,\n\t\theight: parentHeight,\n\t} = useParentSize( {\n\t\tdebounceTime: resizeDebounceTime,\n\t\tenableDebounceLeadingCall: true,\n\t} );\n\n\tconst containerWidth = parentWidth > 0 ? Math.min( parentWidth, maxWidth ) : 0;\n\tconst containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n\n\treturn {\n\t\tparentRef,\n\t\twidth: containerWidth,\n\t\theight: containerHeight,\n\t\t/**\n\t\t * Whether an aspectRatio was provided. Used to determine container\n\t\t * height styling: 'auto' when true (height derived from width),\n\t\t * '100%' when false (fill parent container).\n\t\t */\n\t\thasAspectRatio: aspectRatio !== undefined,\n\t};\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: measuredWidth,\n\t\t\theight: measuredHeight,\n\t\t\thasAspectRatio,\n\t\t} = useResponsiveDimensions( {\n\t\t\tresizeDebounceTime,\n\t\t\tmaxWidth,\n\t\t\taspectRatio,\n\t\t} );\n\n\t\t// Use measured dimensions, but fall back to explicit width/height props if measurement returns 0\n\t\t// (e.g., during initial render or in test environments without DOM measurement).\n\t\t// Do not use size here — size controls chart element dimensions (e.g. pie diameter), not container dimensions.\n\t\tconst effectiveWidth = measuredWidth || width || 0;\n\t\tconst effectiveHeight = measuredHeight || height || 0;\n\n\t\tconst defaultHeight = hasAspectRatio ? 'auto' : '100%';\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ parentRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tclassName={ styles.container }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: width ?? '100%',\n\t\t\t\t\theight: height ?? defaultHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WrappedComponent\n\t\t\t\t\twidth={ effectiveWidth }\n\t\t\t\t\theight={ effectiveHeight }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n","import { DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport styles from './x-zoom.module.scss';\nimport type { SingleChartRef } from './single-chart-context';\nimport type { AxisScale } from '@visx/axis';\nimport type { EventHandlerParams } from '@visx/xychart';\nimport type { ReactNode, RefObject } from 'react';\n\nconst MIN_DRAG_PIXELS = 6;\n\ntype Drag = { a: number; b: number };\ntype PointerHandler = ( params: EventHandlerParams< object > ) => void;\n\n/**\n * Drag-to-zoom state + pointer handlers for an XY chart. Designed to be\n * embedded in a chart parent: the parent owns the result, spreads the\n * `domain` into its `xScale.domain` config, and renders the selection\n * rect and reset button this returns.\n *\n * The X scale `.invert()` is read lazily from the chart's existing\n * `internalChartRef.getScales()` at commit time, so no DataContext access\n * is required from the parent.\n *\n * @param params - Hook params.\n * @param params.enabled - When false, the hook becomes a passthrough.\n * @param params.chartRef - Chart's internal scales ref.\n * @param params.userHandlers - User-supplied pointer handlers to chain.\n * @param params.userHandlers.onPointerDown - Forwarded user pointerdown handler.\n * @param params.userHandlers.onPointerMove - Forwarded user pointermove handler.\n * @param params.userHandlers.onPointerUp - Forwarded user pointerup handler.\n * @return An object with `domain`, `drag`, `reset`, and chained `handlers`.\n */\nexport function useXZoom< T extends Date | number = Date >( {\n\tenabled,\n\tchartRef,\n\tuserHandlers,\n}: {\n\tenabled: boolean;\n\tchartRef: RefObject< SingleChartRef | null >;\n\tuserHandlers?: {\n\t\tonPointerDown?: PointerHandler;\n\t\tonPointerMove?: PointerHandler;\n\t\tonPointerUp?: PointerHandler;\n\t};\n} ) {\n\tconst [ domain, setDomain ] = useState< [ T, T ] | null >( null );\n\tconst [ drag, setDrag ] = useState< Drag | null >( null );\n\n\tconst reset = useCallback( () => setDomain( null ), [] );\n\n\tconst onPointerDown = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerDown?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( { a: params.svgPoint.x, b: params.svgPoint.x } );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerMove = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerMove?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( current => ( current ? { a: current.a, b: params.svgPoint!.x } : current ) );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerUp = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerUp?.( params );\n\t\t\tif ( ! enabled ) return;\n\t\t\tconst finalDrag = drag;\n\t\t\tsetDrag( null );\n\t\t\tif ( ! finalDrag ) return;\n\t\t\tconst lo = Math.min( finalDrag.a, finalDrag.b );\n\t\t\tconst hi = Math.max( finalDrag.a, finalDrag.b );\n\t\t\tif ( hi - lo < MIN_DRAG_PIXELS ) return;\n\t\t\tconst xScale = chartRef.current?.getScales()?.xScale as\n\t\t\t\t| ( AxisScale & { invert?: ( v: number ) => T } )\n\t\t\t\t| undefined;\n\t\t\tif ( ! xScale || typeof xScale.invert !== 'function' ) return;\n\t\t\tsetDomain( [ xScale.invert( lo ), xScale.invert( hi ) ] );\n\t\t},\n\t\t[ enabled, drag, chartRef, userHandlers ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tdomain,\n\t\t\tdrag,\n\t\t\treset,\n\t\t\thandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} ),\n\t\t[ domain, drag, reset, onPointerDown, onPointerMove, onPointerUp ]\n\t);\n}\n\n/**\n * Live selection rectangle drawn inside `<XYChart>` while the user is\n * dragging. Reads plot dimensions from visx's `DataContext`.\n *\n * @param props - Props.\n * @param props.drag - Current drag, or null when idle.\n * @return JSX or null.\n */\nexport function ZoomSelectionRect( { drag }: { drag: Drag | null } ) {\n\tconst { margin, innerHeight } = useContext( DataContext );\n\tif ( ! drag || drag.a === drag.b ) return null;\n\tconst x = Math.min( drag.a, drag.b );\n\tconst w = Math.abs( drag.b - drag.a );\n\treturn (\n\t\t<rect\n\t\t\tclassName={ styles[ 'x-zoom__selection' ] }\n\t\t\tx={ x }\n\t\t\ty={ margin?.top ?? 0 }\n\t\t\twidth={ w }\n\t\t\theight={ innerHeight ?? 0 }\n\t\t\tdata-testid=\"chart-zoom-selection\"\n\t\t/>\n\t);\n}\n\n/**\n * Wraps a chart's series in a group that is clipped to the inner plot rectangle\n * while `active`. Reads the plot geometry from visx's `DataContext` (the same\n * source as `ZoomSelectionRect`), so the host charts don't compute any margins.\n * The group is always rendered (only its `clip-path` toggles) so toggling zoom\n * never remounts or re-animates the series.\n *\n * @param props - Props.\n * @param props.active - Whether to clip (e.g. `zoomable`, or `zoomable && zoomed`).\n * @param props.chartId - Chart id; used to build a unique clip-path id.\n * @param props.children - The series to clip.\n * @return JSX element.\n */\nexport function ZoomClip( {\n\tactive,\n\tchartId,\n\tchildren,\n}: {\n\tactive: boolean;\n\tchartId?: string;\n\tchildren: ReactNode;\n} ) {\n\tconst { margin, innerWidth, innerHeight } = useContext( DataContext );\n\t// Sanitise the chart id to a valid SVG/CSS id, and keep it unique per chart.\n\tconst id = `chart-zoom-clip-${ String( chartId ?? '' ).replace( /[^A-Za-z0-9_-]/g, '' ) }`;\n\tconst clip = active && ( innerWidth ?? 0 ) > 0 && ( innerHeight ?? 0 ) > 0;\n\treturn (\n\t\t<>\n\t\t\t{ clip && (\n\t\t\t\t<defs>\n\t\t\t\t\t<clipPath id={ id } data-testid=\"chart-zoom-clip\">\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tx={ margin?.left ?? 0 }\n\t\t\t\t\t\t\ty={ margin?.top ?? 0 }\n\t\t\t\t\t\t\twidth={ innerWidth }\n\t\t\t\t\t\t\theight={ innerHeight }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t) }\n\t\t\t<g clipPath={ clip ? `url(#${ id })` : undefined } data-testid=\"chart-series-clip-group\">\n\t\t\t\t{ children }\n\t\t\t</g>\n\t\t</>\n\t);\n}\n\n/**\n * Visible icon-only reset button rendered as an HTML overlay on top of\n * the chart container. The host should wrap its SVG in a `position: relative`\n * container so the button anchors correctly.\n *\n * @param props - Props.\n * @param props.onClick - Click handler. Typically the `reset` from `useXZoom`.\n * @return JSX element.\n */\nexport function ZoomResetButton( { onClick }: { onClick: () => void } ) {\n\tconst label = __( 'Reset zoom', 'jetpack-charts' );\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={ styles[ 'x-zoom__reset' ] }\n\t\t\tonClick={ onClick }\n\t\t\taria-label={ label }\n\t\t\ttitle={ label }\n\t\t\tdata-testid=\"chart-zoom-reset\"\n\t\t>\n\t\t\t<svg\n\t\t\t\tclassName={ styles[ 'x-zoom__reset-icon' ] }\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tfocusable=\"false\"\n\t\t\t>\n\t\t\t\t<circle cx=\"10\" cy=\"10\" r=\"6\" />\n\t\t\t\t<line x1=\"15\" y1=\"15\" x2=\"20\" y2=\"20\" />\n\t\t\t\t<line x1=\"7\" y1=\"10\" x2=\"13\" y2=\"10\" />\n\t\t\t</svg>\n\t\t</button>\n\t);\n}\n","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useSingleChartContext } from '../../private/single-chart-context';\nimport styles from '../line-chart.module.scss';\nimport type { AxisScale } from '@visx/axis';\nimport type { FC, ReactNode } from 'react';\n\nexport interface LineChartAnnotationsProps {\n\tchildren?: ReactNode;\n}\n\ninterface ScaleData {\n\txScale: AxisScale< Date >;\n\tyScale: AxisScale< number >;\n}\n\nconst LineChartAnnotationsOverlay: FC< LineChartAnnotationsProps > = ( { children } ) => {\n\tconst { chartRef, chartWidth, chartHeight } = useSingleChartContext();\n\n\tconst [ scales, setScales ] = useState< ScaleData | null >( null );\n\tconst [ scalesStable, setScalesStable ] = useState< boolean >( false );\n\n\t// Create a signature for scale data to enable easy comparison\n\tconst createScaleSignature = useCallback( ( scaleData: ScaleData ) => {\n\t\tconst xDomain = scaleData.xScale.domain();\n\t\tconst yDomain = scaleData.yScale.domain();\n\t\tconst xRange = scaleData.xScale.range();\n\t\tconst yRange = scaleData.yScale.range();\n\n\t\treturn `${ xDomain.join( ',' ) }-${ yDomain.join( ',' ) }-${ xRange.join(\n\t\t\t','\n\t\t) }-${ yRange.join( ',' ) }`;\n\t}, [] );\n\n\t// Get scales from chart ref and return them with signature for comparison\n\tconst getScalesData = useCallback( () => {\n\t\tif ( chartRef?.current ) {\n\t\t\tconst scaleData = chartRef.current.getScales();\n\n\t\t\tif ( scaleData ) {\n\t\t\t\tconst scaleInfo = {\n\t\t\t\t\txScale: scaleData.xScale as AxisScale< Date >,\n\t\t\t\t\tyScale: scaleData.yScale as AxisScale< number >,\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tscales: scaleInfo,\n\t\t\t\t\tsignature: createScaleSignature( scaleInfo ),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}, [ chartRef, createScaleSignature ] );\n\n\t// The chart resizes on render so we need to monitor the scales until they stabilize\n\tuseEffect( () => {\n\t\tlet timeoutId: number | null = null;\n\t\tlet lastSignature: string | null = null;\n\t\tlet retryCount = 0;\n\t\tconst maxRetries = 20; // 20 * 50ms = 1 second max\n\t\tconst checkInterval = 50; // Check every 50ms\n\n\t\t// Reset stability state when monitoring starts\n\t\tsetScalesStable( false );\n\n\t\tconst monitorScales = () => {\n\t\t\tconst currentScaleData = getScalesData();\n\n\t\t\t// If we got scales, compare signatures\n\t\t\tif ( currentScaleData ) {\n\t\t\t\t// Check if scales have settled by comparing signatures\n\t\t\t\tconst scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n\n\t\t\t\tif ( scalesSettled ) {\n\t\t\t\t\t// Scales have stabilized, mark as stable\n\t\t\t\t\tsetScalesStable( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update scales and remember signature for next comparison\n\t\t\t\tsetScales( currentScaleData.scales );\n\t\t\t\tlastSignature = currentScaleData.signature;\n\t\t\t}\n\n\t\t\t// Continue monitoring if we haven't exceeded max retries\n\t\t\tif ( retryCount < maxRetries ) {\n\t\t\t\tretryCount++;\n\t\t\t\ttimeoutId = setTimeout( monitorScales, checkInterval ) as unknown as number;\n\t\t\t}\n\t\t};\n\n\t\tmonitorScales();\n\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ getScalesData, chartWidth, chartHeight ] );\n\n\tif ( ! chartRef || ! children || ! chartWidth || ! chartHeight ) {\n\t\treturn null;\n\t}\n\n\tif ( ! scales || ! scalesStable ) {\n\t\treturn null;\n\t}\n\n\t// Create a DataContext value that mimics what visx provides\n\t// We're intentionally providing minimal context for annotations to work\n\tconst dataContextValue = {\n\t\txScale: scales.xScale,\n\t\tyScale: scales.yScale,\n\t\tmargin: { top: 0, right: 0, bottom: 0, left: 0 },\n\t\twidth: chartWidth,\n\t\theight: chartHeight,\n\t} as unknown as Parameters< typeof DataContext.Provider >[ 0 ][ 'value' ];\n\n\treturn (\n\t\t<DataContext.Provider value={ dataContextValue }>\n\t\t\t<svg\n\t\t\t\twidth={ chartWidth }\n\t\t\t\theight={ chartHeight }\n\t\t\t\tclassName={ styles[ 'line-chart__annotations-overlay' ] }\n\t\t\t\tdata-testid=\"line-chart-annotations-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</svg>\n\t\t</DataContext.Provider>\n\t);\n};\n\nexport default LineChartAnnotationsOverlay;\n","import { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport type { ButtonWithPopover, PopoverElement, ToggleEvent } from '../../../types';\nimport type { FC } from 'react';\n\nexport const POPOVER_BUTTON_SIZE = 44;\n\nconst CloseIcon = () => (\n\t<svg\n\t\twidth=\"16\"\n\t\theight=\"16\"\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\taria-hidden=\"true\"\n\t\tfocusable=\"false\"\n\t>\n\t\t<path d=\"M6 6l12 12M18 6L6 18\" />\n\t</svg>\n);\n\ninterface LineChartAnnotationLabelWithPopoverProps {\n\ttitle: string;\n\tsubtitle?: string;\n\trenderLabel: FC< { title: string; subtitle?: string } >;\n\trenderLabelPopover: FC< { title: string; subtitle?: string } >;\n}\n\nconst LineChartAnnotationLabelWithPopover: FC< LineChartAnnotationLabelWithPopoverProps > = ( {\n\ttitle,\n\tsubtitle,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst popoverId = useId();\n\tconst buttonRef = useRef< HTMLButtonElement >( null );\n\tconst popoverRef = useRef< HTMLDivElement >( null );\n\tconst [ isPositioned, setIsPositioned ] = useState( false );\n\tconst isBrowserSafari = isSafari();\n\n\tuseEffect( () => {\n\t\tconst button = buttonRef.current;\n\t\tconst popover = popoverRef.current;\n\n\t\tif ( ! button || ! popover ) return;\n\n\t\tconst positionPopover = () => {\n\t\t\t// Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n\t\t\tif ( ! isBrowserSafari ) {\n\t\t\t\tconst buttonRect = button.getBoundingClientRect();\n\t\t\t\tpopover.style.left = `${ buttonRect.right }px`;\n\t\t\t\tpopover.style.top = `${ buttonRect.top }px`;\n\t\t\t}\n\n\t\t\tsetIsPositioned( true );\n\t\t};\n\n\t\t// Position when popover shows\n\t\tpopover.addEventListener( 'toggle', ( e: ToggleEvent ) => {\n\t\t\tif ( e.newState === 'open' ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} );\n\n\t\t// Initial positioning if already open\n\t\ttry {\n\t\t\tif ( popover.matches( ':popover-open' ) ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n\t\t}\n\t}, [ isBrowserSafari ] );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__annotation-label' ] }>\n\t\t\t<button\n\t\t\t\tref={ buttonRef }\n\t\t\t\t{ ...( { popovertarget: popoverId } as ButtonWithPopover ) }\n\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-trigger-button' ] }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\theight: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\ttransform: `translate(${ POPOVER_BUTTON_SIZE / 2 }px, 0)`,\n\t\t\t\t} }\n\t\t\t\taria-label={ title || __( 'View details', 'jetpack-charts' ) }\n\t\t\t>\n\t\t\t\t{ renderLabel( { title, subtitle } ) }\n\t\t\t</button>\n\t\t\t<div\n\t\t\t\tref={ popoverRef }\n\t\t\t\tid={ popoverId }\n\t\t\t\t{ ...( { popover: 'auto' } as PopoverElement ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'line-chart__annotation-label-popover' ],\n\t\t\t\t\tisPositioned && styles[ 'line-chart__annotation-label-popover--visible' ],\n\t\t\t\t\tisBrowserSafari && styles[ 'line-chart__annotation-label-popover--safari' ]\n\t\t\t\t) }\n\t\t\t\tdata-testid=\"line-chart-annotation-label-popover\"\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"flex-start\" justify=\"space-between\">\n\t\t\t\t\t<div className={ styles[ 'line-chart__annotation-label-popover-content' ] }>\n\t\t\t\t\t\t{ renderLabelPopover( { title, subtitle } ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...( {\n\t\t\t\t\t\t\tpopovertarget: popoverId,\n\t\t\t\t\t\t\tpopovertargetaction: 'hide',\n\t\t\t\t\t\t} as ButtonWithPopover ) }\n\t\t\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-popover-close-button' ] }\n\t\t\t\t\t\taria-label={ __( 'Close', 'jetpack-charts' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CloseIcon />\n\t\t\t\t\t</button>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default LineChartAnnotationLabelWithPopover;\n","import {\n\tAnnotation,\n\tCircleSubject,\n\tConnector,\n\tHtmlLabel,\n\tLabel,\n\tLineSubject,\n} from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { isSafari } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, {\n\tPOPOVER_BUTTON_SIZE,\n} from './line-chart-annotation-label-popover';\nimport type { LineChartAnnotationProps } from '../types';\nimport type { LabelProps } from '@visx/annotation';\nimport type { TextProps } from '@visx/text';\nimport type { FC } from 'react';\n\ntype SubjectType = 'circle' | 'line-vertical' | 'line-horizontal';\n\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\n\nexport const getLabelPosition = ( {\n\tsubjectType,\n\tx,\n\txMax,\n\ty,\n\tyMin,\n\tyMax,\n\tmaxWidth,\n\theight,\n}: {\n\tsubjectType: SubjectType;\n\tx: number;\n\txMax: number;\n\ty: number;\n\tyMin: number;\n\tyMax: number;\n\tmaxWidth?: number;\n\theight?: number | null;\n} ): {\n\tdx: number;\n\tdy: number;\n\tisFlippedHorizontally: boolean;\n\tisFlippedVertically: boolean;\n} => {\n\tconst annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n\tconst annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n\tlet dx = 15;\n\tlet dy = 15;\n\tlet isFlippedHorizontally = false;\n\tlet isFlippedVertically = false;\n\n\tif ( subjectType === 'line-horizontal' ) {\n\t\tdx = 0;\n\t\tdy = 20;\n\t}\n\n\tif ( subjectType === 'line-vertical' ) {\n\t\tdx = 20;\n\t\tdy = 0;\n\t}\n\n\t// Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n\t// Account for the connector offset (dx) in boundary calculations\n\tconst effectiveX = x + dx;\n\n\tif ( effectiveX + annotationMaxWidth > xMax ) {\n\t\tisFlippedHorizontally = true;\n\n\t\tif ( subjectType === 'circle' ) {\n\t\t\tdx = -dx; // Just flip to the left side with same offset\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tdx = -20; // Position to the left of the line\n\t\t}\n\t}\n\n\t// Smart vertical positioning: check both top and bottom edges\n\t// For circle annotations, they are positioned below by default (dy > 0)\n\t// Only flip when close to bottom edge to position above\n\tif ( subjectType === 'circle' ) {\n\t\t// Check if positioning below would extend beyond bottom edge\n\t\tif ( y + dy + annotationHeight > yMin ) {\n\t\t\t// Too close to bottom edge, position above\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t}\n\t\t// When close to top edge, keep default below positioning (no flip needed)\n\t} else if ( y - annotationHeight < yMax ) {\n\t\t// Too close to top edge, position below\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = Math.abs( dy ); // Ensure positive value to position below the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t} else if ( y + annotationHeight > yMin ) {\n\t\t// Too close to bottom edge, position above\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t}\n\n\treturn { dx, dy, isFlippedHorizontally, isFlippedVertically };\n};\n\nconst getHorizontalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedHorizontally: boolean\n): LabelProps[ 'horizontalAnchor' ] => {\n\tif ( subjectType === 'line-horizontal' ) {\n\t\treturn isFlippedHorizontally ? 'end' : 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst getVerticalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedVertically: boolean,\n\ty: number,\n\tyMax: number,\n\theight: number\n): TextProps[ 'verticalAnchor' ] => {\n\tif ( subjectType === 'line-vertical' ) {\n\t\tif ( isFlippedVertically ) {\n\t\t\t// If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n\t\t\treturn y - height < yMax ? 'start' : 'end';\n\t\t}\n\n\t\treturn 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst LineChartAnnotation: FC< LineChartAnnotationProps > = ( {\n\tdatum,\n\ttitle,\n\tsubtitle,\n\tsubjectType = 'circle',\n\tstyles: datumStyles,\n\ttestId,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst labelRef = useRef< SVGGElement >( null );\n\tconst [ height, setHeight ] = useState< number | null >( null );\n\n\t// Deep merge styles to preserve nested object properties\n\tconst styles = merge( providerTheme.annotationStyles ?? {}, datumStyles ?? {} );\n\n\t// Measure the label height once after initial render\n\tuseEffect( () => {\n\t\tif ( labelRef.current?.getBBox ) {\n\t\t\tconst bbox = labelRef.current.getBBox();\n\t\t\tsetHeight( bbox.height );\n\t\t}\n\t}, [] );\n\n\tconst positionData = useMemo( () => {\n\t\tif ( ! datum || ! datum.date || datum.value == null || ! xScale || ! yScale ) return null;\n\n\t\tconst x = xScale( datum.date );\n\t\tconst y = yScale( datum.value );\n\n\t\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\t\tconst [ yMin, yMax ] = yScale.range().map( Number );\n\t\tconst [ xMin, xMax ] = xScale.range().map( Number );\n\n\t\t// If a custom label is provided, use the provided position\n\t\tif ( renderLabel ) {\n\t\t\treturn {\n\t\t\t\tx,\n\t\t\t\tdx: 0,\n\t\t\t\ty,\n\t\t\t\tdy: 0,\n\t\t\t\tyMin,\n\t\t\t\tyMax,\n\t\t\t\txMin,\n\t\t\t\txMax,\n\t\t\t\tisFlippedHorizontally: false,\n\t\t\t\tisFlippedVertically: false,\n\t\t\t};\n\t\t}\n\n\t\tconst position = getLabelPosition( {\n\t\t\tsubjectType,\n\t\t\tx,\n\t\t\txMax,\n\t\t\ty,\n\t\t\tyMin,\n\t\t\tyMax,\n\t\t\tmaxWidth: styles?.label?.maxWidth,\n\t\t\theight,\n\t\t} );\n\n\t\treturn { x, y, yMin, yMax, xMin, xMax, ...position };\n\t}, [ datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel ] );\n\n\tif ( ! positionData ) return null;\n\n\tconst { x, y, yMin, yMax, xMin, xMax, dx, dy, isFlippedHorizontally, isFlippedVertically } =\n\t\tpositionData;\n\n\tconst getLabelY = () => {\n\t\tconst labelY = styles?.label?.y;\n\n\t\tif ( labelY === 'start' ) return yMax;\n\t\tif ( labelY === 'end' ) return yMin;\n\n\t\treturn labelY;\n\t};\n\n\tconst getLabelX = () => {\n\t\tconst labelX = styles?.label?.x;\n\n\t\tif ( labelX === 'start' ) return xMin;\n\t\tif ( labelX === 'end' ) return xMax;\n\n\t\treturn labelX;\n\t};\n\n\tconst labelPosition = {\n\t\tx: getLabelX(),\n\t\ty: getLabelY(),\n\t};\n\n\t// Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n\t// This is a workaround to position the label correctly\n\tconst getSafariHTMLLabelPosition = () => {\n\t\tconst labelWidth = POPOVER_BUTTON_SIZE;\n\t\tconst labelHeight = POPOVER_BUTTON_SIZE;\n\n\t\treturn isSafari()\n\t\t\t? {\n\t\t\t\t\ttransform: `translate(${\n\t\t\t\t\t\tx +\n\t\t\t\t\t\t( dx || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.x === 'number' ? labelPosition.x - x : 0 ) -\n\t\t\t\t\t\tlabelWidth\n\t\t\t\t\t}px, ${\n\t\t\t\t\t\ty +\n\t\t\t\t\t\t( dy || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.y === 'number' ? labelPosition.y - y : 0 ) -\n\t\t\t\t\t\tlabelHeight\n\t\t\t\t\t}px)`,\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\theight: labelHeight,\n\t\t\t }\n\t\t\t: undefined;\n\t};\n\n\treturn (\n\t\t<g data-testid={ testId }>\n\t\t\t<Annotation x={ x } y={ y } dx={ dx } dy={ dy }>\n\t\t\t\t<Connector { ...styles?.connector } />\n\t\t\t\t{ subjectType === 'circle' && <CircleSubject { ...styles?.circleSubject } /> }\n\t\t\t\t{ subjectType === 'line-vertical' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ yMax }\n\t\t\t\t\t\tmax={ yMin }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'vertical' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-horizontal' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ xMin }\n\t\t\t\t\t\tmax={ xMax }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'horizontal' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ renderLabel ? (\n\t\t\t\t\t<HtmlLabel { ...styles?.label } { ...labelPosition }>\n\t\t\t\t\t\t<div style={ getSafariHTMLLabelPosition() }>\n\t\t\t\t\t\t\t{ renderLabelPopover ? (\n\t\t\t\t\t\t\t\t<LineChartAnnotationLabelWithPopover\n\t\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t\t\trenderLabel={ renderLabel }\n\t\t\t\t\t\t\t\t\trenderLabelPopover={ renderLabelPopover }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\trenderLabel( { title, subtitle } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</HtmlLabel>\n\t\t\t\t) : (\n\t\t\t\t\t<g ref={ labelRef }>\n\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t{ ...styles?.label }\n\t\t\t\t\t\t\t{ ...labelPosition }\n\t\t\t\t\t\t\thorizontalAnchor={ getHorizontalAnchor( subjectType, isFlippedHorizontally ) }\n\t\t\t\t\t\t\tverticalAnchor={ getVerticalAnchor(\n\t\t\t\t\t\t\t\tsubjectType,\n\t\t\t\t\t\t\t\tisFlippedVertically,\n\t\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\t\tyMax,\n\t\t\t\t\t\t\t\theight ?? ANNOTATION_INIT_HEIGHT\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t) }\n\t\t\t</Annotation>\n\t\t</g>\n\t);\n};\n\nexport default LineChartAnnotation;\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { LineChartGlyphProps } from '../types';\nimport type { FC } from 'react';\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\nconst LineChartGlyph: FC< LineChartGlyphProps > = ( {\n\tdata,\n\tindex,\n\tcolor,\n\tglyphStyle,\n\trenderGlyph,\n\taccessors,\n\tposition,\n} ) => {\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tif ( ! xScale || ! yScale ) return null;\n\n\tif ( data.data.length === 0 ) return null;\n\n\tconst point = position === 'start' ? data.data[ 0 ] : data.data[ data.data.length - 1 ];\n\n\tconst x = xScale( accessors.xAccessor( point ) );\n\tconst y = yScale( accessors.yAccessor( point ) );\n\n\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\tconst size = Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 );\n\n\treturn renderGlyph( {\n\t\tkey: `${ position }-glyph-${ data.label }`,\n\t\tindex,\n\t\tdatum: point,\n\t\tcolor,\n\t\tsize,\n\t\tx,\n\t\ty,\n\t\tglyphStyle,\n\t\tposition,\n\t} );\n};\n\nexport default LineChartGlyph;\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { LinearGradient } from '@visx/gradient';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { SingleChartContext, type SingleChartRef } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport type { RenderLineGlyphProps, LineChartProps, TooltipDatum } from './types';\nimport type { DataPoint, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { FC, Ref } from 'react';\n\nconst defaultRenderGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\treturn <DefaultGlyph { ...props } key={ props.key } />;\n};\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\n/**\n * Default visx-tooltip render that prints the hovered date as a heading and\n * one row per visible series (label + formatted value), sorted descending by\n * value. Reused by AreaChart, which has the same multi-series shape.\n *\n * @param params - visx `RenderTooltipParams< DataPointDate >`.\n * @return Tooltip JSX, or `null` when no datum is hovered.\n */\nexport const renderDefaultTooltip = ( params: RenderTooltipParams< DataPointDate > ) => {\n\tconst { tooltipData } = params;\n\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\tif ( ! nearestDatum ) return null;\n\n\tconst tooltipPoints: TooltipDatum[] = Object.entries( tooltipData?.datumByKey || {} )\n\t\t.map( ( [ key, { datum } ] ) => ( {\n\t\t\tkey,\n\t\t\tvalue: datum.value as number,\n\t\t} ) )\n\t\t.sort( ( a, b ) => b.value - a.value );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__tooltip' ] }>\n\t\t\t<div className={ styles[ 'line-chart__tooltip-date' ] }>\n\t\t\t\t{ nearestDatum.date?.toLocaleDateString() }\n\t\t\t</div>\n\t\t\t{ tooltipPoints.map( point => (\n\t\t\t\t<Stack\n\t\t\t\t\tkey={ point.key }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName={ styles[ 'line-chart__tooltip-row' ] }\n\t\t\t\t>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-label' ] }>{ point.key }:</span>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-value' ] }>\n\t\t\t\t\t\t{ formatNumber( point.value ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t) ) }\n\t\t</div>\n\t);\n};\n\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef: FC< {\n\tchartRef?: Ref< SingleChartRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\txScale: context.xScale,\n\t\t\t\t\tyScale: context.yScale,\n\t\t\t\t};\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tmargin: margin || {},\n\t\t\t} ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null; // This component only provides the ref interface\n};\n\nconst LineChartInternal = forwardRef< SingleChartRef, LineChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\trenderGlyph = defaultRenderGlyph,\n\t\t\tglyphStyle = {},\n\t\t\twithLegendGlyph = false,\n\t\t\twithGradientFill = false,\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\twithStartGlyphs = false,\n\t\t\twithEndGlyphs = false,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown = undefined,\n\t\t\tonPointerUp = undefined,\n\t\t\tonPointerMove = undefined,\n\t\t\tonPointerOut = undefined,\n\t\t\tzoomable = false,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'line';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< SingleChartRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\t// Process children for composition API (Legend, etc.)\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LineChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\t// Callback for ChartLayout to notify us when the measured content height changes.\n\t\t// We compute chartHeight the same way the render prop does so the context stays in sync.\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\t// Forward the external ref to the internal ref\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t\t// Add visibility information to series when using interactive legends\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\t\treturn dataSorted.map( ( series, index ) => ( { series, index, isVisible: true } ) );\n\t\t\t}\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, chartId, isSeriesVisible, legendInteractive ] );\n\n\t\t// Check if all series are hidden\n\t\tconst allSeriesHidden = useMemo( () => {\n\t\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t\t}, [ seriesWithVisibility ] );\n\n\t\t// Use the keyboard navigation hook\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst formatter = options?.axis?.x?.tickFormat || getFormatter( dataSorted );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.x,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\tzero: false,\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, zoom.domain ] );\n\n\t\tconst tooltipRenderGlyph = useMemo( () => {\n\t\t\treturn ( props: GlyphProps< DataPointDate > ) => {\n\t\t\t\tconst seriesIndex = dataSorted.findIndex(\n\t\t\t\t\tseries =>\n\t\t\t\t\t\tseries.label === props.key || series.data.includes( props.datum as DataPointDate )\n\t\t\t\t);\n\n\t\t\t\tconst seriesData = dataSorted[ seriesIndex ];\n\n\t\t\t\tconst { color, glyph: themeGlyph } = getElementStyles( {\n\t\t\t\t\tdata: seriesData,\n\t\t\t\t\tindex: seriesIndex,\n\t\t\t\t} );\n\n\t\t\t\tconst propsWithResolvedColor = { ...props, color };\n\n\t\t\t\treturn themeGlyph\n\t\t\t\t\t? themeGlyph( propsWithResolvedColor )\n\t\t\t\t\t: renderGlyph( propsWithResolvedColor );\n\t\t\t};\n\t\t}, [ dataSorted, renderGlyph, getElementStyles ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\t// Memoize legend options to prevent unnecessary re-calculations\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: withLegendGlyph,\n\t\t\t\tglyphSize: Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 ),\n\t\t\t\trenderGlyph,\n\t\t\t} ),\n\t\t\t[ withLegendGlyph, glyphStyle?.radius, renderGlyph ]\n\t\t);\n\n\t\t// Create legend items using the reusable hook\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\t// Memoize metadata to prevent unnecessary re-registration\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGradientFill,\n\t\t\t\tsmoothing,\n\t\t\t\tcurveType,\n\t\t\t\twithStartGlyphs,\n\t\t\t\twithEndGlyphs,\n\t\t\t\twithLegendGlyph,\n\t\t\t} ),\n\t\t\t[ withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph ]\n\t\t);\n\n\t\t// Register chart with context only if data is valid\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'line',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\n\t\t// Create a custom renderTooltip that includes focus capability\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'line-chart', styles[ 'line-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'line-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<SingleChartContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'line-chart',\n\t\t\t\t\t\tstyles[ 'line-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'line-chart--animated' ] ]: animation && ! prefersReducedMotion },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"line-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\t// Use the measured height, falling back to the passed height if provided.\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Line chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t// xScale and yScale could be set in Axis as well, but they are `scale` props there.\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ gridVisibility !== 'none' && <Grid columns={ false } numTicks={ 4 } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.x.display && <Axis { ...chartOptions.axis.x } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.y.display && <Axis { ...chartOptions.axis.y } /> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Line is not animated, so clip only while zoomed; its edge glyphs sit on the plot border and must not be clipped. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable && !! zoom.domain } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t( { series: seriesData, index, isVisible } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Skip rendering invisible series\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! isVisible ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst { color, lineStyles, glyph } = getElementStyles( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: seriesData,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst lineProps = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstroke: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...lineStyles,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ seriesData?.label || index }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withGradientFill && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ `area-gradient-${ chartId }-${ index + 1 }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfromOpacity={ 0.4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoOpacity={ 0.1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tto={ providerTheme.backgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...seriesData.options?.gradient }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"line-gradient\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesData.options?.gradient?.stops?.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t( stop, stopIndex ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `${ stop.offset }-${ stop.color || color }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stop.offset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopColor={ stop.color || color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopOpacity={ stop.opacity ?? 1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid={ `line-gradient-stop-${ chartId }-${ index }-${ stopIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</LinearGradient>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<AreaSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twithGradientFill\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? `url(#area-gradient-${ chartId }-${ index + 1 })`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'transparent'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ true }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ getCurveType( curveType, smoothing ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlineProps={ lineProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withStartGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withEndGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSeriesGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ tooltipRenderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'line-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Component to expose scale data via ref */ }\n\t\t\t\t\t\t\t\t\t\t\t<LineChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n);\n\n// Component type definitions for composition API\ntype LineChartAnnotationComponents = {\n\tAnnotationsOverlay: typeof LineChartAnnotationsOverlay;\n\tAnnotation: typeof LineChartAnnotation;\n\tLegend: typeof Legend;\n};\n\ntype LineChartBaseProps = Optional< LineChartProps, 'width' | 'height' | 'size' >;\n\ntype LineChartComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & React.RefAttributes< SingleChartRef >\n> &\n\tLineChartAnnotationComponents;\n\ntype LineChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & ResponsiveConfig & React.RefAttributes< SingleChartRef >\n> &\n\tLineChartAnnotationComponents;\n\nconst LineChartWithProvider = forwardRef< SingleChartRef, LineChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <LineChartInternal { ...props } ref={ ref } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LineChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nLineChartWithProvider.displayName = 'LineChart';\n\nconst LineChart = attachSubComponents( LineChartWithProvider, {\n\tLegend: Legend,\n\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\tAnnotation: LineChartAnnotation,\n} ) as LineChartComponent;\n\nconst LineChartResponsive = attachSubComponents(\n\twithResponsive< LineChartProps >( LineChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\t\tAnnotation: LineChartAnnotation,\n\t}\n) as LineChartResponsiveComponent;\n\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };\n","import { __ } from '@wordpress/i18n';\nimport type { DataPoint, DataPointDate, SeriesData } from '../../../types';\n\n/**\n * Up-front data validation. Returns a localised error message when the chart\n * cannot safely render, otherwise `null`. Catches the cases that would\n * NaN-cascade through the tick formatter and stack layout: empty top-level\n * array, empty per-series data, null/NaN values, invalid dates.\n *\n * @param data - Series data passed to AreaChart.\n * @return Error message, or `null` if the data is renderable.\n */\nexport const validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasEmptySeries = data.some( series => ! series.data?.length );\n\tif ( hasEmptySeries ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return __( 'Invalid data', 'jetpack-charts' );\n\treturn null;\n};\n","import { DataContext, TooltipContext } from '@visx/xychart';\nimport { useContext, useImperativeHandle } from 'react';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { SingleChartRef } from '../../private/single-chart-context';\nimport type { FC, ReactNode, Ref } from 'react';\n\nexport type VisibleSeriesEntry = { series: SeriesData; index: number; isVisible: boolean };\n\n// AreaChart only configures time + linear scales; cast to a callable shape\n// instead of spreading `any`. `Number(...)` + `isFinite` guards every call.\ntype ScaleFn = ( input: Date | number ) => number;\n\n// Bridges visx's `DataContext` to the chart's `SingleChartRef` so consumers\n// can read scales and dimensions imperatively. Must be inside `<XYChart>`.\nexport const AreaChartScalesRef: FC< {\n\tchartRef?: Ref< SingleChartRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) return null;\n\t\t\t\treturn { xScale: context.xScale, yScale: context.yScale };\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( { width, height, margin: margin || {} } ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null;\n};\n\n// Hover indicators for each visible series. visx's `showSeriesGlyphs`\n// mispositions on AreaStack (its registered yAccessor expects a stack-bar\n// but receives the unwrapped datum, yielding NaN), so we compute positions\n// from the chart's scales: cumulative top edge for stacked + offset='none'\n// (matches d3-stack — missing values count as 0); raw y for unstacked.\n// Skipped for `expand`/`wiggle`/`silhouette` — exact positions there would\n// need re-running the d3-stack layout.\nexport const HoverGlyphs: FC< {\n\tvisibleSeries: VisibleSeriesEntry[];\n\tstacked: boolean;\n\tstackOffset: 'none' | 'expand' | 'wiggle' | 'silhouette';\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\tstrokeColor: string;\n} > = ( { visibleSeries, stacked, stackOffset, getElementStyles, strokeColor } ) => {\n\tconst dataContext = useContext( DataContext );\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst xScale = dataContext?.xScale as ScaleFn | undefined;\n\tconst yScale = dataContext?.yScale as ScaleFn | undefined;\n\tconst tooltipOpen = tooltipContext?.tooltipOpen;\n\tconst nearestDatum = tooltipContext?.tooltipData?.nearestDatum?.datum as\n\t\t| DataPointDate\n\t\t| undefined;\n\n\tif (\n\t\t! tooltipOpen ||\n\t\t! xScale ||\n\t\t! yScale ||\n\t\t! nearestDatum ||\n\t\t! nearestDatum.date ||\n\t\t( stacked && stackOffset !== 'none' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst xPx = Number( xScale( nearestDatum.date ) );\n\tif ( ! Number.isFinite( xPx ) ) return null;\n\n\tconst hoveredTime = nearestDatum.date.getTime();\n\tlet cumulative = 0;\n\tconst circles: ReactNode[] = [];\n\n\t// Always advance `cumulative` (d3-stack treats missing/null as 0), but\n\t// only render a glyph when the series has a real value at this x.\n\tfor ( const { series, index } of visibleSeries ) {\n\t\tconst datum = series.data.find(\n\t\t\td => ( d as DataPointDate ).date?.getTime() === hoveredTime\n\t\t) as DataPointDate | undefined;\n\n\t\tconst value = datum?.value ?? 0;\n\t\tif ( stacked ) {\n\t\t\tcumulative += value;\n\t\t}\n\n\t\tif ( ! datum || datum.value == null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst yPx = Number( yScale( stacked ? cumulative : value ) );\n\t\tif ( ! Number.isFinite( yPx ) ) continue;\n\n\t\tconst { color } = getElementStyles( { data: series, index } );\n\t\tcircles.push(\n\t\t\t<circle\n\t\t\t\tkey={ series.label || index }\n\t\t\t\tcx={ xPx }\n\t\t\t\tcy={ yPx }\n\t\t\t\tr={ 4 }\n\t\t\t\tfill={ color }\n\t\t\t\tstroke={ strokeColor }\n\t\t\t\tstrokeWidth={ 1.5 }\n\t\t\t\tpaintOrder=\"fill\"\n\t\t\t\tdata-testid={ `area-chart-hover-glyph-${ index }` }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( circles.length === 0 ) return null;\n\n\treturn (\n\t\t<g pointerEvents=\"none\" className=\"area-chart__hover-glyphs\">\n\t\t\t{ circles }\n\t\t</g>\n\t);\n};\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { XYChart, AnimatedAreaSeries, AnimatedAreaStack, Grid, Axis } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { renderDefaultTooltip } from '../line-chart';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext, type SingleChartRef } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './area-chart.module.scss';\nimport { AreaChartScalesRef, HoverGlyphs, validateData } from './private';\nimport type { AreaChartProps } from './types';\nimport type { DataPointDate, Optional } from '../../types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\n\nconst AreaChartInternal = forwardRef< SingleChartRef, AreaChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\tstacked = true,\n\t\t\tstackOffset = 'none',\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\tfillOpacity,\n\t\t\twithStroke,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown,\n\t\t\tonPointerUp,\n\t\t\tonPointerMove,\n\t\t\tonPointerOut,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnLegendToggle = true,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'rect';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< SingleChartRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'AreaChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\t\treturn dataSorted.map( ( series, index ) => ( { series, index, isVisible: true } ) );\n\t\t\t}\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, chartId, isSeriesVisible, legendInteractive ] );\n\n\t\tconst allSeriesHidden = useMemo(\n\t\t\t() => seriesWithVisibility.every( ( { isVisible } ) => ! isVisible ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\t// Computed from the full data set (ignoring legend visibility) so the y-axis stays\n\t\t// fixed when series are toggled off - otherwise visx auto-fits to the remaining\n\t\t// data and the chart's baseline appears to move. Opt-in via\n\t\t// `rescaleYOnLegendToggle={ false }`. Skipped for non-default stack offsets,\n\t\t// which reshape the y-extent (`expand` -> [0,1], `wiggle`/`silhouette` -> centred\n\t\t// around zero); letting visx derive the domain is correct there.\n\t\tconst fixedYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif (\n\t\t\t\trescaleYOnLegendToggle ||\n\t\t\t\t! legendInteractive ||\n\t\t\t\t! dataSorted.length ||\n\t\t\t\t! dataSorted[ 0 ].data.length ||\n\t\t\t\t( stacked && stackOffset !== 'none' )\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif ( stacked ) {\n\t\t\t\t// d3-stack with `offset: 'none'` stacks positives upward from 0 and\n\t\t\t\t// negatives downward from 0, so we need both extremes.\n\t\t\t\tconst numPoints = Math.max( ...dataSorted.map( s => s.data.length ) );\n\t\t\t\tlet posMax = 0;\n\t\t\t\tlet negMin = 0;\n\t\t\t\tfor ( let i = 0; i < numPoints; i++ ) {\n\t\t\t\t\tlet posSum = 0;\n\t\t\t\t\tlet negSum = 0;\n\t\t\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\t\t\tconst v = Number( series.data[ i ]?.value );\n\t\t\t\t\t\tif ( Number.isNaN( v ) ) continue;\n\t\t\t\t\t\tif ( v >= 0 ) posSum += v;\n\t\t\t\t\t\telse negSum += v;\n\t\t\t\t\t}\n\t\t\t\t\tif ( posSum > posMax ) posMax = posSum;\n\t\t\t\t\tif ( negSum < negMin ) negMin = negSum;\n\t\t\t\t}\n\t\t\t\treturn [ negMin, posMax ];\n\t\t\t}\n\n\t\t\tlet max = -Infinity;\n\t\t\tlet min = Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ) {\n\t\t\t\t\tconst v = Number( point?.value );\n\t\t\t\t\tif ( ! Number.isNaN( v ) ) {\n\t\t\t\t\t\tif ( v > max ) max = v;\n\t\t\t\t\t\tif ( v < min ) min = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( max === -Infinity ) return undefined;\n\t\t\treturn [ Math.min( 0, min ), max ];\n\t\t}, [ dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle ] );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst formatter = options?.axis?.x?.tickFormat || getFormatter( dataSorted );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.x,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\t// Stacked areas should always include zero so the baseline is meaningful.\n\t\t\t\t\tzero: stacked,\n\t\t\t\t\t...( fixedYDomain ? { domain: fixedYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, stacked, fixedYDomain, zoom.domain ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\tconst legendOptions = useMemo( () => ( { withGlyph: false, glyphSize: 0 } ), [] );\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( { stacked, stackOffset, smoothing, curveType } ),\n\t\t\t[ stacked, stackOffset, smoothing, curveType ]\n\t\t);\n\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'area',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\t\tconst animationEnabled = !! animation && ! prefersReducedMotion;\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\t\tconst zeroYAccessor = useCallback( () => 0, [] );\n\n\t\t// Hidden series are still registered with visx (so paths can interpolate), but their\n\t\t// data points should not appear in the tooltip.\n\t\tconst visibleLabels = useMemo(\n\t\t\t() => new Set( seriesWithVisibility.filter( s => s.isVisible ).map( s => s.series.label ) ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\t\tconst filteredRenderTooltip = useCallback(\n\t\t\t( params: Parameters< typeof renderTooltip >[ 0 ] ) => {\n\t\t\t\tif ( ! legendInteractive ) return renderTooltip( params );\n\t\t\t\tconst datumByKey = params?.tooltipData?.datumByKey;\n\t\t\t\tif ( ! datumByKey ) return renderTooltip( params );\n\t\t\t\tconst filtered = Object.fromEntries(\n\t\t\t\t\tObject.entries( datumByKey ).filter( ( [ key ] ) => visibleLabels.has( key ) )\n\t\t\t\t);\n\t\t\t\tif ( Object.keys( filtered ).length === 0 ) return null;\n\t\t\t\t// `nearestDatum` may still point at a hidden series; re-point it at the first\n\t\t\t\t// visible entry so consumers that read it (e.g. for the tooltip heading) don't\n\t\t\t\t// surface hidden-series state.\n\t\t\t\tconst nearestDatum = params?.tooltipData?.nearestDatum;\n\t\t\t\tconst nextNearest =\n\t\t\t\t\tnearestDatum && visibleLabels.has( nearestDatum.key )\n\t\t\t\t\t\t? nearestDatum\n\t\t\t\t\t\t: { ...Object.values( filtered )[ 0 ], distance: nearestDatum?.distance ?? 0 };\n\t\t\t\treturn renderTooltip( {\n\t\t\t\t\t...params,\n\t\t\t\t\ttooltipData: {\n\t\t\t\t\t\t...params.tooltipData,\n\t\t\t\t\t\tdatumByKey: filtered,\n\t\t\t\t\t\tnearestDatum: nextNearest,\n\t\t\t\t\t} as typeof params.tooltipData,\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ renderTooltip, legendInteractive, visibleLabels ]\n\t\t);\n\n\t\t// Defaults that depend on stacked vs overlapping mode.\n\t\tconst resolvedFillOpacity = fillOpacity ?? ( stacked ? 0.85 : 0.4 );\n\t\tconst resolvedWithStroke = withStroke ?? ! stacked;\n\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'area-chart', styles[ 'area-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'area-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\tconst visibleSeries = seriesWithVisibility.filter( ( { isVisible } ) => isVisible );\n\t\tconst curve = getCurveType( curveType, smoothing );\n\n\t\t// Visx's `<AreaStack>` keys each `<Area>` by `stackIndex-dataKey`, so filtering out\n\t\t// a hidden series would shift indexes and remount every path. Instead we keep every\n\t\t// series mounted and zero out hidden ones via `yAccessor` — react-spring then\n\t\t// interpolates the `d` attribute, giving a smooth \"going down\" effect for the\n\t\t// hidden area and a smooth re-flow for the rest.\n\t\tconst renderSeries = ( {\n\t\t\tseries: seriesData,\n\t\t\tindex,\n\t\t\tisVisible,\n\t\t}: ( typeof seriesWithVisibility )[ number ] ) => {\n\t\t\tconst { color, lineStyles } = getElementStyles( { data: seriesData, index } );\n\t\t\treturn (\n\t\t\t\t<AnimatedAreaSeries\n\t\t\t\t\tkey={ seriesData?.label || index }\n\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\txAccessor={ accessors.xAccessor }\n\t\t\t\t\tyAccessor={ isVisible || ! legendInteractive ? accessors.yAccessor : zeroYAccessor }\n\t\t\t\t\tfill={ color }\n\t\t\t\t\tfillOpacity={ resolvedFillOpacity }\n\t\t\t\t\t{ ...( stacked ? {} : { renderLine: resolvedWithStroke, curve } ) }\n\t\t\t\t\tlineProps={ { stroke: color, ...lineStyles } }\n\t\t\t\t\tdata-testid={ `area-chart-series-${ index }` }\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<SingleChartContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'area-chart',\n\t\t\t\t\t\tstyles[ 'area-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'area-chart--animated' ] ]: animationEnabled },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"area-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Area chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ { ...defaultMargin, ...margin } }\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ gridVisibility !== 'none' && <Grid columns={ false } numTicks={ 4 } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.x.display && <Axis { ...chartOptions.axis.x } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.y.display && <Axis { ...chartOptions.axis.y } /> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Area is animated, so clip the whole time it is zoomable to keep the zoom-out animation in bounds. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && stacked && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AnimatedAreaStack\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ curve }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ resolvedWithStroke }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</AnimatedAreaStack>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t! stacked &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tseriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Stacked mode: yAccessor returns raw value, not stacked y — snapping mispositions.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY={ ! stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ filteredRenderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'area-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HoverGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvisibleSeries={ visibleSeries }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstacked={ stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstackOffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrokeColor={ providerTheme.backgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t<AreaChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t// `||` — responsive HOC may pass `height = 0` before measurement.\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height || chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n);\n\ntype AreaChartSubComponents = {\n\tLegend: typeof Legend;\n};\n\ntype AreaChartBaseProps = Optional< AreaChartProps, 'width' | 'height' | 'size' >;\n\ntype AreaChartComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & React.RefAttributes< SingleChartRef >\n> &\n\tAreaChartSubComponents;\n\ntype AreaChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & ResponsiveConfig & React.RefAttributes< SingleChartRef >\n> &\n\tAreaChartSubComponents;\n\nconst AreaChartWithProvider = forwardRef< SingleChartRef, AreaChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\tif ( existingContext ) {\n\t\treturn <AreaChartInternal { ...props } ref={ ref } />;\n\t}\n\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<AreaChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nAreaChartWithProvider.displayName = 'AreaChart';\n\nconst AreaChart = attachSubComponents( AreaChartWithProvider, {\n\tLegend: Legend,\n} ) as AreaChartComponent;\n\nconst AreaChartResponsive = attachSubComponents(\n\twithResponsive< AreaChartProps >( AreaChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as AreaChartResponsiveComponent;\n\nexport { AreaChartResponsive as default, AreaChart as AreaChartUnresponsive };\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { isSafari } from '../../../utils';\nimport type { AxisScale, TickRendererProps } from '@visx/axis';\nimport type { FC, CSSProperties } from 'react';\n\n/**\n * Get the bandwidth of a scale\n *\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\treturn scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\ninterface TruncatedTickComponentProps extends TickRendererProps {\n\t/** Which axis this tick belongs to */\n\taxis: 'x' | 'y';\n}\n\n/**\n * Minimum width in pixels for tick labels when scale bandwidth is very small.\n * Prevents labels from collapsing to unreadable widths on dense charts.\n *\n * Trade-off: When bandwidth is less than this minimum (e.g., many bars in a narrow chart),\n * adjacent labels may overlap since each label uses this minimum width regardless of\n * available space. This prioritizes label readability over preventing overlap.\n *\n * For very dense charts where overlap occurs, consider:\n * - Using `numTicks` option to reduce the number of displayed labels\n * - Using `tickFormat` to abbreviate label text\n * - Increasing chart width or reducing data points\n */\nconst MIN_TICK_LABEL_WIDTH = 20;\n\n/**\n * A tick component that renders labels with text truncation (ellipsis) when they exceed\n * the available bandwidth. Shows the full text on hover via native title attribute.\n *\n * Uses foreignObject to embed HTML within SVG, enabling CSS text-overflow: ellipsis.\n * Inherits text styles from tickLabelProps passed by visx Axis component.\n *\n * Note: A minimum label width (MIN_TICK_LABEL_WIDTH) is enforced to keep labels readable.\n * On very dense charts where bandwidth < 20px, this may cause label overlap.\n * See MIN_TICK_LABEL_WIDTH documentation for mitigation strategies.\n *\n * @param props - The props for the truncated tick component\n * @param props.x - The x position of the tick\n * @param props.y - The y position of the tick\n * @param props.formattedValue - The formatted value of the tick\n * @param props.axis - The axis this tick belongs to\n * @param props.textAnchor - The text anchor of the tick\n * @param props.fill - The fill color of the tick\n * @param props.dy - The dy offset of the tick\n *\n * @return The truncated tick component\n */\nexport const TruncatedTickComponent: FC< TruncatedTickComponentProps > = ( {\n\tx,\n\ty,\n\tformattedValue,\n\taxis,\n\ttextAnchor,\n\tfill,\n\tdy,\n\t...textProps\n} ) => {\n\t// Get max width of the tick label\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst scale = axis === 'x' ? xScale : yScale;\n\tconst bandwidth = getScaleBandwidth( scale );\n\tconst maxWidth = Math.max( bandwidth, MIN_TICK_LABEL_WIDTH );\n\n\t// Map SVG textAnchor to CSS textAlign\n\tlet textAlign: 'left' | 'right' | 'center' = 'center';\n\tif ( textAnchor === 'start' ) {\n\t\ttextAlign = 'left';\n\t} else if ( textAnchor === 'end' ) {\n\t\ttextAlign = 'right';\n\t} else if ( textAnchor === 'middle' ) {\n\t\ttextAlign = 'center';\n\t}\n\n\t// Calculate x offset based on text alignment\n\tlet xOffset = 0;\n\tif ( textAlign === 'center' ) {\n\t\txOffset = -maxWidth / 2;\n\t} else if ( textAlign === 'right' ) {\n\t\txOffset = -maxWidth;\n\t}\n\n\t// Extract compatible style properties from SVG text props\n\tconst { fontSize, fontFamily, fontWeight, fontStyle, letterSpacing, opacity } = textProps as {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\topacity?: CSSProperties[ 'opacity' ];\n\t};\n\n\tconst textStyles: CSSProperties = {\n\t\t/**\n\t\t * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n\t\t * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n\t\t * we shift the div up by 100% of its height and adjust by twice the SVG dy value (from visx) to approximate original placement.\n\t\t */\n\t\ttransform: `translateY(calc(-100% + ${ dy ?? '0' } * 2))`,\n\t\t// Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n\t\t...( isSafari() ? { position: 'fixed' as const } : {} ),\n\t\t// Apply compatible SVG text styles\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tletterSpacing,\n\t\topacity,\n\t\t// Convert svg text styles to CSS styles for the div\n\t\tcolor: fill ?? 'inherit',\n\t\ttextAlign,\n\t\t// Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n\t\t// The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n\t\twidth: maxWidth,\n\t\toverflow: 'hidden',\n\t\ttextOverflow: 'ellipsis',\n\t\twhiteSpace: 'nowrap',\n\t\tcursor: 'default',\n\t\tpointerEvents: 'auto',\n\t};\n\n\treturn (\n\t\t<foreignObject x={ x + xOffset } y={ y } width={ maxWidth } height={ 0 } overflow=\"visible\">\n\t\t\t<div style={ textStyles } title={ formattedValue }>\n\t\t\t\t{ formattedValue }\n\t\t\t</div>\n\t\t</foreignObject>\n\t);\n};\n\n/**\n * Factory function to create a truncated tick component for a specific axis.\n * Returns a component that can be passed to visx's tickComponent prop.\n *\n * @param axis - The axis this tick component is for ('x' or 'y')\n * @return A tick component function compatible with visx's TickRendererProps\n */\nconst createTruncatedTickComponent = ( axis: 'x' | 'y' ) => ( props: TickRendererProps ) => {\n\treturn <TruncatedTickComponent { ...props } axis={ axis } />;\n};\n\n/**\n * Pre-created tick components for x and y axes.\n * These functions are created once at module initialization and reused,\n * avoiding repeated factory calls when configuring axes.\n */\nexport const TruncatedXTickComponent = createTruncatedTickComponent( 'x' );\nexport const TruncatedYTickComponent = createTruncatedTickComponent( 'y' );\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport { TruncatedXTickComponent, TruncatedYTickComponent } from './truncated-tick-component';\nimport type { EnhancedDataPoint } from '../../../hooks/use-zero-value-display';\nimport type { DataPointDate, BaseChartProps, SeriesData } from '../../../types';\nimport type { TickFormatter } from '@visx/axis';\n\n/** Outer padding of the category band scale (space at the chart edges). */\nexport const BASE_BAND_PADDING = 0.2;\n/** Inner padding of the category band scale (the base gap between ticks). */\nexport const BASE_BAND_PADDING_INNER = 0.1;\n\nconst formatDateTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t} );\n};\n\n/**\n * Get the group padding of a scale.\n *\n * @param scale - The scale to get the group padding of.\n * @return The group padding of the scale.\n */\nconst getGroupPadding = ( scale: Record< string, unknown > ): number => {\n\treturn typeof scale.paddingInner === 'number' ? ( scale.paddingInner as number ) : 0;\n};\n\n/**\n * Returns the merged options for the bar chart, including axis and scale configuration based on the orientation.\n *\n * @param data - The data to be displayed in the chart.\n * @param horizontal - Whether the chart is horizontal or vertical.\n * @param options - The options for the chart.\n * @return The merged options for the chart.\n */\nexport function useBarChartOptions(\n\tdata: SeriesData[],\n\thorizontal: boolean,\n\toptions: BaseChartProps[ 'options' ] = {}\n) {\n\tconst defaultOptions = useMemo( () => {\n\t\tconst bandScale = {\n\t\t\ttype: 'band' as const,\n\t\t\tpadding: BASE_BAND_PADDING,\n\t\t\tpaddingInner: BASE_BAND_PADDING_INNER,\n\t\t};\n\t\tconst linearScale = {\n\t\t\ttype: 'linear' as const,\n\t\t\tnice: true,\n\t\t\tzero: false,\n\t\t};\n\n\t\tconst labelFormatter = data?.[ 0 ]?.data?.[ 0 ]?.label\n\t\t\t? ( label: string ) => label\n\t\t\t: formatDateTick;\n\t\tconst valueFormatter = formatNumberCompact as TickFormatter< unknown >;\n\n\t\tconst labelAccessor = ( d: DataPointDate ) => d?.label || d?.date;\n\t\tconst valueAccessor = ( d: DataPointDate | EnhancedDataPoint ) => {\n\t\t\t// Use visualValue for bar rendering if available (for zero values), otherwise use value\n\t\t\tconst enhancedPoint = d as EnhancedDataPoint;\n\t\t\treturn enhancedPoint?.visualValue !== undefined ? enhancedPoint.visualValue : d?.value;\n\t\t};\n\n\t\treturn {\n\t\t\tvertical: {\n\t\t\t\txTickFormat: labelFormatter,\n\t\t\t\tyTickFormat: valueFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: labelAccessor,\n\t\t\t\tyAccessor: valueAccessor,\n\t\t\t\tgridVisibility: 'x',\n\t\t\t\txScale: bandScale,\n\t\t\t\tyScale: linearScale,\n\t\t\t},\n\t\t\thorizontal: {\n\t\t\t\txTickFormat: valueFormatter,\n\t\t\t\tyTickFormat: labelFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: valueAccessor,\n\t\t\t\tyAccessor: labelAccessor,\n\t\t\t\tgridVisibility: 'y',\n\t\t\t\txScale: linearScale,\n\t\t\t\tyScale: bandScale,\n\t\t\t},\n\t\t};\n\t}, [ data ] );\n\n\treturn useMemo( () => {\n\t\tconst orientationKey = horizontal ? 'horizontal' : 'vertical';\n\t\tconst {\n\t\t\txTickFormat,\n\t\t\tyTickFormat,\n\t\t\ttooltipLabelFormatter: defaultTooltipLabelFormatter,\n\t\t\txAccessor,\n\t\t\tyAccessor,\n\t\t\tgridVisibility,\n\t\t\txScale: baseXScale,\n\t\t\tyScale: baseYScale,\n\t\t} = defaultOptions[ orientationKey ];\n\n\t\t// When comparison series are present, visx only sees primary BarSeries and computes\n\t\t// a too-narrow domain. Compute an explicit domain spanning all series so comparison\n\t\t// shadows aren't clipped. Skip when the user has already provided an explicit domain.\n\t\tlet valueScaleDomainOverride: { domain?: [ number, number ] } = {};\n\t\tconst hasComparisonSeries = data.some( s => s.options?.type === 'comparison' );\n\t\tif ( hasComparisonSeries ) {\n\t\t\tconst valueAxisIsY = ! horizontal;\n\t\t\tconst userDomain = valueAxisIsY ? options.yScale?.domain : options.xScale?.domain;\n\t\t\tif ( ! userDomain ) {\n\t\t\t\tconst allValues: number[] = [];\n\t\t\t\tdata.forEach( series => {\n\t\t\t\t\tseries.data.forEach( d => {\n\t\t\t\t\t\tconst enhanced = d as { visualValue?: number };\n\t\t\t\t\t\tconst v =\n\t\t\t\t\t\t\tenhanced.visualValue !== undefined ? enhanced.visualValue : ( d.value as number );\n\t\t\t\t\t\tif ( typeof v === 'number' && Number.isFinite( v ) ) {\n\t\t\t\t\t\t\tallValues.push( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\tif ( allValues.length > 0 ) {\n\t\t\t\t\tvalueScaleDomainOverride = {\n\t\t\t\t\t\tdomain: [ Math.min( ...allValues ), Math.max( ...allValues ) ],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst xScale = {\n\t\t\t...baseXScale,\n\t\t\t...( options.xScale || {} ),\n\t\t\t...( horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst yScale = {\n\t\t\t...baseYScale,\n\t\t\t...( options.yScale || {} ),\n\t\t\t...( ! horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst providedToolTipLabelFormatter = horizontal\n\t\t\t? options.axis?.y?.tickFormat\n\t\t\t: options.axis?.x?.tickFormat;\n\n\t\tconst { labelOverflow: xLabelOverflow, ...xAxisOptions } = options.axis?.x || {};\n\t\tconst { labelOverflow: yLabelOverflow, ...yAxisOptions } = options.axis?.y || {};\n\n\t\treturn {\n\t\t\tgridVisibility,\n\t\t\txScale,\n\t\t\tyScale,\n\t\t\taccessors: {\n\t\t\t\txAccessor,\n\t\t\t\tyAccessor,\n\t\t\t},\n\t\t\taxis: {\n\t\t\t\tx: {\n\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: xTickFormat,\n\t\t\t\t\t...( xLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedXTickComponent } : {} ),\n\t\t\t\t\t...xAxisOptions,\n\t\t\t\t},\n\t\t\t\ty: {\n\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: yTickFormat,\n\t\t\t\t\t...( yLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedYTickComponent } : {} ),\n\t\t\t\t\t...yAxisOptions,\n\t\t\t\t},\n\t\t\t},\n\t\t\tbarGroup: {\n\t\t\t\tpadding: getGroupPadding( horizontal ? yScale : xScale ),\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tlabelFormatter: providedToolTipLabelFormatter || defaultTooltipLabelFormatter,\n\t\t\t},\n\t\t};\n\t}, [ defaultOptions, options, horizontal, data ] );\n}\n","export type ComparisonRect = { x: number; y: number; width: number; height: number };\n\ntype ValueScale = ( ( v: number ) => number ) & { range: () => unknown[] };\n\n/**\n * Output position of a value scale's baseline: zero if in-domain, else the\n * nearest range edge. Mirrors visx's getScaleBaseline so comparison shadows\n * sit on the same baseline as primary bars.\n *\n * @param {ValueScale} scale - The continuous value scale.\n * @return {number} The baseline output position in pixels.\n */\nexport function getValueScaleBaseline( scale: ValueScale ): number {\n\tconst [ a, b ] = scale.range().map( r => Number( r ) || 0 );\n\tconst isDescending = b < a;\n\tconst maybeZero = scale( 0 );\n\tconst [ minOutput, maxOutput ] = isDescending ? [ b, a ] : [ a, b ];\n\tif ( isDescending ) {\n\t\treturn Number.isFinite( maybeZero )\n\t\t\t? Math.min( Math.max( minOutput, maybeZero ), maxOutput )\n\t\t\t: maxOutput;\n\t}\n\treturn Number.isFinite( maybeZero )\n\t\t? Math.min( Math.max( maybeZero, minOutput ), maxOutput )\n\t\t: minOutput;\n}\n\n/**\n * Compute the rect for a comparison \"shadow\" bar, centered on the paired\n * primary bar slot and scaled by `widthFactor`.\n *\n * @param {object} params - Geometry inputs.\n * @param {boolean} params.horizontal - True for a horizontal bar chart, false for vertical.\n * @param {number} params.bandPosition - bandScale(category): start px of the category band.\n * @param {number} params.slotOffset - groupScale(primaryKey): offset of the primary slot within the band.\n * @param {number} params.slotThickness - groupScale.bandwidth(): primary bar thickness in px.\n * @param {number} params.valuePosition - valueScale(value): output px for the bar's data value.\n * @param {number} params.baseline - getValueScaleBaseline(valueScale): zero-line output px.\n * @param {number} params.widthFactor - Shadow thickness multiplier, e.g. 1.5 for 150% width.\n * @return {ComparisonRect} The {x, y, width, height} of the shadow rect.\n */\nexport function computeComparisonRect( params: {\n\thorizontal: boolean;\n\tbandPosition: number;\n\tslotOffset: number;\n\tslotThickness: number;\n\tvaluePosition: number;\n\tbaseline: number;\n\twidthFactor: number;\n} ): ComparisonRect {\n\tconst {\n\t\thorizontal,\n\t\tbandPosition,\n\t\tslotOffset,\n\t\tslotThickness,\n\t\tvaluePosition,\n\t\tbaseline,\n\t\twidthFactor,\n\t} = params;\n\tconst slotStart = bandPosition + slotOffset;\n\tconst shadowThickness = slotThickness * widthFactor;\n\tconst shadowStart = slotStart + slotThickness / 2 - shadowThickness / 2;\n\tconst valueStart = Math.min( valuePosition, baseline );\n\tconst valueLength = Math.abs( baseline - valuePosition );\n\n\tif ( horizontal ) {\n\t\treturn { x: valueStart, y: shadowStart, width: valueLength, height: shadowThickness };\n\t}\n\treturn { x: shadowStart, y: valueStart, width: shadowThickness, height: valueLength };\n}\n","// Shared comparison-mode tuning constants. These drive the geometry of the\n// translucent \"shadow\" bars and how the primary bars are narrowed to sit in front of them.\n\n/**\n * How much wider the comparison shadow is than the primary bar. Fallback used when the\n * theme value (`barChart.barStyles.comparison.widthFactor`) is absent. Also drives the\n * primary narrowing — the primary stays `1 / widthFactor` of the shadow.\n */\nexport const DEFAULT_COMPARISON_WIDTH_FACTOR = 1.5;\n\n/**\n * Opacity of the comparison shadow. Fallback used when the theme value\n * (`barChart.barStyles.comparison.opacity`) is absent.\n */\nexport const DEFAULT_COMPARISON_OPACITY = 0.5;\n\n/**\n * Fraction of each per-series step left as a gap between bars within a single tick.\n * Larger = more space between adjacent series; the shadow spans `1 - COMPARISON_INNER_GAP` of the step.\n */\nexport const COMPARISON_INNER_GAP = 0.1;\n\n/**\n * Upper clamp on the computed group padding, so bars can never collapse to zero width\n * even at very large `widthFactor` values.\n */\nexport const MAX_GROUP_PADDING = 0.9;\n\n/**\n * Factor applied to the category band's `paddingInner` in comparison mode to tighten the\n * gap between ticks. `0.75` = a 25% reduction of the tick-gap padding.\n */\nexport const COMPARISON_TICK_GAP_FACTOR = 0.75;\n","import { scaleBand } from '@visx/scale';\nimport { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { computeComparisonRect, getValueScaleBaseline } from './comparison-bars-geometry';\nimport {\n\tDEFAULT_COMPARISON_OPACITY,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n} from './comparison-constants';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { FC, ReactNode } from 'react';\n\nexport type ComparisonSeriesEntry = {\n\tseries: SeriesData;\n\tindex: number;\n\tprimaryKey: string;\n\t/** dataSorted index of the paired primary series (used to share its pattern fill). */\n\tprimaryIndex: number;\n};\n\n// Minimal shape we need from visx scales — avoids spreading `any` while\n// remaining compatible with both band and continuous scale return types.\ntype AnyScale = ( ( input: unknown ) => number ) & {\n\tbandwidth?: () => number;\n\trange: () => unknown[];\n};\n\n// Renders translucent \"shadow\" bars for comparison series behind their paired primary bars.\n// IMPORTANT: each comparison datum's category key (label or date) must exactly match a key\n// used by the primary series — if it doesn't, bandScale() returns undefined and the shadow\n// is silently skipped. Ensure comparison data reuses the same label/date values as primary.\nexport const ComparisonBars: FC< {\n\tcomparisonEntries: ComparisonSeriesEntry[];\n\tprimaryKeys: string[];\n\tgroupPadding: number;\n\thorizontal: boolean;\n\txAccessor: ( d: DataPointDate ) => string | number | Date | undefined;\n\tyAccessor: ( d: DataPointDate ) => number | undefined;\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\t/** Resolves the shadow fill — the paired primary's pattern when patterns are on, else a color. */\n\tresolveFill: ( entry: ComparisonSeriesEntry ) => string;\n} > = ( {\n\tcomparisonEntries,\n\tprimaryKeys,\n\tgroupPadding,\n\thorizontal,\n\txAccessor,\n\tyAccessor,\n\tgetElementStyles,\n\tresolveFill,\n} ) => {\n\tconst context = useContext( DataContext );\n\tconst xScale = context?.xScale as AnyScale | undefined;\n\tconst yScale = context?.yScale as AnyScale | undefined;\n\n\tif ( ! xScale || ! yScale || primaryKeys.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// Vertical: band axis is x, value axis is y. Horizontal: reversed.\n\tconst bandScale = ( horizontal ? yScale : xScale ) as AnyScale;\n\tconst valueScale = ( horizontal ? xScale : yScale ) as AnyScale;\n\n\tconst bandwidth = bandScale.bandwidth ? bandScale.bandwidth() : 0;\n\tif ( ! bandwidth ) {\n\t\treturn null;\n\t}\n\n\t// Rebuild visx's inner group scale exactly as BarGroup does.\n\tconst groupScale = scaleBand( {\n\t\tdomain: primaryKeys,\n\t\trange: [ 0, bandwidth ],\n\t\tpadding: groupPadding,\n\t} );\n\tconst slotThickness = groupScale.bandwidth();\n\tconst baseline = getValueScaleBaseline( valueScale );\n\n\t// Vertical uses xAccessor for category label; horizontal uses yAccessor.\n\tconst bandAccessor = horizontal ? yAccessor : xAccessor;\n\tconst valueAccessor = horizontal ? xAccessor : yAccessor;\n\n\tconst rects: ReactNode[] = [];\n\n\tcomparisonEntries.forEach( entry => {\n\t\tconst { series, index, primaryKey } = entry;\n\t\tconst slotOffset = groupScale( primaryKey );\n\t\tif ( slotOffset == null || ! Number.isFinite( slotOffset ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { barStyles } = getElementStyles( { data: series, index } );\n\t\tconst opacity = barStyles?.opacity ?? DEFAULT_COMPARISON_OPACITY; // safety net; CompleteChartTheme guarantees this value\n\t\tconst widthFactor = barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR;\n\t\t// Fill is the paired primary's pattern (when patterns are on) or its resolved color.\n\t\tconst fill = resolveFill( entry );\n\t\t// The shadow is `widthFactor` × the (narrowed) primary slot. bar-chart.tsx narrows the\n\t\t// primary bars by widening the group padding so this ratio holds with real geometry.\n\n\t\t( series.data as DataPointDate[] ).forEach( ( datum, i ) => {\n\t\t\tconst bandPosition = Number( bandScale( bandAccessor( datum ) as never ) );\n\t\t\tconst valuePosition = Number( valueScale( Number( valueAccessor( datum ) ) as never ) );\n\n\t\t\tif ( ! Number.isFinite( bandPosition ) || ! Number.isFinite( valuePosition ) ) {\n\t\t\t\tif ( process.env.NODE_ENV !== 'production' && ! Number.isFinite( bandPosition ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[Charts] ComparisonBars: datum key \"${ String(\n\t\t\t\t\t\t\tbandAccessor( datum )\n\t\t\t\t\t\t) }\" did not match any primary category. Shadow will not be rendered. ` +\n\t\t\t\t\t\t\t'Ensure comparison series data uses the same label/date keys as the primary series.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rect = computeComparisonRect( {\n\t\t\t\thorizontal,\n\t\t\t\tbandPosition,\n\t\t\t\tslotOffset: slotOffset as number,\n\t\t\t\tslotThickness,\n\t\t\t\tvaluePosition,\n\t\t\t\tbaseline,\n\t\t\t\twidthFactor,\n\t\t\t} );\n\n\t\t\trects.push(\n\t\t\t\t<rect\n\t\t\t\t\tkey={ `${ index }-${ i }` }\n\t\t\t\t\tdata-testid={ `bar-chart-comparison-${ index }-${ i }` }\n\t\t\t\t\tx={ rect.x }\n\t\t\t\t\ty={ rect.y }\n\t\t\t\t\twidth={ rect.width }\n\t\t\t\t\theight={ rect.height }\n\t\t\t\t\tfill={ fill }\n\t\t\t\t\topacity={ opacity }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t} );\n\n\tif ( rects.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<g\n\t\t\tclassName=\"bar-chart__comparison-bars\"\n\t\t\tpointerEvents=\"none\"\n\t\t\tdata-testid=\"bar-chart-comparison-bars\"\n\t\t>\n\t\t\t{ rects }\n\t\t</g>\n\t);\n};\n","import { formatNumber } from '@automattic/number-formatters';\nimport { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from '@visx/pattern';\nimport { Axis, BarSeries, BarGroup, Grid, XYChart } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useState, useRef, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseZeroValueDisplay,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './bar-chart.module.scss';\nimport {\n\tuseBarChartOptions,\n\tComparisonBars,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n\tCOMPARISON_INNER_GAP,\n\tMAX_GROUP_PADDING,\n\tCOMPARISON_TICK_GAP_FACTOR,\n\tBASE_BAND_PADDING_INNER,\n} from './private';\nimport type { ComparisonSeriesEntry } from './private';\nimport type { BaseChartProps, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { FC, ReactNode, ComponentType } from 'react';\n\nexport interface BarChartProps extends BaseChartProps< SeriesData[] > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\torientation?: 'horizontal' | 'vertical';\n\twithPatterns?: boolean;\n\tshowZeroValues?: boolean;\n\tchildren?: ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype BarChartBaseProps = Optional< BarChartProps, 'width' | 'height' | 'size' >;\n\n// Composition API types\ninterface BarChartSubComponents {\n\tLegend: ComponentType< React.ComponentProps< typeof Legend > >;\n}\n\ntype BarChartComponent = FC< BarChartBaseProps > & BarChartSubComponents;\ntype BarChartResponsiveComponent = FC< BarChartBaseProps & ResponsiveConfig > &\n\tBarChartSubComponents;\n\n// Validation function similar to LineChart\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\tpoint =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( ! point.label &&\n\t\t\t\t\t( ! ( 'date' in point && point.date ) || isNaN( point.date.getTime() ) ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\nconst getPatternId = ( chartId: string, index: number ) => `bar-pattern-${ chartId }-${ index }`;\n\nconst BarChartInternal: FC< BarChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth,\n\theight,\n\tclassName,\n\tmargin,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tgridVisibility: gridVisibilityProp,\n\trenderTooltip,\n\toptions = {},\n\torientation = 'vertical',\n\twithPatterns = false,\n\tshowZeroValues = false,\n\tanimation,\n\tchildren,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst horizontal = orientation === 'horizontal';\n\tconst chartId = useChartId( providedChartId );\n\tconst theme = useXYChartTheme( data );\n\n\tconst dataSorted = useChartDataTransform( data );\n\n\t// Transform data to add a small value for zero bars to make them visible\n\t// For vertical bars, height determines bar pixel height; for horizontal bars, width does\n\tconst dataWithVisibleZeros = useZeroValueDisplay( dataSorted, {\n\t\tenabled: showZeroValues,\n\t\tvalueAxisLength: horizontal ? width : height,\n\t} );\n\n\t// Create legend items using the reusable hook\n\tconst legendItems = useChartLegendItems( dataSorted );\n\tconst chartOptions = useBarChartOptions( dataWithVisibleZeros, horizontal, options );\n\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme, horizontal );\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\n\t// Process children for composition API (Legend, etc.)\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'BarChart' );\n\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\tconst handleContentHeightChange = useCallback(\n\t\t( contentHeight: number ) => {\n\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t},\n\t\t[ height ]\n\t);\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\n\t// Comparison series have no .visx-bar elements; count only primary series so\n\t// keyboard navigation doesn't cycle phantom indices into comparison-only slots.\n\tconst primarySeriesForNav = dataWithVisibleZeros.filter( s => s.options?.type !== 'comparison' );\n\tconst totalPoints =\n\t\tMath.max( 0, ...primarySeriesForNav.map( s => s.data?.length || 0 ) ) *\n\t\tprimarySeriesForNav.length;\n\n\t// Use the keyboard navigation hook\n\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\tselectedIndex,\n\t\tsetSelectedIndex,\n\t\tisNavigating,\n\t\tsetIsNavigating,\n\t\tchartRef,\n\t\ttotalPoints,\n\t} );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Add visibility information to series when using interactive legends\n\tconst seriesWithVisibility = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: true,\n\t\t\t} ) );\n\t\t}\n\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\tseries,\n\t\t\tindex,\n\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t} ) );\n\t}, [ dataWithVisibleZeros, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t}, [ seriesWithVisibility ] );\n\n\t// Derive primary vs comparison entries for comparison mode support.\n\tconst primaryEntries = useMemo(\n\t\t() =>\n\t\t\tseriesWithVisibility.filter(\n\t\t\t\t( { isVisible, series } ) => isVisible && series.options?.type !== 'comparison'\n\t\t\t),\n\t\t[ seriesWithVisibility ]\n\t);\n\n\tconst primaryKeys = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series.label ),\n\t\t[ primaryEntries ]\n\t);\n\n\tconst comparisonEntries = useMemo( () => {\n\t\tconst primaryByGroup = new Map< string | undefined, { label: string; index: number } >(\n\t\t\tprimaryEntries.map( ( { series, index } ) => [\n\t\t\t\tseries.group,\n\t\t\t\t{ label: series.label, index },\n\t\t\t] )\n\t\t);\n\n\t\tconst entries: ComparisonSeriesEntry[] = [];\n\t\tseriesWithVisibility.forEach( ( { series, index, isVisible } ) => {\n\t\t\tif ( ! isVisible || series.options?.type !== 'comparison' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst primary =\n\t\t\t\tprimaryByGroup.get( series.group ) ??\n\t\t\t\t( primaryEntries.length === 1\n\t\t\t\t\t? { label: primaryEntries[ 0 ].series.label, index: primaryEntries[ 0 ].index }\n\t\t\t\t\t: undefined );\n\t\t\tif ( ! primary || ! primaryKeys.includes( primary.label ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentries.push( { series, index, primaryKey: primary.label, primaryIndex: primary.index } );\n\t\t} );\n\t\treturn entries;\n\t}, [ seriesWithVisibility, primaryEntries, primaryKeys ] );\n\n\t// Comparison widthFactor (how much wider the shadow is than the primary) drives both the\n\t// shadow width (in ComparisonBars) and the primary narrowing.\n\tconst comparisonWidthFactor = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) return undefined;\n\t\treturn (\n\t\t\tgetElementStyles( {\n\t\t\t\tdata: comparisonEntries[ 0 ].series,\n\t\t\t\tindex: comparisonEntries[ 0 ].index,\n\t\t\t} ).barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR\n\t\t);\n\t}, [ comparisonEntries, getElementStyles ] );\n\n\t// Narrow the primary bars by widening the visx group padding — a real geometry change, so\n\t// pattern fills and borders are not distorted (unlike a CSS transform/scale). The padding is\n\t// set so the comparison shadow (drawn at slot × widthFactor) fills all but a small gap of each\n\t// per-series step, leaving a small gap between series within a tick (the larger gap between\n\t// ticks comes from the category band's own padding). Because shadow = step × (1 - p) ×\n\t// widthFactor, choosing p = 1 - (1 - innerGap)/widthFactor makes the shadow span (1 - innerGap)\n\t// of the step; the primary stays 1/widthFactor of the shadow.\n\tconst groupPadding = useMemo( () => {\n\t\tconst basePadding = chartOptions.barGroup.padding;\n\t\tif ( ! comparisonWidthFactor || comparisonWidthFactor <= 1 ) {\n\t\t\treturn basePadding;\n\t\t}\n\t\tconst p = 1 - ( 1 - COMPARISON_INNER_GAP ) / comparisonWidthFactor;\n\t\treturn Math.min( Math.max( p, basePadding ), MAX_GROUP_PADDING );\n\t}, [ chartOptions.barGroup.padding, comparisonWidthFactor ] );\n\n\t// In comparison mode, tighten the gap between ticks by reducing the category band's inner\n\t// padding (the value axis is left untouched). COMPARISON_TICK_GAP_FACTOR is the multiplier.\n\tconst { xScale, yScale } = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) {\n\t\t\treturn { xScale: chartOptions.xScale, yScale: chartOptions.yScale };\n\t\t}\n\t\tconst tighten = < T extends object >( scale: T ): T =>\n\t\t\t( {\n\t\t\t\t...scale,\n\t\t\t\tpaddingInner:\n\t\t\t\t\t( ( scale as { paddingInner?: number } ).paddingInner ?? BASE_BAND_PADDING_INNER ) *\n\t\t\t\t\tCOMPARISON_TICK_GAP_FACTOR,\n\t\t\t} ) as T;\n\t\treturn horizontal\n\t\t\t? { xScale: chartOptions.xScale, yScale: tighten( chartOptions.yScale ) }\n\t\t\t: { xScale: tighten( chartOptions.xScale ), yScale: chartOptions.yScale };\n\t}, [ comparisonEntries.length, chartOptions.xScale, chartOptions.yScale, horizontal ] );\n\n\tconst getBarBackground = useCallback(\n\t\t( index: number ) => () =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, index ) })`\n\t\t\t\t: getElementStyles( { data: dataSorted[ index ], index } ).color,\n\t\t[ withPatterns, getElementStyles, dataSorted, chartId ]\n\t);\n\n\t// Comparison shadow fill: when patterns are on, reuse the paired primary's pattern so the\n\t// shadow reads as the same series; otherwise use the comparison series' resolved color.\n\tconst resolveComparisonFill = useCallback(\n\t\t( entry: ComparisonSeriesEntry ) =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, entry.primaryIndex ) })`\n\t\t\t\t: getElementStyles( { data: entry.series, index: entry.index } ).color,\n\t\t[ withPatterns, chartId, getElementStyles ]\n\t);\n\n\tconst renderDefaultTooltip = useCallback(\n\t\t( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\t\t\tif ( ! nearestDatum ) return null;\n\n\t\t\tconst primaryKey = tooltipData?.nearestDatum?.key;\n\t\t\tconst categoryLabel = chartOptions.tooltip.labelFormatter(\n\t\t\t\tnearestDatum.label || ( nearestDatum.date ? nearestDatum.date.getTime() : 0 ),\n\t\t\t\t0,\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\t// Find the comparison value paired with the hovered primary series (same group)\n\t\t\t// at the same category, so the tooltip can show both periods at once.\n\t\t\tconst comparisonEntry = comparisonEntries.find( entry => entry.primaryKey === primaryKey );\n\t\t\tconst comparisonDatum = comparisonEntry?.series.data.find( point => {\n\t\t\t\tconst p = point as DataPointDate;\n\t\t\t\treturn nearestDatum.label != null\n\t\t\t\t\t? p.label === nearestDatum.label\n\t\t\t\t\t: !! nearestDatum.date && !! p.date && p.date.getTime() === nearestDatum.date.getTime();\n\t\t\t} ) as DataPointDate | undefined;\n\n\t\t\t// With a paired comparison value, show the category as the header and one row\n\t\t\t// per period (primary + comparison).\n\t\t\tif ( comparisonEntry && comparisonDatum && comparisonDatum.value != null ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ categoryLabel }</div>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-label' ] }>{ primaryKey }:</span>\n\t\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-value' ] }>\n\t\t\t\t\t\t\t\t{ formatNumber( nearestDatum.value as number ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-label' ] }>\n\t\t\t\t\t\t\t\t{ comparisonEntry.series.label }:\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-value' ] }>\n\t\t\t\t\t\t\t\t{ formatNumber( comparisonDatum.value as number ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ primaryKey }</div>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-label' ] }>{ categoryLabel }:</span>\n\t\t\t\t\t\t<span className={ styles[ 'bar-chart__tooltip-value' ] }>\n\t\t\t\t\t\t\t{ formatNumber( nearestDatum.value as number ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[ chartOptions.tooltip, comparisonEntries ]\n\t);\n\n\tconst renderPattern = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternType = index % 4;\n\t\t\tconst id = getPatternId( chartId, index );\n\t\t\tconst commonProps = {\n\t\t\t\tid,\n\t\t\t\tstroke: 'white',\n\t\t\t\tstrokeWidth: 1,\n\t\t\t\tbackground: color,\n\t\t\t};\n\n\t\t\tswitch ( patternType ) {\n\t\t\t\tcase 0:\n\t\t\t\tdefault:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternLines\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\twidth={ 5 }\n\t\t\t\t\t\t\theight={ 5 }\n\t\t\t\t\t\t\torientation={ [ 'diagonal' ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\tcase 1:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternCircles key={ id } { ...commonProps } width={ 6 } height={ 6 } fill=\"white\" />\n\t\t\t\t\t);\n\t\t\t\tcase 2:\n\t\t\t\t\treturn <PatternWaves key={ id } { ...commonProps } width={ 4 } height={ 4 } />;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn <PatternHexagons key={ id } { ...commonProps } size={ 8 } height={ 3 } />;\n\t\t\t}\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createPatternBorderStyle = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternId = getPatternId( chartId, index );\n\t\t\t// Border the primary bars and any comparison shadow reusing the same pattern,\n\t\t\t// so a patterned shadow gets the same outline as its primary bar.\n\t\t\treturn `\n\t\t\t.visx-bar[fill=\"url(#${ patternId })\"],\n\t\t\t.bar-chart__comparison-bars rect[fill=\"url(#${ patternId })\"] {\n\t\t\t\tstroke: ${ color };\n\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t`;\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createKeyboardHighlightStyle = useCallback( () => {\n\t\tif ( selectedIndex === undefined ) return '';\n\n\t\t// Use only primary entries — comparison series have no .visx-bar elements so\n\t\t// their indices must not appear in the nth-child selector.\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tconst primaryCount = primaryEntries.length;\n\t\tconst maxDataPoints = Math.max( ...primaryEntries.map( e => e.series.data.length ) );\n\t\tconst dataPointIndex = Math.floor( selectedIndex / primaryCount );\n\t\tconst seriesIndex = selectedIndex % primaryCount;\n\n\t\t// Only highlight if we're within valid bounds\n\t\tif ( dataPointIndex >= maxDataPoints || seriesIndex >= primaryCount ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst seriesData = primaryEntries[ seriesIndex ]?.series;\n\t\tif ( ! seriesData || dataPointIndex >= seriesData.data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Based on the DOM structure analysis:\n\t\t// - All bars are in a single .visx-bar-group\n\t\t// - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n\t\t// - So we need to calculate the actual bar index in the DOM\n\t\tconst actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n\t\t// Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n\t\tconst generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${ chartId }\"] .visx-bar-group .visx-bar:nth-child(${\n\t\t\t\tactualBarIndex + 1\n\t\t\t}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n\n\t\treturn generatedStyles;\n\t}, [ selectedIndex, primaryEntries, chartId ] );\n\n\t// Validate data first\n\tconst error = validateData( dataSorted );\n\tconst isDataValid = ! error;\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\torientation,\n\t\t\twithPatterns,\n\t\t} ),\n\t\t[ orientation, withPatterns ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'bar',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( error ) {\n\t\treturn <div className={ clsx( 'bar-chart', styles[ 'bar-chart' ] ) }>{ error }</div>;\n\t}\n\n\tconst gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n\tconst highlightedBarStyle = createKeyboardHighlightStyle();\n\n\tconst legendPosition = legend.position ?? 'bottom';\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tclassName={ styles[ 'bar-chart__legend' ] }\n\t\t\tshape={ legend.shape ?? 'rect' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tchartId,\n\t\t\t\tchartWidth: width,\n\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t} }\n\t\t>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'bar-chart',\n\t\t\t\t\tstyles[ 'bar-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ `bar-chart--animated${ horizontal ? '-horizontal' : '' }` ] ]:\n\t\t\t\t\t\t\tanimation && ! prefersReducedMotion,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { width, height } }\n\t\t\t\tdata-testid=\"bar-chart\"\n\t\t\t\tdata-chart-id={ `bar-chart-${ chartId }` }\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t>\n\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\taria-label={ __( 'Bar chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t<div ref={ chartRef }>\n\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\txScale={ xScale }\n\t\t\t\t\t\t\t\t\t\tyScale={ yScale }\n\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\t\t\tcolumns={ gridVisibility.includes( 'y' ) }\n\t\t\t\t\t\t\t\t\t\t\trows={ gridVisibility.includes( 'x' ) }\n\t\t\t\t\t\t\t\t\t\t\tnumTicks={ 4 }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t{ withPatterns && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<defs data-testid=\"bar-chart-patterns\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderPattern(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreatePatternBorderStyle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ highlightedBarStyle && <style>{ highlightedBarStyle }</style> }\n\n\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t<ComparisonBars\n\t\t\t\t\t\t\t\t\t\t\tcomparisonEntries={ comparisonEntries }\n\t\t\t\t\t\t\t\t\t\t\tprimaryKeys={ primaryKeys }\n\t\t\t\t\t\t\t\t\t\t\tgroupPadding={ groupPadding }\n\t\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\tyAccessor={\n\t\t\t\t\t\t\t\t\t\t\t\tchartOptions.accessors.yAccessor as (\n\t\t\t\t\t\t\t\t\t\t\t\t\td: DataPointDate\n\t\t\t\t\t\t\t\t\t\t\t\t) => number | undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\tresolveFill={ resolveComparisonFill }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t<BarGroup padding={ groupPadding }>\n\t\t\t\t\t\t\t\t\t\t\t{ primaryEntries.map( ( { series: seriesData, index } ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BarSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\tyAccessor={ chartOptions.accessors.yAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorAccessor={ getBarBackground( index ) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t\t</BarGroup>\n\n\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\n\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip || renderDefaultTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'bar-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tseries={ data }\n\t\t\t\t\t\t\t\t\t\t\t\tmode=\"individual\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst BarChartWithProvider: FC< BarChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <BarChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents( BarChartWithProvider, {\n\tLegend: Legend,\n} ) as BarChartComponent;\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(\n\twithResponsive< BarChartProps >( BarChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as BarChartResponsiveComponent;\n\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { Group } from '@visx/group';\nimport { createScale, scaleBand } from '@visx/scale';\nimport { Text, type TextProps } from '@visx/text';\nimport { useContext, useMemo } from 'react';\nimport { GlobalChartsContext, GlobalChartsProvider } from '../../providers';\nimport { BarChartUnresponsive } from '../bar-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport type { SeriesData } from '../..';\nimport type { ScaleOptions } from '../../types';\nimport type { BarChartProps } from '../bar-chart/bar-chart';\nimport type { AxisRendererProps, AxisScale } from '@visx/axis';\nimport type { AnyD3Scale } from '@visx/scale';\nimport type { ComponentType, FC } from 'react';\n\nexport interface BarListChartProps\n\textends Exclude< BarChartProps, 'orientation' | 'size' | 'gridVisibility' > {\n\toptions?: {\n\t\t/**\n\t\t * Scale for the y axis. Exclude the type property.\n\t\t */\n\t\tyScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Scale for the x axis. Exclude the type property.\n\t\t */\n\t\txScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Formatter for the label.\n\t\t */\n\t\tlabelFormatter?: ( value: string ) => string;\n\t\t/**\n\t\t * Formatter for the value.\n\t\t */\n\t\tvalueFormatter?: ( value: number ) => string;\n\t\t/**\n\t\t * y offset of the label and value. Default is based on the number of series, automatically computed.\n\t\t */\n\t\tyOffset?: number;\n\t\t/**\n\t\t * x position of the label.\n\t\t */\n\t\tlabelPosition?: number;\n\t\t/**\n\t\t * x position of the value.\n\t\t */\n\t\tvaluePosition?: number;\n\t\t/**\n\t\t * Custom render function for the label.\n\t\t */\n\t\tlabelComponent?: ComponentType< RenderLabelProps >;\n\t\t/**\n\t\t * Custom render function for the value.\n\t\t */\n\t\tvalueComponent?: ComponentType< RenderValueProps >;\n\t};\n}\n\nexport interface RenderLabelProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tlabel: string;\n\tformatter: ( value: string ) => string;\n}\n\nexport interface RenderValueProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tvalue: number;\n\t/**\n\t * Original data\n\t */\n\tdata: SeriesData[];\n\t/**\n\t * Index of the data point\n\t */\n\tindex: number;\n\tformatter: ( value: number ) => string;\n}\n\n/**\n * Get the bandwidth of a scale\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\t// Broaden type before using 'xxx' in s as typeguard.\n\tconst s = scale as AxisScale;\n\treturn s && 'bandwidth' in s ? s?.bandwidth() ?? 0 : 0;\n};\n\nconst DefaultLabelComponent = ( { textProps, x, y, label, formatter } ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"start\" x={ x } y={ y }>\n\t\t\t{ formatter( label ) }\n\t\t</Text>\n\t);\n};\n\nconst DefaultValueComponent = ( { textProps, x, y, value, formatter }: RenderValueProps ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"end\" x={ x } y={ y } fontWeight={ 500 }>\n\t\t\t{ formatter( value ) }\n\t\t</Text>\n\t);\n};\n\nconst AxisRenderer = ( {\n\tticks,\n\ttickLabelProps,\n\tyOffset,\n\tlabelPosition,\n\tvaluePosition,\n\tdata,\n\tlabelFormatter,\n\tvalueFormatter,\n\tLabelComponent = DefaultLabelComponent,\n\tValueComponent = DefaultValueComponent,\n}: AxisRendererProps< AnyD3Scale > & {\n\tyOffset: number;\n\tlabelPosition: number;\n\tvaluePosition: number;\n\tdata: SeriesData[];\n\tlabelFormatter?: ( value: string ) => string;\n\tvalueFormatter?: ( value: number ) => string;\n\tLabelComponent?: ComponentType< RenderLabelProps >;\n\tValueComponent?: ComponentType< RenderValueProps >;\n} ) => {\n\tif ( ticks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// compute the max tick label size to compute label offset\n\tconst allTickLabelProps = ticks.map( ( { value, index } ) =>\n\t\ttypeof tickLabelProps === 'function' ? tickLabelProps( value, index, ticks ) : {}\n\t);\n\n\treturn ticks.map( ( { from, formattedValue }, index ) => {\n\t\tconst textProps = allTickLabelProps[ index ] ?? {};\n\t\t// No need to pass textAnchor and dx. It will be handled by the component.\n\t\tdelete textProps.textAnchor;\n\t\tdelete textProps.dx;\n\n\t\tconst sum = data.reduce(\n\t\t\t( acc, { data: seriesData } ) => acc + ( seriesData[ index ]?.value ?? 0 ),\n\t\t\t0\n\t\t);\n\t\tconst y = from.y + yOffset;\n\n\t\treturn (\n\t\t\t<Group key={ index }>\n\t\t\t\t<LabelComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ labelPosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tlabel={ formattedValue }\n\t\t\t\t\tformatter={ labelFormatter }\n\t\t\t\t/>\n\t\t\t\t<ValueComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ valuePosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tvalue={ sum }\n\t\t\t\t\tformatter={ valueFormatter }\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tindex={ index }\n\t\t\t\t/>\n\t\t\t</Group>\n\t\t);\n\t} );\n};\n\n/**\n * Calculate the default y offset for the bar list chart.\n * @param data - The data to calculate the default y offset for.\n * @param yScaleConfig - The y scale configuration.\n * @param height - The height of the chart.\n * @param isMultiSeries - Whether the chart is a multi series chart.\n * @return The default y offset.\n */\nconst getDefaultYOffset = (\n\tdata: SeriesData[],\n\tyScaleConfig: Omit< ScaleOptions, 'type' >,\n\theight: number,\n\tisMultiSeries: boolean\n) => {\n\tif ( ! isMultiSeries ) {\n\t\treturn 0;\n\t}\n\n\tconst dataKeys = data.map( ( { label } ) => label );\n\n\tconst yScale = createScale< string >( {\n\t\ttype: 'band' as const,\n\t\trange: [ 0, height ],\n\t\tdomain: dataKeys,\n\t\t...yScaleConfig,\n\t} );\n\n\tconst groupScale = scaleBand< string >( {\n\t\tdomain: dataKeys,\n\t\trange: [ 0, getScaleBandwidth( yScale ) ],\n\t\tpadding: yScaleConfig.paddingInner,\n\t} );\n\n\tconst GAP_BETWEEN_BARS = 6;\n\tconst barThickness = getScaleBandwidth( groupScale );\n\n\t// Use negative value to move the label up.\n\treturn -( barThickness + GAP_BETWEEN_BARS );\n};\n\nconst BarListChartInternal: FC< BarListChartProps > = ( {\n\tdata,\n\twidth,\n\theight,\n\toptions = {},\n\tmargin = {\n\t\tleft: 0,\n\t\tright: 20,\n\t\tbottom: 0,\n\t\ttop: 0,\n\t},\n\t...rest\n} ) => {\n\tconst chartOptions = useMemo( () => {\n\t\tconst isMultiSeries = data.length > 1;\n\n\t\tconst defaultYScale = {\n\t\t\t// For multi series, set default padding larger to look better.\n\t\t\tpaddingInner: isMultiSeries ? 0.3 : 0.1,\n\t\t\tpadding: isMultiSeries ? 0.3 : 0.1,\n\t\t};\n\t\tconst defaultXScale = {\n\t\t\t// Always begin at zero since the x axis is hidden.\n\t\t\tzero: true,\n\t\t};\n\t\tconst yScale = {\n\t\t\t...defaultYScale,\n\t\t\t...( options.yScale ?? {} ),\n\t\t};\n\t\tconst xScale = {\n\t\t\t...defaultXScale,\n\t\t\t...( options.xScale ?? {} ),\n\t\t};\n\n\t\treturn {\n\t\t\tyScale,\n\t\t\txScale,\n\t\t\tlabelPosition: options.labelPosition ?? ( isMultiSeries ? 0 : 10 ),\n\t\t\tvalueFormatter: options.valueFormatter ?? ( value => formatNumberCompact( value ) ),\n\t\t\tlabelFormatter: options.labelFormatter ?? ( value => String( value ) ),\n\t\t\tvaluePosition: options.valuePosition ?? width,\n\t\t\tyOffset: options.yOffset ?? getDefaultYOffset( data, yScale, height, isMultiSeries ),\n\t\t};\n\t}, [ options, width, data, height ] );\n\n\treturn (\n\t\t<BarChartUnresponsive\n\t\t\torientation=\"horizontal\"\n\t\t\tgridVisibility={ 'none' }\n\t\t\tdata={ data }\n\t\t\twidth={ width }\n\t\t\theight={ height }\n\t\t\tmargin={ margin }\n\t\t\toptions={ {\n\t\t\t\taxis: {\n\t\t\t\t\ty: {\n\t\t\t\t\t\tchildren: ( renderProps: AxisRendererProps< AnyD3Scale > ) => (\n\t\t\t\t\t\t\t<AxisRenderer\n\t\t\t\t\t\t\t\t{ ...renderProps }\n\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\tyOffset={ chartOptions.yOffset }\n\t\t\t\t\t\t\t\tlabelPosition={ chartOptions.labelPosition }\n\t\t\t\t\t\t\t\tvaluePosition={ chartOptions.valuePosition }\n\t\t\t\t\t\t\t\tlabelFormatter={ chartOptions.labelFormatter }\n\t\t\t\t\t\t\t\tvalueFormatter={ chartOptions.valueFormatter }\n\t\t\t\t\t\t\t\tLabelComponent={ options.labelComponent }\n\t\t\t\t\t\t\t\tValueComponent={ options.valueComponent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tx: {\n\t\t\t\t\t\tchildren: () => null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: chartOptions.xScale,\n\t\t\t\tyScale: chartOptions.yScale,\n\t\t\t} }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nconst BarListChart: FC< BarListChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <BarListChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarListChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarListChart.displayName = 'BarListChart';\n\nconst BarListChartResponsive = withResponsive< BarListChartProps >( BarListChart );\n\nexport { BarListChartResponsive as default, BarListChart as BarListChartUnresponsive };\n","import { useCallback, useState } from 'react';\n\n/**\n * Custom hook to manage funnel bar selection state and interactions\n * @param hideTooltip - Function to hide tooltip when selection is cleared\n * @return Object containing selection state and event handlers\n */\nexport const useFunnelSelection = ( hideTooltip?: () => void ) => {\n\tconst [ clickedStep, setClickedStep ] = useState< string | null >( null );\n\n\t// Handle bar click\n\tconst handleBarClick = useCallback(\n\t\t( stepId: string ) => {\n\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t// If clicking the same step, deselect it\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t} else {\n\t\t\t\t// Otherwise, select this step\n\t\t\t\tsetClickedStep( stepId );\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Handle bar keydown\n\tconst handleBarKeyDown = useCallback(\n\t\t( stepId: string, event: React.KeyboardEvent ) => {\n\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t\tsetClickedStep( null );\n\t\t\t\t\thideTooltip?.();\n\t\t\t\t} else {\n\t\t\t\t\tsetClickedStep( stepId );\n\t\t\t\t}\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Clear selection (for chart-level click)\n\tconst clearSelection = useCallback( () => {\n\t\tsetClickedStep( null );\n\t\thideTooltip?.();\n\t}, [ hideTooltip ] );\n\n\t// Get step state helpers\n\tconst getStepState = useCallback(\n\t\t( stepId: string ) => ( {\n\t\t\tisClicked: clickedStep === stepId,\n\t\t\tisBlurred: clickedStep !== null && clickedStep !== stepId,\n\t\t} ),\n\t\t[ clickedStep ]\n\t);\n\n\treturn {\n\t\tclickedStep,\n\t\thandleBarClick,\n\t\thandleBarKeyDown,\n\t\tclearSelection,\n\t\tgetStepState,\n\t};\n};\n","import { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { type FC, useRef, useMemo, useEffect, useCallback, useContext } from 'react';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsTheme,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { formatPercentage, hexToRgba } from '../../utils';\nimport styles from './conversion-funnel-chart.module.scss';\nimport { useFunnelSelection } from './private';\nimport type { FunnelStep, ConversionFunnelChartProps } from './types';\n\n/**\n * Internal ConversionFunnelChart component with chart registration\n *\n * @param props - Component props\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.mainRate - Main conversion rate to highlight\n * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)\n * @param props.steps - Array of funnel steps\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether to show chart animation on initial render or not\n * @param props.className - Additional CSS class name\n * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to \"100%\".\n * @param props.style - Custom styling\n * @param props.renderStepLabel - Custom render function for step labels\n * @param props.renderStepRate - Custom render function for step rates\n * @param props.renderMainMetric - Custom render function for the entire main metric section\n * @param props.renderTooltip - Custom render function for tooltip content\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartInternal: FC< ConversionFunnelChartProps > = ( {\n\tmainRate,\n\tchangeIndicator,\n\tsteps,\n\tloading = false,\n\tanimation,\n\tclassName,\n\tchartId: providedChartId,\n\theight,\n\tstyle,\n\trenderStepLabel,\n\trenderStepRate,\n\trenderMainMetric,\n\trenderTooltip,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { conversionFunnelChart: conversionFunnelChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles, isColorPaletteResolved } = useGlobalChartsContext();\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\tconst selectedBarRef = useRef< HTMLDivElement | null >( null );\n\n\t// Use @visx/tooltip hooks for tooltip positioning\n\tconst { tooltipData, tooltipLeft, tooltipTop, tooltipOpen, showTooltip, hideTooltip } =\n\t\tuseTooltip();\n\n\t// Use custom hook for selection management\n\tconst { handleBarClick, handleBarKeyDown, clearSelection, getStepState } =\n\t\tuseFunnelSelection( hideTooltip );\n\tconst {\n\t\tcontainerRef: portalContainerRef,\n\t\tTooltipInPortal,\n\t\tcontainerBounds,\n\t} = useTooltipInPortal( {\n\t\t// use TooltipWithBounds for boundary detection\n\t\tdetectBounds: true,\n\t\t// when tooltip containers are scrolled, this will correctly update the Tooltip position\n\t\tscroll: true,\n\t} );\n\n\t// Wrapper to clear selectedBarRef after clearing selection\n\tconst clearSelectionAndRef = useCallback( () => {\n\t\tclearSelection();\n\t\tselectedBarRef.current = null;\n\t\thideTooltip();\n\t}, [ clearSelection, hideTooltip ] );\n\n\t// Helper function to show tooltip at specific coordinates\n\tconst showTooltipAt = useCallback(\n\t\t( step: FunnelStep, x: number, y: number ) => {\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: step,\n\t\t\t\ttooltipLeft: x,\n\t\t\t\ttooltipTop: y - 10,\n\t\t\t} );\n\t\t},\n\t\t[ showTooltip ]\n\t);\n\n\t// Helper function to get tooltip coordinates for mouse events\n\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t// By passing (clientX - containerBounds.left), we get correct page coordinates\n\t// regardless of whether bounds are stale (e.g., after dashboard customization).\n\tconst getMouseTooltipCoords = useCallback(\n\t\t( event: React.MouseEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tx: event.clientX - containerBounds.left,\n\t\t\t\ty: event.clientY - containerBounds.top,\n\t\t\t};\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to get tooltip coordinates for keyboard events\n\t// Use fresh getBoundingClientRect() and subtract containerBounds to cancel out stale offset.\n\tconst getKeyboardTooltipCoords = useCallback(\n\t\t( event: React.KeyboardEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst rect = event.currentTarget.getBoundingClientRect();\n\t\t\t// Calculate center of element in viewport coordinates, then subtract containerBounds\n\t\t\tconst x = rect.left + rect.width / 2 - containerBounds.left;\n\t\t\tconst y = rect.top - containerBounds.top;\n\t\t\treturn { x, y };\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to handle step interaction (both click and keyboard)\n\tconst handleStepInteraction = useCallback(\n\t\t(\n\t\t\tstep: FunnelStep,\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tinteractionType: 'click' | 'keyboard'\n\t\t) => {\n\t\t\t// Store reference to the interacted element\n\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\n\t\t\t// Check if deselecting the same step\n\t\t\tconst { isClicked } = getStepState( step.id );\n\t\t\tif ( isClicked ) {\n\t\t\t\t// Deselecting - clear selection (tooltip will be hidden by hook)\n\t\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\t\thandleBarClick( step.id );\n\t\t\t\t} else {\n\t\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Selecting - handle selection and show tooltip\n\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\thandleBarClick( step.id );\n\t\t\t\tconst coords = getMouseTooltipCoords( event as React.MouseEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\tconst coords = getKeyboardTooltipCoords( event as React.KeyboardEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetStepState,\n\t\t\thandleBarClick,\n\t\t\thandleBarKeyDown,\n\t\t\tshowTooltipAt,\n\t\t\tgetMouseTooltipCoords,\n\t\t\tgetKeyboardTooltipCoords,\n\t\t]\n\t);\n\n\t// Create handler factories to avoid arrow functions in JSX\n\tconst stepHandlers = useMemo( () => {\n\t\tconst handlers = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tonClick: ( event: React.MouseEvent ) => void;\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => void;\n\t\t\t}\n\t\t>();\n\n\t\tsteps.forEach( step => {\n\t\t\tconst onClick = ( event: React.MouseEvent ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\thandleStepInteraction( step, event, 'click' );\n\t\t\t};\n\n\t\t\tconst onKeyDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\thandleStepInteraction( step, event, 'keyboard' );\n\t\t\t\t} else {\n\t\t\t\t\t// For other keys (like Escape), just handle the selection\n\t\t\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\t\t\t\t\thandleBarKeyDown( step.id, event );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\thandlers.set( step.id, { onClick, onKeyDown } );\n\t\t} );\n\n\t\treturn handlers;\n\t}, [ steps, handleStepInteraction, handleBarKeyDown ] );\n\n\t// Handle document-level click to clear selection when clicking outside selected bar\n\tuseEffect( () => {\n\t\tconst handleDocumentClick = ( event: MouseEvent ) => {\n\t\t\t// Only clear selection if there's an active selection and click is outside the selected bar\n\t\t\tif ( selectedBarRef.current && ! selectedBarRef.current.contains( event.target as Node ) ) {\n\t\t\t\tclearSelectionAndRef();\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener( 'mousedown', handleDocumentClick );\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', handleDocumentClick );\n\t\t};\n\t}, [ clearSelectionAndRef ] );\n\n\t// Resolve height: explicit height prop > style.height > default 100%\n\tconst resolvedHeight = height ?? style?.height ?? '100%';\n\n\t// Get component settings from theme with fallbacks\n\tconst { primaryColor, backgroundColor, positiveChangeColor, negativeChangeColor } =\n\t\tconversionFunnelChartSettings;\n\n\t// Resolve bar color using getElementStyles with primaryColor as override\n\tconst { color: barColor } = getElementStyles\n\t\t? getElementStyles( {\n\t\t\t\tindex: 0,\n\t\t\t\toverrideColor: primaryColor,\n\t\t } )\n\t\t: { color: primaryColor || '#000000' };\n\n\t// Determine change indicator color\n\tconst isPositiveChange = changeIndicator?.startsWith( '+' );\n\tconst changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;\n\n\t// Create light background version of primary color if not set\n\tconst barBackgroundColor =\n\t\tbackgroundColor || hexToRgba( barColor, 0.08 ) || 'rgba(0, 0, 0, 0.08)';\n\n\t// Default main metric rendering function\n\tconst renderDefaultMainMetric = () => (\n\t\t<>\n\t\t\t<span className={ styles[ 'main-rate' ] }>{ formatPercentage( mainRate ) }</span>\n\t\t\t{ changeIndicator && (\n\t\t\t\t<span className={ styles[ 'change-indicator' ] } style={ { color: changeColor } }>\n\t\t\t\t\t{ changeIndicator }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Default tooltip rendering function\n\tconst renderDefaultTooltip = ( step: FunnelStep ) => (\n\t\t<Stack direction=\"column\" align=\"flex-start\" gap=\"xs\">\n\t\t\t<div className={ styles[ 'tooltip-title' ] }>{ step.label }</div>\n\t\t\t<div className={ styles[ 'tooltip-content' ] }>\n\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t{ ` • ${ step.count ?? 'no' } items` }\n\t\t\t</div>\n\t\t</Stack>\n\t);\n\n\t// Validate data\n\tconst isDataValid = Boolean( steps && steps.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tmainRate,\n\t\t\tchangeIndicator,\n\t\t\tstepsCount: steps?.length || 0,\n\t\t} ),\n\t\t[ mainRate, changeIndicator, steps?.length ]\n\t);\n\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems: [],\n\t\tchartType: 'conversion-funnel',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! isDataValid ) {\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<div className={ styles[ 'empty-state' ] }>\n\t\t\t\t\t{ loading ? 'Loading...' : 'No data available' }\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t);\n\t}\n\n\t// Calculate bar heights relative to the maximum (first step)\n\tconst maxRate = Math.max( ...steps.map( step => step.rate ) );\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"xl\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ node => {\n\t\t\t\t\t// Set containerRef for @visx coordinate system\n\t\t\t\t\tportalContainerRef( node );\n\t\t\t\t\tchartRef.current = node;\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t{ /* Main Metric */ }\n\t\t\t\t{ renderMainMetric ? (\n\t\t\t\t\trenderMainMetric( {\n\t\t\t\t\t\tmainRate,\n\t\t\t\t\t\tchangeIndicator,\n\t\t\t\t\t\tclassName: styles[ 'main-metric' ],\n\t\t\t\t\t\tchangeColor,\n\t\t\t\t\t} )\n\t\t\t\t) : (\n\t\t\t\t\t<Stack direction=\"row\" align=\"baseline\" gap=\"sm\" className={ styles[ 'main-metric' ] }>\n\t\t\t\t\t\t{ renderDefaultMainMetric() }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Funnel Steps */ }\n\t\t\t\t<Stack direction=\"row\" align=\"flex-end\" gap=\"lg\" className={ styles[ 'funnel-container' ] }>\n\t\t\t\t\t{ steps.map( ( step, index ) => {\n\t\t\t\t\t\tconst barHeight = ( step.rate / maxRate ) * 100;\n\t\t\t\t\t\tconst { isBlurred } = getStepState( step.id );\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\tkey={ step.id }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tdata-testid=\"funnel-step\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\tstyles[ 'funnel-step' ],\n\t\t\t\t\t\t\t\t\tisColorPaletteResolved && styles[ 'funnel-step--animated' ],\n\t\t\t\t\t\t\t\t\tisBlurred && styles[ 'funnel-step--blurred' ]\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tgap=\"xl\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ /* Step Label and Rate */ }\n\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t{ renderStepLabel ? (\n\t\t\t\t\t\t\t\t\t\trenderStepLabel( {\n\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-label' ],\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-label' ] }>{ step.label }</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ renderStepRate ? (\n\t\t\t\t\t\t\t\t\t\trenderStepRate( {\n\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-rate' ],\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-rate' ] }>\n\t\t\t\t\t\t\t\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t{ /* Funnel Bar */ }\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'bar-container' ] }\n\t\t\t\t\t\t\t\t\tonClick={ stepHandlers.get( step.id )?.onClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ stepHandlers.get( step.id )?.onKeyDown }\n\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\ttabIndex={ isBlurred ? -1 : 0 }\n\t\t\t\t\t\t\t\t\taria-label={ step.label }\n\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: barBackgroundColor } }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'funnel-bar' ], {\n\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'funnel-bar--animated' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\tanimation && ! loading && ! prefersReducedMotion,\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\theight: `${ barHeight }%`,\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: barColor,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t{ /* Tooltip Portal */ }\n\t\t\t{ tooltipOpen &&\n\t\t\t\ttooltipData &&\n\t\t\t\t( () => {\n\t\t\t\t\tconst tooltipContent = renderTooltip\n\t\t\t\t\t\t? renderTooltip( {\n\t\t\t\t\t\t\t\tstep: tooltipData as FunnelStep,\n\t\t\t\t\t\t\t\tindex: steps.findIndex( s => s.id === ( tooltipData as FunnelStep ).id ),\n\t\t\t\t\t\t\t\ttop: tooltipTop,\n\t\t\t\t\t\t\t\tleft: tooltipLeft,\n\t\t\t\t\t\t\t\tclassName: styles[ 'tooltip-wrapper' ],\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: renderDefaultTooltip( tooltipData as FunnelStep );\n\n\t\t\t\t\t// Don't render tooltip if renderTooltip returns falsy\n\t\t\t\t\tif ( ! tooltipContent ) return null;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TooltipInPortal\n\t\t\t\t\t\t\t// set this to random so it correctly updates with parent bounds\n\t\t\t\t\t\t\tkey={ Math.random() }\n\t\t\t\t\t\t\ttop={ tooltipTop }\n\t\t\t\t\t\t\tleft={ tooltipLeft }\n\t\t\t\t\t\t\tclassName={ styles[ 'tooltip-wrapper' ] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t);\n\t\t\t\t} )() }\n\t\t</>\n\t);\n};\n\n/**\n * ConversionFunnelChart component with provider wrapper\n *\n * @param props - Component props\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartWithProvider: FC< ConversionFunnelChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <ConversionFunnelChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<ConversionFunnelChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nConversionFunnelChartWithProvider.displayName = 'ConversionFunnelChart';\n\nexport { ConversionFunnelChartWithProvider as default };\n","/**\n * External dependencies\n */\nimport DOMPurify from 'dompurify';\n\n// Enforce rel=\"noopener noreferrer\" on links with target=\"_blank\" to prevent tab-napping.\n// Registered once at module level since DOMPurify hooks are global state.\nDOMPurify.addHook( 'afterSanitizeAttributes', ( node: Element ) => {\n\tif ( node.tagName === 'A' && node.getAttribute( 'target' ) === '_blank' ) {\n\t\tnode.setAttribute( 'rel', 'noopener noreferrer' );\n\t}\n} );\n\n/**\n * Sanitizes an HTML string using DOMPurify, allowing only safe formatting\n * markup suitable for chart tooltip content.\n *\n * @param html - The HTML string to sanitize\n * @return Sanitized HTML string safe for rendering\n */\nexport function sanitizeHtml( html: string ): string {\n\treturn DOMPurify.sanitize( html, {\n\t\tALLOWED_TAGS: [\n\t\t\t'a',\n\t\t\t'b',\n\t\t\t'br',\n\t\t\t'div',\n\t\t\t'em',\n\t\t\t'i',\n\t\t\t'li',\n\t\t\t'ol',\n\t\t\t'p',\n\t\t\t'small',\n\t\t\t'span',\n\t\t\t'strong',\n\t\t\t'sub',\n\t\t\t'sup',\n\t\t\t'table',\n\t\t\t'tbody',\n\t\t\t'td',\n\t\t\t'th',\n\t\t\t'thead',\n\t\t\t'tr',\n\t\t\t'u',\n\t\t\t'ul',\n\t\t],\n\t\tALLOWED_ATTR: [ 'class', 'href', 'target', 'rel' ],\n\t} );\n}\n","/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { FC, useContext, useMemo } from 'react';\nimport { Chart } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport { GlobalChartsContext, GlobalChartsProvider, useGlobalChartsContext } from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { sanitizeHtml } from '../../utils/sanitize-html';\nimport { Center } from '../private/center';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport { GeoChartProps } from './types';\n\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n\ntype GoogleChartOptions = Record< string, unknown >;\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal: FC< GeoChartProps > = ( {\n\tclassName,\n\tdata,\n\twidth,\n\theight,\n\tregion = 'world',\n\tresolution = 'countries',\n\trenderPlaceholder,\n} ) => {\n\tconst {\n\t\tgetElementStyles,\n\t\ttheme: {\n\t\t\tgeoChart: { featureFillColor },\n\t\t\tbackgroundColor,\n\t\t},\n\t} = useGlobalChartsContext();\n\n\t// Render loading placeholder\n\tconst loadingPlaceholder = (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart-loading\"\n\t\t\tstyle={ { width, height } }\n\t\t>\n\t\t\t{ renderPlaceholder ? renderPlaceholder() : __( 'Loading map', 'jetpack-charts' ) }\n\t\t</Center>\n\t);\n\n\t// Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n\tconst fullColorHex = getElementStyles( { index: 0 } ).color;\n\tconst lightColorHex = lightenHexColor( fullColorHex, 0.8 );\n\t// Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex\n\tconst backgroundColorHex =\n\t\tnormalizeColorToHex( backgroundColor, null, resolveCssVariable ) || DEFAULT_BACKGROUND_COLOR;\n\tconst defaultFillColorHex =\n\t\tnormalizeColorToHex( featureFillColor, null, resolveCssVariable ) || DEFAULT_FEATURE_FILL_COLOR;\n\n\t// Identify HTML tooltip column indices and sanitize their content to prevent XSS.\n\tconst sanitizedData = useMemo( () => {\n\t\tif ( data.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\tconst htmlTooltipIndices: number[] = [];\n\t\tfor ( let i = 0; i < data[ 0 ].length; i++ ) {\n\t\t\tconst col = data[ 0 ][ i ];\n\t\t\tif (\n\t\t\t\ttypeof col === 'object' &&\n\t\t\t\tcol !== null &&\n\t\t\t\t'role' in col &&\n\t\t\t\tcol.role === 'tooltip' &&\n\t\t\t\t'p' in col &&\n\t\t\t\ttypeof col.p === 'object' &&\n\t\t\t\tcol.p !== null &&\n\t\t\t\t'html' in col.p &&\n\t\t\t\tcol.p.html === true\n\t\t\t) {\n\t\t\t\thtmlTooltipIndices.push( i );\n\t\t\t}\n\t\t}\n\n\t\tif ( htmlTooltipIndices.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\t// Sanitize HTML content in tooltip columns for data rows (skip header row)\n\t\tconst sanitizedRows = data.slice( 1 ).map( row => {\n\t\t\tconst newRow = [ ...row ];\n\t\t\tfor ( const colIndex of htmlTooltipIndices ) {\n\t\t\t\tif ( typeof newRow[ colIndex ] === 'string' ) {\n\t\t\t\t\tnewRow[ colIndex ] = sanitizeHtml( newRow[ colIndex ] as string );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newRow;\n\t\t} );\n\n\t\treturn {\n\t\t\tdata: [ data[ 0 ], ...sanitizedRows ] as typeof data,\n\t\t\thasHtmlTooltips: true,\n\t\t};\n\t}, [ data ] );\n\n\tconst options: GoogleChartOptions = useMemo(\n\t\t() => ( {\n\t\t\t...( region !== 'world' && { region } ),\n\t\t\t...( resolution !== 'countries' && { resolution } ),\n\t\t\tcolorAxis: { colors: [ lightColorHex, fullColorHex ] },\n\t\t\tbackgroundColor: backgroundColorHex,\n\t\t\tdatalessRegionColor: defaultFillColorHex,\n\t\t\tdefaultColor: defaultFillColorHex,\n\t\t\ttooltip: { trigger: 'focus', isHtml: sanitizedData.hasHtmlTooltips },\n\t\t\tlegend: 'none',\n\t\t\tkeepAspectRatio: true,\n\t\t} ),\n\t\t[\n\t\t\tregion,\n\t\t\tresolution,\n\t\t\tlightColorHex,\n\t\t\tfullColorHex,\n\t\t\tbackgroundColorHex,\n\t\t\tdefaultFillColorHex,\n\t\t\tsanitizedData.hasHtmlTooltips,\n\t\t]\n\t);\n\n\treturn (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart\"\n\t\t\tstyle={ { width, height, backgroundColor } }\n\t\t>\n\t\t\t<Chart\n\t\t\t\tchartType=\"GeoChart\"\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tdata={ sanitizedData.data }\n\t\t\t\toptions={ options }\n\t\t\t\tloader={ loadingPlaceholder }\n\t\t\t/>\n\t\t</Center>\n\t);\n};\n\nconst GeoChartWithProvider: FC< GeoChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <GeoChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<GeoChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nGeoChartWithProvider.displayName = 'GeoChart';\n\nconst GeoChartResponsive = withResponsive< GeoChartProps >( GeoChartWithProvider );\n\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };\n","// packages/warning/src/utils.ts\nvar logged = /* @__PURE__ */ new Set();\nexport {\n logged\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/warning/src/index.ts\nimport { logged } from \"./utils.mjs\";\nfunction isDev() {\n return globalThis.SCRIPT_DEBUG === true;\n}\nfunction warning(message) {\n if (!isDev()) {\n return;\n }\n if (logged.has(message)) {\n return;\n }\n console.warn(message);\n try {\n throw Error(message);\n } catch {\n }\n logged.add(message);\n}\nexport {\n warning as default\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/components/src/context/constants.js\nvar COMPONENT_NAMESPACE = \"data-wp-component\";\nvar CONNECTED_NAMESPACE = \"data-wp-c16t\";\nvar CONNECT_STATIC_NAMESPACE = \"__contextSystemKey__\";\nexport {\n COMPONENT_NAMESPACE,\n CONNECTED_NAMESPACE,\n CONNECT_STATIC_NAMESPACE\n};\n//# sourceMappingURL=constants.mjs.map\n","/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nexport function localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\n/**\n * Lower case as a function.\n */\nexport function lowerCase(str) {\n return str.toLowerCase();\n}\n//# sourceMappingURL=index.js.map","import { lowerCase } from \"lower-case\";\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nexport function noCase(input, options) {\n if (options === void 0) { options = {}; }\n var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? \" \" : _d;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { noCase } from \"no-case\";\nexport function dotCase(input, options) {\n if (options === void 0) { options = {}; }\n return noCase(input, __assign({ delimiter: \".\" }, options));\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { dotCase } from \"dot-case\";\nexport function paramCase(input, options) {\n if (options === void 0) { options = {}; }\n return dotCase(input, __assign({ delimiter: \"-\" }, options));\n}\n//# sourceMappingURL=index.js.map","/**\n * Memize options object.\n *\n * @typedef MemizeOptions\n *\n * @property {number} [maxSize] Maximum size of the cache.\n */\n\n/**\n * Internal cache entry.\n *\n * @typedef MemizeCacheNode\n *\n * @property {?MemizeCacheNode|undefined} [prev] Previous node.\n * @property {?MemizeCacheNode|undefined} [next] Next node.\n * @property {Array<*>} args Function arguments for cache\n * entry.\n * @property {*} val Function result.\n */\n\n/**\n * Properties of the enhanced function for controlling cache.\n *\n * @typedef MemizeMemoizedFunction\n *\n * @property {()=>void} clear Clear the cache.\n */\n\n/**\n * Accepts a function to be memoized, and returns a new memoized function, with\n * optional options.\n *\n * @template {(...args: any[]) => any} F\n *\n * @param {F} fn Function to memoize.\n * @param {MemizeOptions} [options] Options object.\n *\n * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.\n */\nfunction memize(fn, options) {\n\tvar size = 0;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar head;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar tail;\n\n\toptions = options || {};\n\n\tfunction memoized(/* ...args */) {\n\t\tvar node = head,\n\t\t\tlen = arguments.length,\n\t\t\targs,\n\t\t\ti;\n\n\t\tsearchCache: while (node) {\n\t\t\t// Perform a shallow equality test to confirm that whether the node\n\t\t\t// under test is a candidate for the arguments passed. Two arrays\n\t\t\t// are shallowly equal if their length matches and each entry is\n\t\t\t// strictly equal between the two sets. Avoid abstracting to a\n\t\t\t// function which could incur an arguments leaking deoptimization.\n\n\t\t\t// Check whether node arguments match arguments length\n\t\t\tif (node.args.length !== arguments.length) {\n\t\t\t\tnode = node.next;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check whether node arguments match arguments values\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (node.args[i] !== arguments[i]) {\n\t\t\t\t\tnode = node.next;\n\t\t\t\t\tcontinue searchCache;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// At this point we can assume we've found a match\n\n\t\t\t// Surface matched node to head if not already\n\t\t\tif (node !== head) {\n\t\t\t\t// As tail, shift to previous. Must only shift if not also\n\t\t\t\t// head, since if both head and tail, there is no previous.\n\t\t\t\tif (node === tail) {\n\t\t\t\t\ttail = node.prev;\n\t\t\t\t}\n\n\t\t\t\t// Adjust siblings to point to each other. If node was tail,\n\t\t\t\t// this also handles new tail's empty `next` assignment.\n\t\t\t\t/** @type {MemizeCacheNode} */ (node.prev).next = node.next;\n\t\t\t\tif (node.next) {\n\t\t\t\t\tnode.next.prev = node.prev;\n\t\t\t\t}\n\n\t\t\t\tnode.next = head;\n\t\t\t\tnode.prev = null;\n\t\t\t\t/** @type {MemizeCacheNode} */ (head).prev = node;\n\t\t\t\thead = node;\n\t\t\t}\n\n\t\t\t// Return immediately\n\t\t\treturn node.val;\n\t\t}\n\n\t\t// No cached value found. Continue to insertion phase:\n\n\t\t// Create a copy of arguments (avoid leaking deoptimization)\n\t\targs = new Array(len);\n\t\tfor (i = 0; i < len; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\n\t\tnode = {\n\t\t\targs: args,\n\n\t\t\t// Generate the result from original function\n\t\t\tval: fn.apply(null, args),\n\t\t};\n\n\t\t// Don't need to check whether node is already head, since it would\n\t\t// have been returned above already if it was\n\n\t\t// Shift existing head down list\n\t\tif (head) {\n\t\t\thead.prev = node;\n\t\t\tnode.next = head;\n\t\t} else {\n\t\t\t// If no head, follows that there's no tail (at initial or reset)\n\t\t\ttail = node;\n\t\t}\n\n\t\t// Trim tail if we're reached max size and are pending cache insertion\n\t\tif (size === /** @type {MemizeOptions} */ (options).maxSize) {\n\t\t\ttail = /** @type {MemizeCacheNode} */ (tail).prev;\n\t\t\t/** @type {MemizeCacheNode} */ (tail).next = null;\n\t\t} else {\n\t\t\tsize++;\n\t\t}\n\n\t\thead = node;\n\n\t\treturn node.val;\n\t}\n\n\tmemoized.clear = function () {\n\t\thead = null;\n\t\ttail = null;\n\t\tsize = 0;\n\t};\n\n\t// Ignore reason: There's not a clear solution to create an intersection of\n\t// the function with additional properties, where the goal is to retain the\n\t// function signature of the incoming argument and add control properties\n\t// on the return value.\n\n\t// @ts-ignore\n\treturn memoized;\n}\n\nexport { memize as default };\n","// packages/components/src/context/get-styled-class-name-from-key.ts\nimport { paramCase as kebabCase } from \"change-case\";\nimport memoize from \"memize\";\nfunction getStyledClassName(namespace) {\n const kebab = kebabCase(namespace);\n return `components-${kebab}`;\n}\nvar getStyledClassNameFromKey = memoize(getStyledClassName);\nexport {\n getStyledClassNameFromKey\n};\n//# sourceMappingURL=get-styled-class-name-from-key.mjs.map\n","// packages/components/src/context/context-connect.ts\nimport { forwardRef } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { CONNECT_STATIC_NAMESPACE } from \"./constants.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nfunction contextConnect(Component, namespace) {\n return _contextConnect(Component, namespace, {\n forwardsRef: true\n });\n}\nfunction contextConnectWithoutRef(Component, namespace) {\n return _contextConnect(Component, namespace);\n}\nfunction _contextConnect(Component, namespace, options) {\n const WrappedComponent = options?.forwardsRef ? forwardRef(Component) : Component;\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"contextConnect: Please provide a namespace\") : void 0;\n }\n let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];\n if (Array.isArray(namespace)) {\n mergedNamespace = [...mergedNamespace, ...namespace];\n }\n if (typeof namespace === \"string\") {\n mergedNamespace = [...mergedNamespace, namespace];\n }\n return Object.assign(WrappedComponent, {\n [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],\n displayName: namespace,\n selector: `.${getStyledClassNameFromKey(namespace)}`\n });\n}\nfunction getConnectNamespace(Component) {\n if (!Component) {\n return [];\n }\n let namespaces = [];\n if (Component[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component[CONNECT_STATIC_NAMESPACE];\n }\n if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component.type[CONNECT_STATIC_NAMESPACE];\n }\n return namespaces;\n}\nfunction hasConnectNamespace(Component, match) {\n if (!Component) {\n return false;\n }\n if (typeof match === \"string\") {\n return getConnectNamespace(Component).includes(match);\n }\n if (Array.isArray(match)) {\n return match.some((result) => getConnectNamespace(Component).includes(result));\n }\n return false;\n}\nexport {\n contextConnect,\n contextConnectWithoutRef,\n getConnectNamespace,\n hasConnectNamespace\n};\n//# sourceMappingURL=context-connect.mjs.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n if ((a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n for (i of a.entries())\n if (!equal(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if ((a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/*!\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","// packages/components/src/utils/hooks/use-update-effect.js\nimport { useRef, useEffect } from \"@wordpress/element\";\nfunction useUpdateEffect(effect, deps) {\n const mountedRef = useRef(false);\n useEffect(() => {\n if (mountedRef.current) {\n return effect();\n }\n mountedRef.current = true;\n return void 0;\n }, deps);\n useEffect(() => () => {\n mountedRef.current = false;\n }, []);\n}\nvar use_update_effect_default = useUpdateEffect;\nexport {\n use_update_effect_default as default\n};\n//# sourceMappingURL=use-update-effect.mjs.map\n","// packages/components/src/context/context-system-provider.js\nimport deepmerge from \"deepmerge\";\nimport fastDeepEqual from \"fast-deep-equal/es6/index.js\";\nimport { isPlainObject } from \"is-plain-object\";\nimport { createContext, useContext, useRef, useMemo, memo } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { useUpdateEffect } from \"../utils/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar ComponentsContext = createContext(\n /** @type {Record<string, any>} */\n {}\n);\nComponentsContext.displayName = \"ComponentsContext\";\nvar useComponentsContext = () => useContext(ComponentsContext);\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) && // But not the same reference.\n valueRef.current !== value\n ) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n const config = useMemo(() => {\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\nvar BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /* @__PURE__ */ _jsx(ComponentsContext.Provider, {\n value: contextValue,\n children\n });\n};\nvar ContextSystemProvider = memo(BaseContextSystemProvider);\nexport {\n ComponentsContext,\n ContextSystemProvider,\n useComponentsContext\n};\n//# sourceMappingURL=context-system-provider.mjs.map\n","// packages/components/src/context/utils.js\nimport { CONNECTED_NAMESPACE, COMPONENT_NAMESPACE } from \"./constants.mjs\";\nfunction getNamespace(componentName) {\n return {\n [COMPONENT_NAMESPACE]: componentName\n };\n}\nfunction getConnectedNamespace() {\n return {\n [CONNECTED_NAMESPACE]: true\n };\n}\nexport {\n getConnectedNamespace,\n getNamespace\n};\n//# sourceMappingURL=utils.mjs.map\n","var isDevelopment = false;\n\n/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n\nfunction sheetForTag(tag) {\n if (tag.sheet) {\n return tag.sheet;\n } // this weirdness brought to you by firefox\n\n /* istanbul ignore next */\n\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n return document.styleSheets[i];\n }\n } // this function should always return with a value\n // TS can't understand it though so we make it stop complaining here\n\n\n return undefined;\n}\n\nfunction createStyleElement(options) {\n var tag = document.createElement('style');\n tag.setAttribute('data-emotion', options.key);\n\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce);\n }\n\n tag.appendChild(document.createTextNode(''));\n tag.setAttribute('data-s', '');\n return tag;\n}\n\nvar StyleSheet = /*#__PURE__*/function () {\n // Using Node instead of HTMLElement since container may be a ShadowRoot\n function StyleSheet(options) {\n var _this = this;\n\n this._insertTag = function (tag) {\n var before;\n\n if (_this.tags.length === 0) {\n if (_this.insertionPoint) {\n before = _this.insertionPoint.nextSibling;\n } else if (_this.prepend) {\n before = _this.container.firstChild;\n } else {\n before = _this.before;\n }\n } else {\n before = _this.tags[_this.tags.length - 1].nextSibling;\n }\n\n _this.container.insertBefore(tag, before);\n\n _this.tags.push(tag);\n };\n\n this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;\n this.tags = [];\n this.ctr = 0;\n this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets\n\n this.key = options.key;\n this.container = options.container;\n this.prepend = options.prepend;\n this.insertionPoint = options.insertionPoint;\n this.before = null;\n }\n\n var _proto = StyleSheet.prototype;\n\n _proto.hydrate = function hydrate(nodes) {\n nodes.forEach(this._insertTag);\n };\n\n _proto.insert = function insert(rule) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {\n this._insertTag(createStyleElement(this));\n }\n\n var tag = this.tags[this.tags.length - 1];\n\n if (this.isSpeedy) {\n var sheet = sheetForTag(tag);\n\n try {\n // this is the ultrafast version, works across browsers\n // the big drawback is that the css won't be editable in devtools\n sheet.insertRule(rule, sheet.cssRules.length);\n } catch (e) {\n }\n } else {\n tag.appendChild(document.createTextNode(rule));\n }\n\n this.ctr++;\n };\n\n _proto.flush = function flush() {\n this.tags.forEach(function (tag) {\n var _tag$parentNode;\n\n return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);\n });\n this.tags = [];\n this.ctr = 0;\n };\n\n return StyleSheet;\n}();\n\nexport { StyleSheet };\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'\nimport {copy, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn serialize([copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn serialize([\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport { memoize as default };\n","import { StyleSheet } from '@emotion/sheet';\nimport { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';\nimport '@emotion/weak-memoize';\nimport '@emotion/memoize';\n\nvar identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {\n var previous = 0;\n var character = 0;\n\n while (true) {\n previous = character;\n character = peek(); // &\\f\n\n if (previous === 38 && character === 12) {\n points[index] = 1;\n }\n\n if (token(character)) {\n break;\n }\n\n next();\n }\n\n return slice(begin, position);\n};\n\nvar toRules = function toRules(parsed, points) {\n // pretend we've started with a comma\n var index = -1;\n var character = 44;\n\n do {\n switch (token(character)) {\n case 0:\n // &\\f\n if (character === 38 && peek() === 12) {\n // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings\n // stylis inserts \\f after & to know when & where it should replace this sequence with the context selector\n // and when it should just concatenate the outer and inner selectors\n // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here\n points[index] = 1;\n }\n\n parsed[index] += identifierWithPointTracking(position - 1, points, index);\n break;\n\n case 2:\n parsed[index] += delimit(character);\n break;\n\n case 4:\n // comma\n if (character === 44) {\n // colon\n parsed[++index] = peek() === 58 ? '&\\f' : '';\n points[index] = parsed[index].length;\n break;\n }\n\n // fallthrough\n\n default:\n parsed[index] += from(character);\n }\n } while (character = next());\n\n return parsed;\n};\n\nvar getRules = function getRules(value, points) {\n return dealloc(toRules(alloc(value), points));\n}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11\n\n\nvar fixedElements = /* #__PURE__ */new WeakMap();\nvar compat = function compat(element) {\n if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo\n // negative .length indicates that this rule has been already prefixed\n element.length < 1) {\n return;\n }\n\n var value = element.value;\n var parent = element.parent;\n var isImplicitRule = element.column === parent.column && element.line === parent.line;\n\n while (parent.type !== 'rule') {\n parent = parent.parent;\n if (!parent) return;\n } // short-circuit for the simplest case\n\n\n if (element.props.length === 1 && value.charCodeAt(0) !== 58\n /* colon */\n && !fixedElements.get(parent)) {\n return;\n } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)\n // then the props has already been manipulated beforehand as they that array is shared between it and its \"rule parent\"\n\n\n if (isImplicitRule) {\n return;\n }\n\n fixedElements.set(element, true);\n var points = [];\n var rules = getRules(value, points);\n var parentRules = parent.props;\n\n for (var i = 0, k = 0; i < rules.length; i++) {\n for (var j = 0; j < parentRules.length; j++, k++) {\n element.props[k] = points[i] ? rules[i].replace(/&\\f/g, parentRules[j]) : parentRules[j] + \" \" + rules[i];\n }\n }\n};\nvar removeLabel = function removeLabel(element) {\n if (element.type === 'decl') {\n var value = element.value;\n\n if ( // charcode for l\n value.charCodeAt(0) === 108 && // charcode for b\n value.charCodeAt(2) === 98) {\n // this ignores label\n element[\"return\"] = '';\n element.value = '';\n }\n }\n};\n\n/* eslint-disable no-fallthrough */\n\nfunction prefix(value, length) {\n switch (hash(value, length)) {\n // color-adjust\n case 5103:\n return WEBKIT + 'print-' + value + value;\n // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\n case 5737:\n case 4201:\n case 3177:\n case 3433:\n case 1641:\n case 4457:\n case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\n case 5572:\n case 6356:\n case 5844:\n case 3191:\n case 6645:\n case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\n case 6391:\n case 5879:\n case 5623:\n case 6135:\n case 4599:\n case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\n case 4215:\n case 6389:\n case 5109:\n case 5365:\n case 5621:\n case 3829:\n return WEBKIT + value + value;\n // appearance, user-select, transform, hyphens, text-size-adjust\n\n case 5349:\n case 4246:\n case 4810:\n case 6968:\n case 2756:\n return WEBKIT + value + MOZ + value + MS + value + value;\n // flex, flex-direction\n\n case 6828:\n case 4268:\n return WEBKIT + value + MS + value + value;\n // order\n\n case 6165:\n return WEBKIT + value + MS + 'flex-' + value + value;\n // align-items\n\n case 5187:\n return WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;\n // align-self\n\n case 5443:\n return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;\n // align-content\n\n case 4675:\n return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;\n // flex-shrink\n\n case 5548:\n return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;\n // flex-basis\n\n case 5292:\n return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;\n // flex-grow\n\n case 6060:\n return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;\n // transition\n\n case 4554:\n return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;\n // cursor\n\n case 6187:\n return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;\n // background, background-image\n\n case 5495:\n case 3959:\n return replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1');\n // justify-content\n\n case 4968:\n return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;\n // (margin|padding)-inline-(start|end)\n\n case 4095:\n case 3583:\n case 4068:\n case 2532:\n return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;\n // (min|max)?(width|height|inline-size|block-size)\n\n case 8116:\n case 7059:\n case 5753:\n case 5535:\n case 5445:\n case 5701:\n case 4933:\n case 4677:\n case 5533:\n case 5789:\n case 5021:\n case 4765:\n // stretch, max-content, min-content, fill-available\n if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {\n // (m)ax-content, (m)in-content\n case 109:\n // -\n if (charat(value, length + 4) !== 45) break;\n // (f)ill-available, (f)it-content\n\n case 102:\n return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;\n // (s)tretch\n\n case 115:\n return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;\n }\n break;\n // position: sticky\n\n case 4949:\n // (s)ticky?\n if (charat(value, length + 1) !== 115) break;\n // display: (flex|inline-flex)\n\n case 6444:\n switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {\n // stic(k)y\n case 107:\n return replace(value, ':', ':' + WEBKIT) + value;\n // (inline-)?fl(e)x\n\n case 101:\n return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;\n }\n\n break;\n // writing-mode\n\n case 5936:\n switch (charat(value, length + 11)) {\n // vertical-l(r)\n case 114:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value;\n // vertical-r(l)\n\n case 108:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value;\n // horizontal(-)tb\n\n case 45:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value;\n }\n\n return WEBKIT + value + MS + value + value;\n }\n\n return value;\n}\n\nvar prefixer = function prefixer(element, index, children, callback) {\n if (element.length > -1) if (!element[\"return\"]) switch (element.type) {\n case DECLARATION:\n element[\"return\"] = prefix(element.value, element.length);\n break;\n\n case KEYFRAMES:\n return serialize([copy(element, {\n value: replace(element.value, '@', '@' + WEBKIT)\n })], callback);\n\n case RULESET:\n if (element.length) return combine(element.props, function (value) {\n switch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n // :read-(only|write)\n case ':read-only':\n case ':read-write':\n return serialize([copy(element, {\n props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]\n })], callback);\n // :placeholder\n\n case '::placeholder':\n return serialize([copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]\n })], callback);\n }\n\n return '';\n });\n }\n};\n\nvar defaultStylisPlugins = [prefixer];\n\nvar createCache = function createCache(options) {\n var key = options.key;\n\n if (key === 'css') {\n var ssrStyles = document.querySelectorAll(\"style[data-emotion]:not([data-s])\"); // get SSRed styles out of the way of React's hydration\n // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)\n // note this very very intentionally targets all style elements regardless of the key to ensure\n // that creating a cache works inside of render of a React component\n\n Array.prototype.forEach.call(ssrStyles, function (node) {\n // we want to only move elements which have a space in the data-emotion attribute value\n // because that indicates that it is an Emotion 11 server-side rendered style elements\n // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector\n // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)\n // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles\n // will not result in the Emotion 10 styles being destroyed\n var dataEmotionAttribute = node.getAttribute('data-emotion');\n\n if (dataEmotionAttribute.indexOf(' ') === -1) {\n return;\n }\n\n document.head.appendChild(node);\n node.setAttribute('data-s', '');\n });\n }\n\n var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;\n\n var inserted = {};\n var container;\n var nodesToHydrate = [];\n\n {\n container = options.container || document.head;\n Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which\n // means that the style elements we're looking at are only Emotion 11 server-rendered style elements\n document.querySelectorAll(\"style[data-emotion^=\\\"\" + key + \" \\\"]\"), function (node) {\n var attrib = node.getAttribute(\"data-emotion\").split(' ');\n\n for (var i = 1; i < attrib.length; i++) {\n inserted[attrib[i]] = true;\n }\n\n nodesToHydrate.push(node);\n });\n }\n\n var _insert;\n\n var omnipresentPlugins = [compat, removeLabel];\n\n {\n var currentSheet;\n var finalizingPlugins = [stringify, rulesheet(function (rule) {\n currentSheet.insert(rule);\n })];\n var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));\n\n var stylis = function stylis(styles) {\n return serialize(compile(styles), serializer);\n };\n\n _insert = function insert(selector, serialized, sheet, shouldCache) {\n currentSheet = sheet;\n\n stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n\n if (shouldCache) {\n cache.inserted[serialized.name] = true;\n }\n };\n }\n\n var cache = {\n key: key,\n sheet: new StyleSheet({\n key: key,\n container: container,\n nonce: options.nonce,\n speedy: options.speedy,\n prepend: options.prepend,\n insertionPoint: options.insertionPoint\n }),\n nonce: options.nonce,\n inserted: inserted,\n registered: {},\n insert: _insert\n };\n cache.sheet.hydrate(nodesToHydrate);\n return cache;\n};\n\nexport { createCache as default };\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","var isBrowser = true;\n\nfunction getRegisteredStyles(registered, registeredStyles, classNames) {\n var rawClassName = '';\n classNames.split(' ').forEach(function (className) {\n if (registered[className] !== undefined) {\n registeredStyles.push(registered[className] + \";\");\n } else if (className) {\n rawClassName += className + \" \";\n }\n });\n return rawClassName;\n}\nvar registerStyles = function registerStyles(cache, serialized, isStringTag) {\n var className = cache.key + \"-\" + serialized.name;\n\n if ( // we only need to add the styles to the registered cache if the\n // class name could be used further down\n // the tree but if it's a string tag, we know it won't\n // so we don't have to add it to registered cache.\n // this improves memory usage since we can avoid storing the whole style string\n (isStringTag === false || // we need to always store it if we're in compat mode and\n // in node since emotion-server relies on whether a style is in\n // the registered cache to know whether a style is global or not\n // also, note that this check will be dead code eliminated in the browser\n isBrowser === false ) && cache.registered[className] === undefined) {\n cache.registered[className] = serialized.styles;\n }\n};\nvar insertStyles = function insertStyles(cache, serialized, isStringTag) {\n registerStyles(cache, serialized, isStringTag);\n var className = cache.key + \"-\" + serialized.name;\n\n if (cache.inserted[serialized.name] === undefined) {\n var current = serialized;\n\n do {\n cache.insert(serialized === current ? \".\" + className : '', current, cache.sheet, true);\n\n current = current.next;\n } while (current !== undefined);\n }\n};\n\nexport { getRegisteredStyles, insertStyles, registerStyles };\n","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport { murmur2 as default };\n","var unitlessKeys = {\n animationIterationCount: 1,\n aspectRatio: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n scale: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport { unitlessKeys as default };\n","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\n\nvar isDevelopment = false;\n\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = /* #__PURE__ */memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nvar noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';\n\nfunction handleInterpolation(mergedProps, registered, interpolation) {\n if (interpolation == null) {\n return '';\n }\n\n var componentSelector = interpolation;\n\n if (componentSelector.__emotion_styles !== undefined) {\n\n return componentSelector;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n var keyframes = interpolation;\n\n if (keyframes.anim === 1) {\n cursor = {\n name: keyframes.name,\n styles: keyframes.styles,\n next: cursor\n };\n return keyframes.name;\n }\n\n var serializedStyles = interpolation;\n\n if (serializedStyles.styles !== undefined) {\n var next = serializedStyles.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = serializedStyles.styles + \";\";\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result);\n }\n\n break;\n }\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n var asString = interpolation;\n\n if (registered == null) {\n return asString;\n }\n\n var cached = registered[asString];\n return cached !== undefined ? cached : asString;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i]) + \";\";\n }\n } else {\n for (var key in obj) {\n var value = obj[key];\n\n if (typeof value !== 'object') {\n var asString = value;\n\n if (registered != null && registered[asString] !== undefined) {\n string += key + \"{\" + registered[asString] + \"}\";\n } else if (isProcessableValue(asString)) {\n string += processStyleName(key) + \":\" + processStyleValue(key, asString) + \";\";\n }\n } else {\n if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {\n throw new Error(noComponentSelectorMessage);\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(key) + \":\" + processStyleValue(key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value);\n\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n\n string += key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;{]+)\\s*(;|$)/g; // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\nvar cursor;\nfunction serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings);\n } else {\n var asTemplateStringsArr = strings;\n\n styles += asTemplateStringsArr[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i]);\n\n if (stringMode) {\n var templateStringsArr = strings;\n\n styles += templateStringsArr[i];\n }\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n}\n\nexport { serializeStyles };\n","import * as React from 'react';\n\nvar syncFallback = function syncFallback(create) {\n return create();\n};\n\nvar useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;\nvar useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;\nvar useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;\n\nexport { useInsertionEffectAlwaysWithSyncFallback, useInsertionEffectWithLayoutFallback };\n","import * as React from 'react';\nimport { useContext, forwardRef } from 'react';\nimport createCache from '@emotion/cache';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport weakMemoize from '@emotion/weak-memoize';\nimport hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\n\nvar isDevelopment = false;\n\nvar EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case\n// because this module is primarily intended for the browser and node\n// but it's also required in react native and similar environments sometimes\n// and we could have a special build just for that\n// but this is much easier and the native packages\n// might use a different theme context in the future anyway\ntypeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({\n key: 'css'\n}) : null);\n\nvar CacheProvider = EmotionCacheContext.Provider;\nvar __unsafe_useEmotionCache = function useEmotionCache() {\n return useContext(EmotionCacheContext);\n};\n\nvar withEmotionCache = function withEmotionCache(func) {\n return /*#__PURE__*/forwardRef(function (props, ref) {\n // the cache will never be null in the browser\n var cache = useContext(EmotionCacheContext);\n return func(props, cache, ref);\n });\n};\n\nvar ThemeContext = /* #__PURE__ */React.createContext({});\n\nvar useTheme = function useTheme() {\n return React.useContext(ThemeContext);\n};\n\nvar getTheme = function getTheme(outerTheme, theme) {\n if (typeof theme === 'function') {\n var mergedTheme = theme(outerTheme);\n\n return mergedTheme;\n }\n\n return _extends({}, outerTheme, theme);\n};\n\nvar createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {\n return weakMemoize(function (theme) {\n return getTheme(outerTheme, theme);\n });\n});\nvar ThemeProvider = function ThemeProvider(props) {\n var theme = React.useContext(ThemeContext);\n\n if (props.theme !== theme) {\n theme = createCacheWithTheme(theme)(props.theme);\n }\n\n return /*#__PURE__*/React.createElement(ThemeContext.Provider, {\n value: theme\n }, props.children);\n};\nfunction withTheme(Component) {\n var componentName = Component.displayName || Component.name || 'Component';\n var WithTheme = /*#__PURE__*/React.forwardRef(function render(props, ref) {\n var theme = React.useContext(ThemeContext);\n return /*#__PURE__*/React.createElement(Component, _extends({\n theme: theme,\n ref: ref\n }, props));\n });\n WithTheme.displayName = \"WithTheme(\" + componentName + \")\";\n return hoistNonReactStatics(WithTheme, Component);\n}\n\nvar hasOwn = {}.hasOwnProperty;\n\nvar typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';\nvar createEmotionProps = function createEmotionProps(type, props) {\n\n var newProps = {};\n\n for (var _key in props) {\n if (hasOwn.call(props, _key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:\n\n return newProps;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n return null;\n};\n\nvar Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {\n var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works\n // not passing the registered cache to serializeStyles because it would\n // make certain babel optimisations not possible\n\n if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {\n cssProp = cache.registered[cssProp];\n }\n\n var WrappedComponent = props[typePropName];\n var registeredStyles = [cssProp];\n var className = '';\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, registeredStyles, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));\n\n className += cache.key + \"-\" + serialized.name;\n var newProps = {};\n\n for (var _key2 in props) {\n if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (!isDevelopment )) {\n newProps[_key2] = props[_key2];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof WrappedComponent === 'string'\n }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));\n});\n\nvar Emotion$1 = Emotion;\n\nexport { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, ThemeProvider as a, withTheme as b, createEmotionProps as c, hasOwn as h, isDevelopment as i, useTheme as u, withEmotionCache as w };\n","import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isDevelopment } from './emotion-element-f0de968e.browser.esm.js';\nexport { C as CacheProvider, T as ThemeContext, a as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, b as withTheme } from './emotion-element-f0de968e.browser.esm.js';\nimport * as React from 'react';\nimport { insertStyles, registerStyles, getRegisteredStyles } from '@emotion/utils';\nimport { useInsertionEffectWithLayoutFallback, useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { serializeStyles } from '@emotion/serialize';\nimport '@emotion/cache';\nimport '@babel/runtime/helpers/extends';\nimport '@emotion/weak-memoize';\nimport '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport 'hoist-non-react-statics';\n\nvar jsx = function jsx(type, props) {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n\n if (props == null || !hasOwn.call(props, 'css')) {\n return React.createElement.apply(undefined, args);\n }\n\n var argsLength = args.length;\n var createElementArgArray = new Array(argsLength);\n createElementArgArray[0] = Emotion;\n createElementArgArray[1] = createEmotionProps(type, props);\n\n for (var i = 2; i < argsLength; i++) {\n createElementArgArray[i] = args[i];\n }\n\n return React.createElement.apply(null, createElementArgArray);\n};\n\n(function (_jsx) {\n var JSX;\n\n (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));\n})(jsx || (jsx = {}));\n\n// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild\n// initial client-side render from SSR, use place of hydrating tag\n\nvar Global = /* #__PURE__ */withEmotionCache(function (props, cache) {\n\n var styles = props.styles;\n var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));\n // but it is based on a constant that will never change at runtime\n // it's effectively like having two implementations and switching them out\n // so it's not actually breaking anything\n\n\n var sheetRef = React.useRef();\n useInsertionEffectWithLayoutFallback(function () {\n var key = cache.key + \"-global\"; // use case of https://github.com/emotion-js/emotion/issues/2675\n\n var sheet = new cache.sheet.constructor({\n key: key,\n nonce: cache.sheet.nonce,\n container: cache.sheet.container,\n speedy: cache.sheet.isSpeedy\n });\n var rehydrating = false;\n var node = document.querySelector(\"style[data-emotion=\\\"\" + key + \" \" + serialized.name + \"\\\"]\");\n\n if (cache.sheet.tags.length) {\n sheet.before = cache.sheet.tags[0];\n }\n\n if (node !== null) {\n rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s\n\n node.setAttribute('data-emotion', key);\n sheet.hydrate([node]);\n }\n\n sheetRef.current = [sheet, rehydrating];\n return function () {\n sheet.flush();\n };\n }, [cache]);\n useInsertionEffectWithLayoutFallback(function () {\n var sheetRefCurrent = sheetRef.current;\n var sheet = sheetRefCurrent[0],\n rehydrating = sheetRefCurrent[1];\n\n if (rehydrating) {\n sheetRefCurrent[1] = false;\n return;\n }\n\n if (serialized.next !== undefined) {\n // insert keyframes\n insertStyles(cache, serialized.next, true);\n }\n\n if (sheet.tags.length) {\n // if this doesn't exist then it will be null so the style element will be appended\n var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;\n sheet.before = element;\n sheet.flush();\n }\n\n cache.insert(\"\", serialized, sheet, false);\n }, [cache, serialized.name]);\n return null;\n});\n\nfunction css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return serializeStyles(args);\n}\n\nfunction keyframes() {\n var insertable = css.apply(void 0, arguments);\n var name = \"animation-\" + insertable.name;\n return {\n name: name,\n styles: \"@keyframes \" + name + \"{\" + insertable.styles + \"}\",\n anim: 1,\n toString: function toString() {\n return \"_EMO_\" + this.name + \"_\" + this.styles + \"_EMO_\";\n }\n };\n}\n\nvar classnames = function classnames(args) {\n var len = args.length;\n var i = 0;\n var cls = '';\n\n for (; i < len; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serializedArr = _ref.serializedArr;\n useInsertionEffectAlwaysWithSyncFallback(function () {\n\n for (var i = 0; i < serializedArr.length; i++) {\n insertStyles(cache, serializedArr[i], false);\n }\n });\n\n return null;\n};\n\nvar ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {\n var hasRendered = false;\n var serializedArr = [];\n\n var css = function css() {\n if (hasRendered && isDevelopment) {\n throw new Error('css can only be used during render');\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`\n\n registerStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var cx = function cx() {\n if (hasRendered && isDevelopment) {\n throw new Error('cx can only be used during render');\n }\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n var content = {\n css: css,\n cx: cx,\n theme: React.useContext(ThemeContext)\n };\n var ele = props.children(content);\n hasRendered = true;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serializedArr: serializedArr\n }), ele);\n});\n\nexport { ClassNames, Global, jsx as createElement, css, jsx, keyframes };\n","import createCache from '@emotion/cache';\nimport { serializeStyles } from '@emotion/serialize';\nimport { getRegisteredStyles, insertStyles } from '@emotion/utils';\n\nfunction insertWithoutScoping(cache, serialized) {\n if (cache.inserted[serialized.name] === undefined) {\n return cache.insert('', serialized, cache.sheet, true);\n }\n}\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar createEmotion = function createEmotion(options) {\n var cache = createCache(options);\n\n cache.sheet.speedy = function (value) {\n\n this.isSpeedy = value;\n };\n\n cache.compat = true;\n\n var css = function css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered, undefined);\n insertStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var keyframes = function keyframes() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n var animation = \"animation-\" + serialized.name;\n insertWithoutScoping(cache, {\n name: serialized.name,\n styles: \"@keyframes \" + animation + \"{\" + serialized.styles + \"}\"\n });\n return animation;\n };\n\n var injectGlobal = function injectGlobal() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n insertWithoutScoping(cache, serialized);\n };\n\n var cx = function cx() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n return {\n css: css,\n cx: cx,\n injectGlobal: injectGlobal,\n keyframes: keyframes,\n hydrate: function hydrate(ids) {\n ids.forEach(function (key) {\n cache.inserted[key] = true;\n });\n },\n flush: function flush() {\n cache.registered = {};\n cache.inserted = {};\n cache.sheet.flush();\n },\n sheet: cache.sheet,\n cache: cache,\n getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),\n merge: merge.bind(null, cache.registered, css)\n };\n};\n\nvar classnames = function classnames(args) {\n var cls = '';\n\n for (var i = 0; i < args.length; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nexport { createEmotion as default };\n","import createEmotion from '../create-instance/dist/emotion-css-create-instance.esm.js';\nimport '@emotion/cache';\nimport '@emotion/serialize';\nimport '@emotion/utils';\n\nvar _createEmotion = createEmotion({\n key: 'css'\n}),\n flush = _createEmotion.flush,\n hydrate = _createEmotion.hydrate,\n cx = _createEmotion.cx,\n merge = _createEmotion.merge,\n getRegisteredStyles = _createEmotion.getRegisteredStyles,\n injectGlobal = _createEmotion.injectGlobal,\n keyframes = _createEmotion.keyframes,\n css = _createEmotion.css,\n sheet = _createEmotion.sheet,\n cache = _createEmotion.cache;\n\nexport { cache, css, cx, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet };\n","// packages/components/src/utils/hooks/use-cx.ts\nimport { __unsafe_useEmotionCache as useEmotionCache } from \"@emotion/react\";\nimport { insertStyles } from \"@emotion/utils\";\nimport { cx as innerCx } from \"@emotion/css\";\nimport { useCallback } from \"@wordpress/element\";\nvar isSerializedStyles = (o) => typeof o !== \"undefined\" && o !== null && [\"name\", \"styles\"].every((p) => typeof o[p] !== \"undefined\");\nvar useCx = () => {\n const cache = useEmotionCache();\n const cx = useCallback((...classNames) => {\n if (cache === null) {\n throw new Error(\"The `useCx` hook should be only used within a valid Emotion Cache Context\");\n }\n return innerCx(...classNames.map((arg) => {\n if (isSerializedStyles(arg)) {\n insertStyles(cache, arg, false);\n return `${cache.key}-${arg.name}`;\n }\n return arg;\n }));\n }, [cache]);\n return cx;\n};\nexport {\n useCx\n};\n//# sourceMappingURL=use-cx.mjs.map\n","// packages/components/src/context/use-context-system.js\nimport warn from \"@wordpress/warning\";\nimport { useComponentsContext } from \"./context-system-provider.mjs\";\nimport { getNamespace, getConnectedNamespace } from \"./utils.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"useContextSystem: Please provide a namespace\") : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides: overrideProps,\n ...otherContextProps\n } = contextProps;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n const rendered = typeof initialMergedProps.renderChildren === \"function\" ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;\n for (const key in initialMergedProps) {\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n finalComponentProps[key] = overrideProps[key];\n }\n if (rendered !== void 0) {\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}\nexport {\n useContextSystem\n};\n//# sourceMappingURL=use-context-system.mjs.map\n","import memoize from '@emotion/memoize';\n\n// eslint-disable-next-line no-undef\nvar reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\nvar isPropValid = /* #__PURE__ */memoize(function (prop) {\n return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111\n /* o */\n && prop.charCodeAt(1) === 110\n /* n */\n && prop.charCodeAt(2) < 91;\n}\n/* Z+1 */\n);\n\nexport { isPropValid as default };\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport { withEmotionCache, ThemeContext } from '@emotion/react';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport * as React from 'react';\nimport isPropValid from '@emotion/is-prop-valid';\n\nvar isDevelopment = false;\n\nvar testOmitPropsOnStringTag = isPropValid;\n\nvar testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {\n return key !== 'theme';\n};\n\nvar getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {\n return typeof tag === 'string' && // 96 is one less than the char code\n // for \"a\" so this is checking that\n // it's a lowercase character\n tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;\n};\nvar composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {\n var shouldForwardProp;\n\n if (options) {\n var optionsShouldForwardProp = options.shouldForwardProp;\n shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {\n return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);\n } : optionsShouldForwardProp;\n }\n\n if (typeof shouldForwardProp !== 'function' && isReal) {\n shouldForwardProp = tag.__emotion_forwardProp;\n }\n\n return shouldForwardProp;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n return null;\n};\n\nvar createStyled = function createStyled(tag, options) {\n\n var isReal = tag.__emotion_real === tag;\n var baseTag = isReal && tag.__emotion_base || tag;\n var identifierName;\n var targetClassName;\n\n if (options !== undefined) {\n identifierName = options.label;\n targetClassName = options.target;\n }\n\n var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);\n var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);\n var shouldUseAs = !defaultShouldForwardProp('as');\n return function () {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];\n\n if (identifierName !== undefined) {\n styles.push(\"label:\" + identifierName + \";\");\n }\n\n if (args[0] == null || args[0].raw === undefined) {\n // eslint-disable-next-line prefer-spread\n styles.push.apply(styles, args);\n } else {\n var templateStringsArr = args[0];\n\n styles.push(templateStringsArr[0]);\n var len = args.length;\n var i = 1;\n\n for (; i < len; i++) {\n\n styles.push(args[i], templateStringsArr[i]);\n }\n }\n\n var Styled = withEmotionCache(function (props, cache, ref) {\n var FinalTag = shouldUseAs && props.as || baseTag;\n var className = '';\n var classInterpolations = [];\n var mergedProps = props;\n\n if (props.theme == null) {\n mergedProps = {};\n\n for (var key in props) {\n mergedProps[key] = props[key];\n }\n\n mergedProps.theme = React.useContext(ThemeContext);\n }\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, classInterpolations, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);\n className += cache.key + \"-\" + serialized.name;\n\n if (targetClassName !== undefined) {\n className += \" \" + targetClassName;\n }\n\n var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;\n var newProps = {};\n\n for (var _key in props) {\n if (shouldUseAs && _key === 'as') continue;\n\n if (finalShouldForwardProp(_key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof FinalTag === 'string'\n }), /*#__PURE__*/React.createElement(FinalTag, newProps));\n });\n Styled.displayName = identifierName !== undefined ? identifierName : \"Styled(\" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + \")\";\n Styled.defaultProps = tag.defaultProps;\n Styled.__emotion_real = Styled;\n Styled.__emotion_base = baseTag;\n Styled.__emotion_styles = styles;\n Styled.__emotion_forwardProp = shouldForwardProp;\n Object.defineProperty(Styled, 'toString', {\n value: function value() {\n if (targetClassName === undefined && isDevelopment) {\n return 'NO_COMPONENT_SELECTOR';\n }\n\n return \".\" + targetClassName;\n }\n });\n\n Styled.withComponent = function (nextTag, nextOptions) {\n var newStyled = createStyled(nextTag, _extends({}, options, nextOptions, {\n shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)\n }));\n return newStyled.apply(void 0, styles);\n };\n\n return Styled;\n };\n};\n\nexport { createStyled as default };\n","// packages/components/src/view/component.tsx\nimport _styled from \"@emotion/styled/base\";\nimport { forwardRef } from \"@wordpress/element\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar PolymorphicDiv = /* @__PURE__ */ _styled(\"div\", process.env.NODE_ENV === \"production\" ? {\n target: \"e19lxcc00\"\n} : {\n target: \"e19lxcc00\",\n label: \"PolymorphicDiv\"\n})(process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZWlDIiwiZmlsZSI6ImNvbXBvbmVudC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbi8qKlxuICogV29yZFByZXNzIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBmb3J3YXJkUmVmIH0gZnJvbSAnQHdvcmRwcmVzcy9lbGVtZW50JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL2NvbnRleHQnO1xuXG5jb25zdCBQb2x5bW9ycGhpY0RpdiA9IHN0eWxlZC5kaXZgYDtcblxuZnVuY3Rpb24gVW5mb3J3YXJkZWRWaWV3PCBUIGV4dGVuZHMgUmVhY3QuRWxlbWVudFR5cGUgPSAnZGl2JyA+KFxuXHR7IGFzLCAuLi5yZXN0UHJvcHMgfTogV29yZFByZXNzQ29tcG9uZW50UHJvcHM8IHt9LCBUID4sXG5cdHJlZjogUmVhY3QuRm9yd2FyZGVkUmVmPCBhbnkgPlxuKSB7XG5cdHJldHVybiA8UG9seW1vcnBoaWNEaXYgYXM9eyBhcyB9IHJlZj17IHJlZiB9IHsgLi4ucmVzdFByb3BzIH0gLz47XG59XG5cbi8qKlxuICogYFZpZXdgIGlzIGEgY29yZSBjb21wb25lbnQgdGhhdCByZW5kZXJzIGV2ZXJ5dGhpbmcgaW4gdGhlIGxpYnJhcnkuXG4gKiBJdCBpcyB0aGUgcHJpbmNpcGxlIGNvbXBvbmVudCBpbiB0aGUgZW50aXJlIGxpYnJhcnkuXG4gKlxuICogYGBganN4XG4gKiBpbXBvcnQgeyBWaWV3IH0gZnJvbSBgQHdvcmRwcmVzcy9jb21wb25lbnRzYDtcbiAqXG4gKiBmdW5jdGlvbiBFeGFtcGxlKCkge1xuICogXHRyZXR1cm4gKFxuICogXHRcdDxWaWV3PlxuICogXHRcdFx0IENvZGUgaXMgUG9ldHJ5XG4gKiBcdFx0PC9WaWV3PlxuICogXHQpO1xuICogfVxuICogYGBgXG4gKi9cbmV4cG9ydCBjb25zdCBWaWV3ID0gT2JqZWN0LmFzc2lnbiggZm9yd2FyZFJlZiggVW5mb3J3YXJkZWRWaWV3ICksIHtcblx0c2VsZWN0b3I6ICcuY29tcG9uZW50cy12aWV3Jyxcbn0gKTtcblxuZXhwb3J0IGRlZmF1bHQgVmlldztcbiJdfQ== */\");\nfunction UnforwardedView({\n as,\n ...restProps\n}, ref) {\n return /* @__PURE__ */ _jsx(PolymorphicDiv, {\n as,\n ref,\n ...restProps\n });\n}\nvar View = Object.assign(forwardRef(UnforwardedView), {\n selector: \".components-view\"\n});\nvar component_default = View;\nexport {\n View,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/grid/utils.ts\nvar ALIGNMENTS = {\n bottom: {\n alignItems: \"flex-end\",\n justifyContent: \"center\"\n },\n bottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n },\n bottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\"\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n spaced: {\n alignItems: \"center\",\n justifyContent: \"space-between\"\n },\n left: {\n alignItems: \"center\",\n justifyContent: \"flex-start\"\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\"\n },\n stretch: {\n alignItems: \"stretch\"\n },\n top: {\n alignItems: \"flex-start\",\n justifyContent: \"center\"\n },\n topLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\"\n },\n topRight: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n }\n};\nfunction getAlignmentProps(alignment) {\n const alignmentProps = alignment ? ALIGNMENTS[alignment] : {};\n return alignmentProps;\n}\nexport {\n getAlignmentProps\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/utils/use-responsive-value.ts\nimport { useEffect, useState } from \"@wordpress/element\";\nvar breakpoints = [\"40em\", \"52em\", \"64em\"];\nvar useBreakpointIndex = (options = {}) => {\n const {\n defaultIndex = 0\n } = options;\n if (typeof defaultIndex !== \"number\") {\n throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);\n } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {\n throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);\n }\n const [value, setValue] = useState(defaultIndex);\n useEffect(() => {\n const getIndex = () => breakpoints.filter((bp) => {\n return typeof window !== \"undefined\" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;\n }).length;\n const onResize = () => {\n const newValue = getIndex();\n if (value !== newValue) {\n setValue(newValue);\n }\n };\n onResize();\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"resize\", onResize);\n }\n return () => {\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"resize\", onResize);\n }\n };\n }, [value]);\n return value;\n};\nfunction useResponsiveValue(values, options = {}) {\n const index = useBreakpointIndex(options);\n if (!Array.isArray(values) && typeof values !== \"function\") {\n return values;\n }\n const array = values || [];\n return array[index >= array.length ? array.length - 1 : index];\n}\nexport {\n useBreakpointIndex,\n useResponsiveValue\n};\n//# sourceMappingURL=use-responsive-value.mjs.map\n","// packages/components/src/utils/colors-values.js\nvar white = \"#fff\";\nvar GRAY = {\n 900: \"#1e1e1e\",\n 800: \"#2f2f2f\",\n /** Meets 4.6:1 text contrast against white. */\n 700: \"#757575\",\n /** Meets 3:1 UI or large text contrast against white. */\n 600: \"#949494\",\n 400: \"#ccc\",\n /** Used for most borders. */\n 300: \"#ddd\",\n /** Used sparingly for light borders. */\n 200: \"#e0e0e0\",\n /** Used for light gray backgrounds. */\n 100: \"#f0f0f0\"\n};\nvar ALERT = {\n yellow: \"#f0b849\",\n red: \"#d94f4f\",\n green: \"#4ab866\"\n};\nvar THEME = {\n accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,\n accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,\n accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,\n /** Used when placing text on the accent color. */\n accentInverted: `var(--wp-components-color-accent-inverted, ${white})`,\n background: `var(--wp-components-color-background, ${white})`,\n foreground: `var(--wp-components-color-foreground, ${GRAY[900]})`,\n /** Used when placing text on the foreground color. */\n foregroundInverted: `var(--wp-components-color-foreground-inverted, ${white})`,\n gray: {\n /** @deprecated Use `COLORS.theme.foreground` instead. */\n 900: `var(--wp-components-color-foreground, ${GRAY[900]})`,\n 800: `var(--wp-components-color-gray-800, ${GRAY[800]})`,\n 700: `var(--wp-components-color-gray-700, ${GRAY[700]})`,\n 600: `var(--wp-components-color-gray-600, ${GRAY[600]})`,\n 400: `var(--wp-components-color-gray-400, ${GRAY[400]})`,\n 300: `var(--wp-components-color-gray-300, ${GRAY[300]})`,\n 200: `var(--wp-components-color-gray-200, ${GRAY[200]})`,\n 100: `var(--wp-components-color-gray-100, ${GRAY[100]})`\n }\n};\nvar UI = {\n background: THEME.background,\n backgroundDisabled: THEME.gray[100],\n border: THEME.gray[600],\n borderHover: THEME.gray[700],\n borderFocus: THEME.accent,\n borderDisabled: THEME.gray[400],\n textDisabled: THEME.gray[600],\n // Matches @wordpress/base-styles\n darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,\n lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`\n};\nvar COLORS = Object.freeze({\n /**\n * The main gray color object.\n *\n * @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.\n */\n gray: GRAY,\n // TODO: Stop exporting this when everything is migrated to `theme` or `ui`\n /**\n * @deprecated Prefer theme-ready variables in `COLORS.theme`.\n */\n white,\n alert: ALERT,\n /**\n * Theme-ready variables with fallbacks.\n *\n * Prefer semantic aliases in `COLORS.ui` when applicable.\n */\n theme: THEME,\n /**\n * Semantic aliases (prefer these over raw variables when applicable).\n */\n ui: UI\n});\nvar colors_values_default = COLORS;\nexport {\n COLORS,\n colors_values_default as default\n};\n//# sourceMappingURL=colors-values.mjs.map\n","// packages/components/src/utils/config-values.js\nimport { COLORS } from \"./colors-values.mjs\";\nvar CONTROL_HEIGHT = \"36px\";\nvar CONTROL_PROPS = {\n // These values should be shared with TextControl.\n controlPaddingX: 12,\n controlPaddingXSmall: 8,\n controlPaddingXLarge: 12 * 1.3334,\n // TODO: Deprecate\n controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`,\n controlHeight: CONTROL_HEIGHT,\n controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,\n controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,\n controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,\n controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`\n};\nvar config_values_default = Object.assign({}, CONTROL_PROPS, {\n colorDivider: \"rgba(0, 0, 0, 0.1)\",\n colorScrollbarThumb: \"rgba(0, 0, 0, 0.2)\",\n colorScrollbarThumbHover: \"rgba(0, 0, 0, 0.5)\",\n colorScrollbarTrack: \"rgba(0, 0, 0, 0.04)\",\n elevationIntensity: 1,\n radiusXSmall: \"1px\",\n radiusSmall: \"2px\",\n radiusMedium: \"4px\",\n radiusLarge: \"8px\",\n radiusFull: \"9999px\",\n radiusRound: \"50%\",\n borderWidth: \"1px\",\n borderWidthFocus: \"1.5px\",\n borderWidthTab: \"4px\",\n spinnerSize: 16,\n fontSize: \"13px\",\n fontSizeH1: \"calc(2.44 * 13px)\",\n fontSizeH2: \"calc(1.95 * 13px)\",\n fontSizeH3: \"calc(1.56 * 13px)\",\n fontSizeH4: \"calc(1.25 * 13px)\",\n fontSizeH5: \"13px\",\n fontSizeH6: \"calc(0.8 * 13px)\",\n fontSizeInputMobile: \"16px\",\n fontSizeMobile: \"15px\",\n fontSizeSmall: \"calc(0.92 * 13px)\",\n fontSizeXSmall: \"calc(0.75 * 13px)\",\n fontLineHeightBase: \"1.4\",\n fontWeight: \"normal\",\n fontWeightMedium: \"499\",\n // ensures fallback to 400 (instead of 600)\n fontWeightHeading: \"600\",\n gridBase: \"4px\",\n elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,\n elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,\n elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,\n elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,\n surfaceBackgroundColor: COLORS.white,\n surfaceBackgroundSubtleColor: \"#F3F3F3\",\n surfaceBackgroundTintColor: \"#F5F5F5\",\n surfaceBorderColor: \"rgba(0, 0, 0, 0.1)\",\n surfaceBorderBoldColor: \"rgba(0, 0, 0, 0.15)\",\n surfaceBorderSubtleColor: \"rgba(0, 0, 0, 0.05)\",\n surfaceBackgroundTertiaryColor: COLORS.white,\n surfaceColor: COLORS.white,\n // Modal exit animation: `use-modal-exit-animation` parses this for the\n // `animationend` timeout race; keep the numeric duration equal to\n // `--wpds-motion-duration-md` on `.components-modal__frame` in modal/style.scss.\n transitionDuration: \"200ms\",\n transitionDurationFast: \"160ms\",\n transitionDurationFaster: \"120ms\",\n transitionDurationFastest: \"100ms\",\n transitionTimingFunction: \"cubic-bezier(0.08, 0.52, 0.52, 1)\",\n transitionTimingFunctionControl: \"cubic-bezier(0.12, 0.8, 0.32, 1)\"\n});\nexport {\n config_values_default as default\n};\n//# sourceMappingURL=config-values.mjs.map\n","// packages/components/src/grid/hook.ts\nimport { css } from \"@emotion/react\";\nimport { useMemo } from \"@wordpress/element\";\nimport { useContextSystem } from \"../context/index.mjs\";\nimport { getAlignmentProps } from \"./utils.mjs\";\nimport { useResponsiveValue } from \"../utils/use-responsive-value.mjs\";\nimport CONFIG from \"../utils/config-values.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useGrid(props) {\n const {\n align,\n alignment,\n className,\n columnGap,\n columns = 2,\n gap = 3,\n isInline = false,\n justify,\n rowGap,\n rows,\n templateColumns,\n templateRows,\n ...otherProps\n } = useContextSystem(props, \"Grid\");\n const columnsAsArray = Array.isArray(columns) ? columns : [columns];\n const column = useResponsiveValue(columnsAsArray);\n const rowsAsArray = Array.isArray(rows) ? rows : [rows];\n const row = useResponsiveValue(rowsAsArray);\n const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;\n const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;\n const cx = useCx();\n const classes = useMemo(() => {\n const alignmentProps = getAlignmentProps(alignment);\n const gridClasses = /* @__PURE__ */ css({\n alignItems: align,\n display: isInline ? \"inline-grid\" : \"grid\",\n gap: `calc( ${CONFIG.gridBase} * ${gap} )`,\n gridTemplateColumns: gridTemplateColumns || void 0,\n gridTemplateRows: gridTemplateRows || void 0,\n gridRowGap: rowGap,\n gridColumnGap: columnGap,\n justifyContent: justify,\n verticalAlign: isInline ? \"middle\" : void 0,\n ...alignmentProps\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:gridClasses;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBdURzQiIsImZpbGUiOiJob29rLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlTWVtbyB9IGZyb20gJ0B3b3JkcHJlc3MvZWxlbWVudCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB0eXBlIHsgV29yZFByZXNzQ29tcG9uZW50UHJvcHMgfSBmcm9tICcuLi9jb250ZXh0JztcbmltcG9ydCB7IHVzZUNvbnRleHRTeXN0ZW0gfSBmcm9tICcuLi9jb250ZXh0JztcbmltcG9ydCB7IGdldEFsaWdubWVudFByb3BzIH0gZnJvbSAnLi91dGlscyc7XG5pbXBvcnQgeyB1c2VSZXNwb25zaXZlVmFsdWUgfSBmcm9tICcuLi91dGlscy91c2UtcmVzcG9uc2l2ZS12YWx1ZSc7XG5pbXBvcnQgQ09ORklHIGZyb20gJ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xcblx0XHRjb2x1bW5HYXAsXG5cdFx0Y3gsXG5cdFx0Z2FwLFxuXHRcdGdyaWRUZW1wbGF0ZUNvbHVtbnMsXG5cdFx0Z3JpZFRlbXBsYXRlUm93cyxcblx0XHRpc0lubGluZSxcblx0XHRqdXN0aWZ5LFxuXHRcdHJvd0dhcCxcblx0XSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcyB9O1xufVxuIl19 */\");\n return cx(gridClasses, className);\n }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);\n return {\n ...otherProps,\n className: classes\n };\n}\nexport {\n useGrid as default\n};\n//# sourceMappingURL=hook.mjs.map\n","// packages/components/src/grid/component.tsx\nimport { contextConnect } from \"../context/index.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport useGrid from \"./hook.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedGrid(props, forwardedRef) {\n const gridProps = useGrid(props);\n return /* @__PURE__ */ _jsx(View, {\n ...gridProps,\n ref: forwardedRef\n });\n}\nvar Grid = contextConnect(UnconnectedGrid, \"Grid\");\nvar component_default = Grid;\nexport {\n Grid,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","import { __ } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme, useGlobalChartsContext } from '../../../providers';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { LeaderboardEntry } from '../../../types';\n\n/**\n * Hook to create legend items from leaderboard data\n * @param root0 - Configuration object\n * @param root0.data - Array of leaderboard entries\n * @param root0.primaryColor - Primary color override\n * @param root0.secondaryColor - Secondary color override\n * @param root0.withComparison - Whether comparison data is shown\n * @param root0.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param root0.legendLabels - Custom labels for legend items\n * @param root0.legendLabels.primary - Label for primary period data\n * @param root0.legendLabels.comparison - Label for comparison period data\n * @return Array of legend items for the leaderboard chart\n */\nexport function useLeaderboardLegendItems( {\n\tdata,\n\tprimaryColor,\n\tsecondaryColor,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tlegendLabels,\n}: {\n\tdata: LeaderboardEntry[];\n\tprimaryColor?: string;\n\tsecondaryColor?: string;\n\twithComparison: boolean;\n\twithOverlayLabel: boolean;\n\tlegendLabels?: {\n\t\tprimary?: string;\n\t\tcomparison?: string;\n\t};\n} ): BaseLegendItem[] {\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst items: BaseLegendItem[] = [];\n\n\t\t// Add current period legend item\n\t\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\t\tindex: 0,\n\t\t\toverrideColor: primaryColor || leaderboardChartSettings.primaryColor,\n\t\t} );\n\n\t\titems.push( {\n\t\t\tlabel: legendLabels?.primary || __( 'Current period', 'jetpack-charts' ),\n\t\t\tcolor: resolvedPrimaryColor,\n\t\t} );\n\n\t\t// Add comparison period legend item if comparison is enabled and overlay label is not enabled\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\t\t\tindex: 1,\n\t\t\t\toverrideColor: secondaryColor || leaderboardChartSettings.secondaryColor,\n\t\t\t} );\n\n\t\t\titems.push( {\n\t\t\t\tlabel: legendLabels?.comparison || __( 'Previous period', 'jetpack-charts' ),\n\t\t\t\tcolor: resolvedSecondaryColor,\n\t\t\t} );\n\t\t}\n\n\t\treturn items;\n\t}, [\n\t\tdata,\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\tlegendLabels,\n\t\tleaderboardChartSettings,\n\t\tgetElementStyles,\n\t\twithOverlayLabel,\n\t] );\n}\n","/* eslint-disable @wordpress/no-unsafe-wp-apis */\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { Fragment } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { Stack, Text } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useContext, useMemo, type FC } from 'react';\nimport { Legend } from '../../components/legend';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { formatMetricValue, attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport { useLeaderboardLegendItems } from './hooks';\nimport styles from './leaderboard-chart.module.scss';\nimport type { LeaderboardChartProps } from './types';\nimport type { LeaderboardEntry } from '../../types';\n\n/**\n * Default value formatter using formatMetricValue\n *\n * @param value - The numeric value to format\n * @return Formatted string representation of the value\n */\nconst defaultValueFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value, 'number', {\n\t\tuseMultipliers: true,\n\t\tdecimals: 1,\n\t} );\n};\n\n/**\n * Default delta formatter using formatMetricValue\n *\n * @param value - The delta value to format\n * @return Formatted percentage string\n */\nconst defaultDeltaFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value / 100, 'average', {\n\t\tdecimals: 0,\n\t\tsignDisplay: 'exceptZero',\n\t} );\n};\n\n/**\n * Build a bar's width. A hover-inset CSS variable (0 by default) is subtracted\n * on hover, scaled by the bar's share so the pull-back is proportional to its\n * length: the full-length (100%) bar — the one that reaches the value — pulls\n * back the whole inset to keep its gap with the value, while shorter bars pull\n * back proportionally less, down to ~0 for a very short bar.\n *\n * @param share - The bar's share of the row width, as a percentage.\n * @return A CSS width value.\n */\nconst getBarWidth = ( share: number ): string =>\n\t`calc(${ share }% - var(--a8c--charts--leaderboard--bar--hover-inset, 0px) * ${ share } / 100)`;\n\nconst BarLabel = ( { label }: { label: LeaderboardEntry[ 'label' ] } ) => (\n\t<>{ typeof label === 'string' ? <Text className={ styles.label }>{ label }</Text> : label }</>\n);\n\nconst BarWithLabel = ( {\n\tentry,\n\twithComparison,\n\twithOverlayLabel,\n\tprimaryColor,\n\tsecondaryColor,\n\tanimation,\n\tisPrimaryVisible = true,\n\tisComparisonVisible = true,\n}: {\n\tentry: LeaderboardEntry;\n\twithComparison?: boolean;\n\twithOverlayLabel?: boolean;\n\tprimaryColor: string;\n\tsecondaryColor: string;\n\tisPrimaryVisible?: boolean;\n\tisComparisonVisible?: boolean;\n\tanimation?: boolean;\n} ) => (\n\t<div\n\t\tclassName={ clsx( styles.barWithLabelContainer, {\n\t\t\t[ styles[ 'is-overlay' ] ]: withOverlayLabel,\n\t\t} ) }\n\t>\n\t\t<BarLabel label={ entry.label } />\n\n\t\t{ isPrimaryVisible && (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: getBarWidth( entry.currentShare ),\n\t\t\t\t\tbackgroundColor: primaryColor,\n\t\t\t\t} }\n\t\t\t></div>\n\t\t) }\n\n\t\t{ withComparison && ! withOverlayLabel && isComparisonVisible && (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: getBarWidth( entry.previousShare ),\n\t\t\t\t\tbackgroundColor: secondaryColor,\n\t\t\t\t} }\n\t\t\t></div>\n\t\t) }\n\t</div>\n);\n\n/**\n * LeaderboardChart component displays a ranked list of data with progress bars\n * and optional comparison values.\n *\n * @param props - Component props\n * @param props.data - Array of leaderboard entries to display\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.width - Optional width of the chart container in pixels\n * @param props.height - Optional height of the chart container in pixels\n * @param props.withComparison - Whether to show comparison data\n * @param props.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param props.primaryColor - Primary color for current period bars\n * @param props.secondaryColor - Secondary color for comparison period bars\n * @param props.valueFormatter - Custom formatter for values\n * @param props.deltaFormatter - Custom formatter for delta values\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether the chart should animate on load\n * @param props.showLegend - Whether to show legend\n * @param props.legend - Legend configuration (orientation, position, alignment, shape, shapeStyles, interactive)\n * @param props.legendLabels - Custom labels for legend items\n * @param props.gap - Spacing between legend and chart content\n * @param props.children - Child components for composition API\n * @param props.className - Additional CSS class name\n * @param props.style - Custom styling for the chart container\n * @return JSX element representing the leaderboard chart\n */\nconst LeaderboardChartInternal: FC< LeaderboardChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tprimaryColor,\n\tsecondaryColor,\n\tvalueFormatter = defaultValueFormatter,\n\tdeltaFormatter = defaultDeltaFormatter,\n\tanimation,\n\tloading = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendLabels,\n\tgap = 'md',\n\tclassName,\n\tstyle,\n\tchildren,\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst legendShapeStyles = { width: 8, height: 8, ...legend.shapeStyles };\n\n\t// Process children to extract compound components\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LeaderboardChart' );\n\tconst {\n\t\tlabelSpacing,\n\t\trowGap,\n\t\tcolumnGap,\n\t\tprimaryColor: settingsPrimaryColor,\n\t\tsecondaryColor: settingsSecondaryColor,\n\t\tdeltaColors,\n\t} = leaderboardChartSettings;\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || settingsPrimaryColor,\n\t} );\n\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\tindex: 1,\n\t\toverrideColor: secondaryColor || settingsSecondaryColor,\n\t} );\n\n\t// Create legend items using the custom hook\n\tconst legendItems = useLeaderboardLegendItems( {\n\t\tdata: data || [],\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t\tlegendLabels,\n\t} );\n\n\t// Track visibility of primary and comparison series for interactive legends\n\tconst isPrimaryVisible = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive || legendItems.length === 0 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 0 ].label );\n\t}, [ chartId, legendInteractive, legendItems, isSeriesVisible ] );\n\n\tconst isComparisonVisible = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive || legendItems.length < 2 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 1 ].label );\n\t}, [ chartId, legendInteractive, legendItems, isSeriesVisible ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\tif ( ! legendInteractive ) return false;\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\treturn ! isPrimaryVisible && ! isComparisonVisible;\n\t\t}\n\t\treturn ! isPrimaryVisible;\n\t}, [\n\t\tlegendInteractive,\n\t\tisPrimaryVisible,\n\t\tisComparisonVisible,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t] );\n\n\t// Validate data\n\tconst isDataValid = Boolean( data && data.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\twithComparison,\n\t\t\twithOverlayLabel,\n\t\t} ),\n\t\t[ withComparison, withOverlayLabel ]\n\t);\n\n\t// Register chart with context\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'leaderboard',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! data || data.length === 0 ) {\n\t\treturn (\n\t\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ false }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tstyle={ { ...style, width: propWidth || undefined, height: propHeight || undefined } }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t>\n\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t{ loading\n\t\t\t\t\t\t\t? __( 'Loading…', 'jetpack-charts' )\n\t\t\t\t\t\t\t: __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t\t</div>\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tshapeStyles={ legendShapeStyles }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tgap={ gap }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...style,\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t>\n\t\t\t\t<div className={ styles.leaderboardChart__content }>\n\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t\t{ __( 'All series are hidden. Click legend items to show data.', 'jetpack-charts' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Grid templateColumns=\"minmax(0, 1fr) auto\" rowGap={ rowGap } columnGap={ columnGap }>\n\t\t\t\t\t\t\t{ data.map( entry => {\n\t\t\t\t\t\t\t\tconst colorIndex = Math.sign( entry.delta ) + 1;\n\t\t\t\t\t\t\t\tconst deltaColor = deltaColors[ colorIndex ];\n\n\t\t\t\t\t\t\t\tconst rowCells = (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={ labelSpacing }>\n\t\t\t\t\t\t\t\t\t\t\t<BarWithLabel\n\t\t\t\t\t\t\t\t\t\t\t\tentry={ entry }\n\t\t\t\t\t\t\t\t\t\t\t\twithComparison={ withComparison }\n\t\t\t\t\t\t\t\t\t\t\t\twithOverlayLabel={ withOverlayLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tprimaryColor={ resolvedPrimaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tsecondaryColor={ resolvedSecondaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimaryVisible={ isPrimaryVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tisComparisonVisible={ isComparisonVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tanimation={ animation && ! loading && ! prefersReducedMotion }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\t\tgap=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.valueContainer, {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles.overlayLabel ]: withOverlayLabel,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ isPrimaryVisible && <Text>{ valueFormatter( entry.currentValue ) }</Text> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ withComparison && isComparisonVisible && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text style={ { color: deltaColor } }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ deltaFormatter( entry.delta ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( entry.onClick ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.interactiveRow }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ entry.onClick }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ entry.ariaLabel }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t\t\t<Icon className={ styles.chevron } icon={ chevronRight } size={ 24 } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn <Fragment key={ entry.id }>{ rowCells }</Fragment>;\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst LeaderboardChartWithProvider: FC< LeaderboardChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <LeaderboardChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LeaderboardChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nLeaderboardChartWithProvider.displayName = 'LeaderboardChart';\n\n// Create LeaderboardChart with composition API\nconst LeaderboardChart = attachSubComponents( LeaderboardChartWithProvider, {\n\tLegend: Legend,\n} );\n\n// Create responsive LeaderboardChart with composition API\nconst LeaderboardChartResponsive = attachSubComponents(\n\twithResponsive< LeaderboardChartProps >( LeaderboardChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n);\n\nexport { LeaderboardChartResponsive as default, LeaderboardChart as LeaderboardChartUnresponsive };\n","/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\ntype Angle = `${ number }deg` | `${ number }rad` | `${ number }grad` | `${ number }turn` | 0 | '0';\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\nexport type RadialWipeAnimationProps = {\n\tid: string;\n\tradius: number;\n\tinnerRadius?: number;\n\tdurationMs?: number;\n\tstartAngle?: Angle;\n\tdirection?: 'clockwise' | 'counter-clockwise';\n\twipePercentage?: number;\n};\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation( {\n\tid,\n\tradius,\n\tinnerRadius = 0,\n\tdurationMs = 1000,\n\twipePercentage = 100,\n\tdirection = 'clockwise',\n\tstartAngle = '-90deg',\n}: RadialWipeAnimationProps ) {\n\tconst strokeWidth =\n\t\t( radius - innerRadius ) * 2 + // The stroke is centered on the circumference, so we need to double the width.\n\t\t1; // Added 1 to prevent sub-pixel rendering issues.\n\n\tconst scaleY = direction === 'clockwise' ? -1 : 1;\n\n\tconst isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n\tconst animationDuration = `${\n\t\t// If wipePercentage is invalid, set animation duration to 0 to disable animation.\n\t\tisValidWipePercentage ? durationMs * ( 100 / wipePercentage ) : 0\n\t}ms`;\n\n\treturn (\n\t\t<mask id={ id }>\n\t\t\t<circle\n\t\t\t\tcx={ 0 }\n\t\t\t\tcy={ 0 }\n\t\t\t\tr={ radius }\n\t\t\t\tpathLength=\"100\"\n\t\t\t\tfill=\"white\"\n\t\t\t\tstroke=\"black\" // The stroke will be un-drawn, hence 'black' mask.\n\t\t\t\tstrokeWidth={ strokeWidth }\n\t\t\t\tstrokeDasharray=\"100, 1000\"\n\t\t\t\tstrokeDashoffset=\"0\"\n\t\t\t\tstyle={ { transform: `rotate(${ startAngle }) scaleY(${ scaleY })` } }\n\t\t\t>\n\t\t\t\t<animate\n\t\t\t\t\tattributeName=\"stroke-dashoffset\"\n\t\t\t\t\tfrom=\"0\"\n\t\t\t\t\tto=\"100.1\"\n\t\t\t\t\tdur={ animationDuration }\n\t\t\t\t\tfill=\"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n\t\t\t\t\tcalcMode=\"spline\" // custom easing\n\t\t\t\t\tkeySplines=\"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n\t\t\t\t\tkeyTimes={ `0;${ wipePercentage / 100 };1` }\n\t\t\t\t/>\n\t\t\t</circle>\n\t\t</mask>\n\t);\n}\n\nexport default RadialWipeAnimation;\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseInteractiveLegendData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents, resolveFontSize } from '../../utils';\nimport { getStringWidth } from '../../visx/text';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation/';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive, ResponsiveConfig } from '../private/with-responsive';\nimport styles from './pie-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { SVGProps, MouseEvent, ReactNode, FC } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for pie charts.\n */\nexport type PieChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieTooltip = ( { tooltipData }: PieChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nexport interface PieChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Inner radius in pixels. If > 0, creates a donut chart. Defaults to 0.\n\t */\n\tinnerRadius?: number;\n\n\t/**\n\t * Add padding to the chart\n\t */\n\tpadding?: number;\n\n\t/**\n\t * Thickness of the pie chart.\n\t * A value between 0 and 1, where 0 means no thickness\n\t * and 1 means the maximum thickness.\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Scale of the gap between groups in the pie chart\n\t * A value between 0 and 1, where 0 means no gap.\n\t */\n\tgapScale?: number;\n\n\t/**\n\t * Scale of the corner radius for the pie chart segments.\n\t * A value between 0 and 1, where 0 means no corner radius.\n\t */\n\tcornerScale?: number;\n\n\t/**\n\t * Whether to show labels on pie segments. Defaults to true.\n\t */\n\tshowLabels?: boolean;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieChartBaseProps = Optional< PieChartProps, 'size' >;\n\n// Composition API types\ntype PieChartComponent = ChartComponentWithComposition< PieChartBaseProps >;\ntype PieChartResponsiveComponent = ChartComponentWithComposition<\n\tPieChartBaseProps & ResponsiveConfig\n>;\n\n/**\n * Validates the pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\n/**\n * Renders a pie or donut chart using the provided data.\n *\n * @param {PieChartProps} props - Component props\n * @return {JSX.Element} The rendered chart component\n */\nconst PieChartInternal = ( {\n\tdata,\n\tchartId: providedChartId,\n\twithTooltips = false,\n\tclassName,\n\tshowLegend = false,\n\tlegend = {},\n\twidth: propWidth,\n\theight: propHeight,\n\tsize,\n\tanimation,\n\tthickness = 1,\n\tpadding = 0,\n\tgapScale = 0,\n\tcornerScale = 0,\n\tshowLabels = true,\n\tlegendValueDisplay = 'percentage',\n\tchildren = null,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieTooltip,\n\tgap = 'md',\n}: PieChartProps ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst onMouseLeave = useCallback( () => {\n\t\tif ( ! withTooltips ) {\n\t\t\treturn;\n\t\t}\n\t\thideTooltip();\n\t}, [ withTooltips, hideTooltip ] );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data for interactive legends\n\tconst { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tlegendInteractive,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\tconst { isValid, message } = validateData( data );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tgapScale,\n\t\t\tcornerScale,\n\t\t} ),\n\t\t[ thickness, gapScale, cornerScale ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( ! isValid ) {\n\t\treturn (\n\t\t\t<div className={ clsx( 'pie-chart', styles[ 'pie-chart' ], className ) }>\n\t\t\t\t<div className={ styles[ 'error-message' ] }>{ message }</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Calculate the angle between each (use original data length for consistent spacing)\n\tconst padAngle = gapScale * ( ( 2 * Math.PI ) / data.length );\n\n\t// Map the data to include index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\tconst accessors = {\n\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) => {\n\t\t\treturn getElementStyles( { data: d, index: d.index } ).color;\n\t\t},\n\t};\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-chart',\n\t\t\t\t\tstyles[ 'pie-chart' ],\n\t\t\t\t\t// Fill parent when no explicit dimensions provided\n\t\t\t\t\t{ [ styles[ 'pie-chart--responsive' ] ]: ! propWidth && ! propHeight },\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div role=\"tooltip\">{ renderTooltip( { tooltipData } ) }</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : 300;\n\t\t\t\t\tconst availableHeight = contentHeight > 0 ? contentHeight : 300;\n\t\t\t\t\tconst availableSize = Math.min( availableWidth, availableHeight );\n\t\t\t\t\tconst actualSize = size ? Math.min( size, availableSize ) : availableSize;\n\n\t\t\t\t\tconst width = actualSize;\n\t\t\t\t\tconst height = actualSize;\n\n\t\t\t\t\tconst radius = Math.min( width, height ) / 2;\n\t\t\t\t\tconst centerX = width / 2;\n\t\t\t\t\tconst centerY = height / 2;\n\n\t\t\t\t\tconst outerRadius = radius - padding;\n\t\t\t\t\tconst innerRadius = thickness === 0 ? 0 : outerRadius * ( 1 - thickness );\n\n\t\t\t\t\tconst maxCornerRadius = ( outerRadius - innerRadius ) / 2;\n\t\t\t\t\tconst cornerRadius = cornerScale\n\t\t\t\t\t\t? Math.min( cornerScale * outerRadius, maxCornerRadius )\n\t\t\t\t\t\t: 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ centerY }\n\t\t\t\t\t\t\t\t\tleft={ centerX }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ 0 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\touterRadius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\tpadAngle={ padAngle }\n\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ cornerRadius }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( ( arc, index ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst [ centroidX, centroidY ] = pie.path.centroid( arc );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst hasSpaceForLabel = arc.endAngle - arc.startAngle >= 0.25;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst handleMouseMove = ( event: MouseEvent< SVGElement > ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowTooltip( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipData: arc.data,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst pathProps: SVGProps< SVGPathElement > & {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid'?: string;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\td: pie.path( arc ) || '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill: accessors.fill( arc.data ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid': 'pie-segment',\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst groupProps: SVGProps< SVGGElement > = {};\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseMove = handleMouseMove;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseLeave = onMouseLeave;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst svgLabelSmall = providerTheme.svgLabelSmall;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst fontSize = resolveFontSize( svgLabelSmall?.fontSize ) ?? 12;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst estimatedTextWidth = getStringWidth( arc.data.label, {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontFamily: svgLabelSmall?.fontFamily,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontWeight: svgLabelSmall?.fontWeight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelPadding = 6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundWidth = estimatedTextWidth + labelPadding * 2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundHeight = fontSize + labelPadding * 2;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ `arc-${ index }` } { ...groupProps }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path { ...pathProps } />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ showLabels && hasSpaceForLabel && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ providerTheme.labelBackgroundColor && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX - backgroundWidth / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY - backgroundHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ backgroundWidth }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={ backgroundHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trx={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\try={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdy=\".33em\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelTextColor || '#333' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t</Pie>\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t{ /* Render SVG children (like Group, Text) inside the SVG */ }\n\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst PieChartWithProvider: FC< PieChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieChartWithProvider.displayName = 'PieChart';\n\n// Create PieChart with composition API\nconst PieChart = attachSubComponents( PieChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieChartComponent;\n\n// Create responsive PieChart with composition API\nconst PieChartResponsive = attachSubComponents(\n\twithResponsive< PieChartProps >( PieChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieChartResponsiveComponent;\n\nexport { PieChartResponsive as default, PieChart as PieChartUnresponsive };\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Text } from '@visx/text';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseInteractiveLegendData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-semi-circle-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { PieProvidedProps } from '@visx/shape';\nimport type { FC, MouseEvent, ReactNode } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for semi-circle charts.\n */\nexport type PieSemiCircleChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for semi-circle pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieSemiCircleTooltip = ( {\n\ttooltipData,\n}: PieSemiCircleChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nconst PAD_ANGLE = 0.03; // Padding between segments\nconst DEFAULT_WIDTH = 400;\n\nexport interface PieSemiCircleChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Explicit width of the chart container in pixels.\n\t * When omitted, the chart fills its parent container's width.\n\t * The chart always maintains a 2:1 width-to-height ratio, constrained by available space.\n\t */\n\twidth?: number;\n\n\t/**\n\t * Thickness of the pie chart. A value between 0 and 1\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Direction of chart rendering\n\t * true for clockwise, false for counter-clockwise\n\t */\n\tclockwise?: boolean;\n\n\t/**\n\t * Label text to display above the chart\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Note text to display below the label\n\t */\n\tnote?: string;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieSemiCircleChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieSemiCircleChartBaseProps = Optional< PieSemiCircleChartProps, 'width' >;\n\n// Composition API types\ntype PieSemiCircleChartComponent = ChartComponentWithComposition< PieSemiCircleChartBaseProps >;\ntype PieSemiCircleChartResponsiveComponent = ChartComponentWithComposition<\n\tPieSemiCircleChartBaseProps & ResponsiveConfig\n>;\n\nexport type ArcData = PieProvidedProps< DataPointPercentageCalculated >[ 'arcs' ][ number ];\n\n/**\n * Validates the semi-circle pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\nconst PieSemiCircleChartInternal: FC< PieSemiCircleChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\tthickness = 0.4,\n\tclockwise = true,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendValueDisplay = 'percentage',\n\tlabel,\n\tanimation,\n\tnote,\n\tclassName,\n\tchildren,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieSemiCircleTooltip,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst handleMouseMove = useCallback(\n\t\t( event: MouseEvent< SVGElement >, arc: ArcData ) => {\n\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: arc.data,\n\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tcontainerBounds.width,\n\t\t\tcontainerBounds.height,\n\t\t\tcontainerBounds.left,\n\t\t\tcontainerBounds.top,\n\t\t\tshowTooltip,\n\t\t\ttooltipOffsetX,\n\t\t\ttooltipOffsetY,\n\t\t]\n\t);\n\n\tconst handleMouseLeave = useCallback( () => {\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\tconst handleArcMouseMove = useCallback(\n\t\t( arc: ArcData ) => ( event: MouseEvent< SVGElement > ) => {\n\t\t\thandleMouseMove( event, arc );\n\t\t},\n\t\t[ handleMouseMove ]\n\t);\n\n\t// Validate data first to get validation result\n\tconst { isValid, message } = validateData( data );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data for interactive legends\n\tconst { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tlegendInteractive,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Define accessors with useMemo to avoid changing dependencies\n\tconst accessors = useMemo(\n\t\t() => ( {\n\t\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\t\tsort: (\n\t\t\t\ta: DataPointPercentageCalculated & { index: number },\n\t\t\t\tb: DataPointPercentageCalculated & { index: number }\n\t\t\t) => b.value - a.value,\n\t\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) =>\n\t\t\t\tgetElementStyles( { data: d, index: d.index } ).color,\n\t\t} ),\n\t\t[ getElementStyles ]\n\t);\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieSemiCircleChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tclockwise,\n\t\t} ),\n\t\t[ thickness, clockwise ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie-semi-circle',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tconst effectiveWidth = propWidth || DEFAULT_WIDTH;\n\n\tif ( ! isValid ) {\n\t\tconst errorWidth = propHeight\n\t\t\t? Math.min( propWidth || propHeight * 2, propHeight * 2 )\n\t\t\t: effectiveWidth;\n\t\tconst errorHeight = errorWidth / 2;\n\n\t\treturn (\n\t\t\t<div className={ styles[ 'pie-semi-circle-chart' ] }>\n\t\t\t\t<svg width={ errorWidth } height={ errorHeight } data-testid=\"pie-chart-svg\">\n\t\t\t\t\t<text x=\"50%\" y=\"50%\" textAnchor=\"middle\" className={ styles.error }>\n\t\t\t\t\t\t{ message }\n\t\t\t\t\t</text>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Map data with index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\t// Configure pie angles based on clockwise direction\n\tconst startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;\n\tconst endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-semi-circle-chart',\n\t\t\t\t\tstyles[ 'pie-semi-circle-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'pie-semi-circle-chart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"pie-chart-container\"\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div role=\"tooltip\">{ renderTooltip( { tooltipData } ) }</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\t// Calculate chart dimensions maintaining the 2:1 width-to-height ratio.\n\t\t\t\t\t// Use measured dimensions to respect height constraints, falling back\n\t\t\t\t\t// to explicit props during initial render before measurement is available.\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : effectiveWidth;\n\t\t\t\t\tconst availableHeight =\n\t\t\t\t\t\tcontentHeight > 0 ? contentHeight : propHeight || effectiveWidth / 2;\n\t\t\t\t\t// Constrain width so that height (= width / 2) never exceeds the available height\n\t\t\t\t\tconst width = Math.min( availableWidth, availableHeight * 2 );\n\t\t\t\t\tconst height = width / 2;\n\t\t\t\t\tconst radius = height; // For a semi-circle, radius equals the SVG height\n\t\t\t\t\tconst innerRadius = radius * ( 1 - thickness );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tdata-testid=\"pie-chart-svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ radius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\tstartAngle=\"-180deg\"\n\t\t\t\t\t\t\t\t\t\twipePercentage={ 50 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t{ /* Main chart group centered horizontally and positioned at bottom */ }\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ height }\n\t\t\t\t\t\t\t\t\tleft={ width / 2 }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ -radius / 2 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Pie chart */ }\n\t\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\t\touterRadius={ radius }\n\t\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ 3 }\n\t\t\t\t\t\t\t\t\t\t\t\tpadAngle={ PAD_ANGLE }\n\t\t\t\t\t\t\t\t\t\t\t\tstartAngle={ startAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tendAngle={ endAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tpieSort={ accessors.sort }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( arc => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ withTooltips ? handleArcMouseMove( arc ) : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ withTooltips ? handleMouseLeave : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td={ pie.path( arc ) || '' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ accessors.fill( arc.data ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"pie-segment\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t</Pie>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Label and note text */ }\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -40 } // Position above the chart with space for note\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.label }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -20 } // Position between label and chart\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.note }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ note }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Render SVG children from composition API */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst PieSemiCircleChartWithProvider: FC< PieSemiCircleChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieSemiCircleChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieSemiCircleChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieSemiCircleChartWithProvider.displayName = 'PieSemiCircleChart';\n\n// Create PieSemiCircleChart with composition API\nconst PieSemiCircleChart = attachSubComponents( PieSemiCircleChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieSemiCircleChartComponent;\n\n// Create responsive PieSemiCircleChart with composition API\nconst PieSemiCircleChartResponsive = attachSubComponents(\n\twithResponsive< PieSemiCircleChartProps >( PieSemiCircleChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieSemiCircleChartResponsiveComponent;\n\nexport {\n\tPieSemiCircleChartResponsive as default,\n\tPieSemiCircleChart as PieSemiCircleChartUnresponsive,\n};\n","import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import clsx from 'clsx';\nimport styles from './trend-indicator.module.scss';\nimport type { TrendIndicatorProps, TrendDirection } from './types';\n\nconst DIRECTION_LABELS: Record< TrendDirection, string > = {\n\tup: 'Increase',\n\tdown: 'Decrease',\n\tneutral: 'No change',\n};\n\nconst Icon = ( { direction }: { direction: TrendDirection } ) => {\n\tif ( direction === 'neutral' ) {\n\t\treturn null;\n\t}\n\n\tconst isUp = direction === 'up';\n\treturn (\n\t\t<svg\n\t\t\tclassName={ styles[ 'trend-indicator__icon' ] }\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\tfill=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path\n\t\t\t\td={ isUp ? 'M8 13V3M4 7l4-4 4 4' : 'M8 3v10M4 9l4 4 4-4' }\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t);\n};\n\n/**\n * TrendIndicator displays a directional trend with a value.\n * Used to show percentage changes or growth metrics.\n *\n * @param {TrendIndicatorProps} props - Component props\n * @return {JSX.Element} The rendered trend indicator\n */\nexport function TrendIndicator( {\n\tdirection,\n\tvalue,\n\tclassName,\n\tstyle,\n\tshowIcon = true,\n}: TrendIndicatorProps ) {\n\tconst ariaLabel = `${ DIRECTION_LABELS[ direction ] }: ${ value }`;\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'trend-indicator' ],\n\t\t\t\tstyles[ `trend-indicator--${ direction }` ],\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t\taria-label={ ariaLabel }\n\t\t>\n\t\t\t{ showIcon && <Icon direction={ direction } /> }\n\t\t\t<span className={ styles[ 'trend-indicator__value' ] }>{ value }</span>\n\t\t</span>\n\t);\n}\n"],"x_google_ignoreList":[18,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,uBAAuB,cAAmD,IAAK;AAG5F,MAAa,qBAAqB;;;ACnBlC,MAAa,gCAA2D;CACv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;;;;AAYjC,MAAM,wBAAwB;AAE9B,sBAAsB,cAAc;;;;AAKpC,MAAM,YAAY,eAAkC,qBAAsB;;;;;;;;;;;;;ACnM1E,MAAM,mBAAqD;CAC1D,IAAI;CACJ,MAAM;CACN,SAAS;AACV;AAEA,MAAMC,UAAS,EAAE,gBAAgD;CAChE,IAAK,cAAc,WAClB,OAAO;CAGR,MAAM,OAAO,cAAc;CAC3B,OACC,oBAAC,OAAD;EACC,WAAYC,+BAAQ;EACpB,SAAQ;EACR,MAAK;EACL,eAAY;YAEZ,oBAAC,QAAD;GACC,GAAI,OAAO,wBAAwB;GACnC,QAAO;GACP,aAAY;GACZ,eAAc;GACd,gBAAe;EACf,CAAA;CACG,CAAA;AAEP;;;;;;;;AASA,SAAgB,eAAgB,EAC/B,WACA,OACA,WACA,OACA,WAAW,QACa;CACxB,MAAM,YAAY,GAAI,iBAAkB,WAAa,IAAK;CAE1D,OACC,qBAAC,QAAD;EACC,WAAY,KACXA,+BAAQ,oBACRA,+BAAQ,oBAAqB,cAC7B,SACD;EACQ;EACR,cAAa;YAPd,CASG,YAAY,oBAACD,QAAD,EAAkB,UAAa,CAAA,GAC7C,oBAAC,QAAD;GAAM,WAAYC,+BAAQ;aAA+B;EAAa,CAAA,CACjE;;AAER"}
1
+ {"version":3,"file":"index.js","names":["d3Color","d3Hsl","color","d3Hsl","d3Hsl","_formatErrorMessage","STYLE_HASH_ATTRIBUTE","getRuntime","documentContainsStyleHash","injectStyle","registerDocument","registerStyle","style_default","forwardRef","Text","forwardRef","styles","styles","styles","formatDateTick","toNumber","validateData","getScaleBandwidth","BarChartUnresponsive","Text","styles","replace","kebabCase","memoize","forwardRef","warn","useRef","createContext","useContext","useRef","warn","useMemo","isDevelopment","parse","getRegisteredStyles","isDevelopment","unitless","asTemplateStringsArr","templateStringsArr","hashString","isDevelopment","Insertion","getRegisteredStyles","jsx","Emotion","css","merge","getRegisteredStyles","useEmotionCache","useCallback","innerCx","warn","getRegisteredStyles","forwardRef","component_default","useState","useMemo","css","CONFIG","View","Grid","validateData","styles","getStringWidth","Icon","styles"],"sources":["../src/charts/private/single-chart-context/single-chart-context.tsx","../src/charts/private/single-chart-context/use-single-chart-context.ts","../src/utils/create-composition.ts","../src/utils/date-parsing.ts","../src/utils/format-metric-value.ts","../src/utils/format-percentage.ts","../src/utils/get-longest-tick-width.ts","../src/utils/get-styles.ts","../src/utils/is-safari.ts","../src/utils/merge-themes.ts","../src/utils/color-utils.ts","../src/utils/resolve-css-var.ts","../src/utils/resolve-font-size.ts","../src/providers/chart-context/private/get-chart-color.ts","../src/providers/chart-context/themes.ts","../src/providers/chart-context/global-charts-provider.tsx","../src/providers/chart-context/hooks/use-global-charts-context.ts","../src/providers/chart-context/hooks/use-chart-id.ts","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/hooks/use-deep-memo.ts","../src/hooks/use-xychart-theme.ts","../src/hooks/use-chart-data-transform.ts","../src/hooks/use-chart-margin.tsx","../src/hooks/use-element-size.ts","../src/hooks/use-text-truncation.ts","../src/hooks/use-zero-value-display.ts","../src/hooks/use-data-with-percentages.ts","../src/hooks/use-interactive-legend-data.ts","../src/hooks/use-prefers-reduced-motion.ts","../src/providers/chart-context/hooks/use-chart-registration.ts","../src/providers/chart-context/hooks/use-global-charts-theme.ts","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/mergeObjects.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/formatErrorMessage.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useRefWithInit.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useMergedRefs.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/reactVersion.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/warn.js","../../../../node_modules/.pnpm/@base-ui+utils@0.2.9_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/empty.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/internals/useRenderElement.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js","../../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/stack/stack.mjs","../../../../node_modules/.pnpm/@wordpress+ui@0.13.0_@types+react@18.3.28_date-fns@4.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/ui/build-module/text/text.mjs","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/legend.tsx","../src/components/legend/hooks/use-chart-legend-items.ts","../src/components/tooltip/base-tooltip.tsx","../src/components/tooltip/accessible-tooltip.tsx","../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts","../src/charts/private/chart-layout/chart-layout.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/private/center/center.tsx","../src/charts/private/svg-empty-state/svg-empty-state.tsx","../src/charts/private/time-axis.ts","../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/x-zoom.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx","../src/charts/line-chart/line-chart.tsx","../src/charts/area-chart/private/validate-data.ts","../src/charts/area-chart/private/overlays.tsx","../src/charts/area-chart/area-chart.tsx","../src/charts/bar-chart/private/truncated-tick-component.tsx","../src/charts/bar-chart/private/use-bar-chart-options.ts","../src/charts/bar-chart/private/comparison-bars-geometry.ts","../src/charts/bar-chart/private/comparison-constants.ts","../src/charts/bar-chart/private/comparison-bars.tsx","../src/charts/bar-chart/bar-chart.tsx","../src/charts/bar-list-chart/bar-list-chart.tsx","../src/charts/conversion-funnel-chart/private/use-funnel-selection.ts","../src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx","../src/utils/sanitize-html.ts","../src/charts/geo-chart/geo-chart.tsx","../src/charts/heatmap-chart/private/use-heatmap-colors.ts","../src/charts/heatmap-chart/private/build-calendar-data.ts","../src/charts/heatmap-chart/private/heatmap-legend.tsx","../src/charts/heatmap-chart/heatmap-chart.tsx","../../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/utils.mjs","../../../../node_modules/.pnpm/@wordpress+warning@3.50.0/node_modules/@wordpress/warning/build-module/index.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs","../../../../node_modules/.pnpm/lower-case@2.0.2/node_modules/lower-case/dist.es2015/index.js","../../../../node_modules/.pnpm/no-case@3.0.4/node_modules/no-case/dist.es2015/index.js","../../../../node_modules/.pnpm/dot-case@3.0.4/node_modules/dot-case/dist.es2015/index.js","../../../../node_modules/.pnpm/param-case@3.0.4/node_modules/param-case/dist.es2015/index.js","../../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs","../../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js","../../../../node_modules/.pnpm/is-plain-object@5.0.0/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs","../../../../node_modules/.pnpm/@emotion+sheet@1.4.0/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js","../../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js","../../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js","../../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../../../node_modules/.pnpm/@emotion+use-insertion-effect-with-fallbacks@1.2.0_react@18.3.1/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js","../../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1/node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js","../../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs","../../../../node_modules/.pnpm/@emotion+is-prop-valid@1.4.0/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js","../../../../node_modules/.pnpm/@emotion+styled@11.14.1_@emotion+react@11.14.0_@types+react@18.3.28_react@18.3.1__@types+react@18.3.28_react@18.3.1/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs","../../../../node_modules/.pnpm/@wordpress+components@36.1.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs","../src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.ts","../src/charts/leaderboard-chart/leaderboard-chart.tsx","../src/charts/private/radial-wipe-animation/radial-wipe-animation.tsx","../src/charts/pie-chart/pie-chart.tsx","../src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx","../src/charts/sparkline/sparkline.tsx","../src/components/trend-indicator/trend-indicator.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface ChartInstanceRef {\n\tgetScales: () => { xScale: unknown; yScale: unknown } | null;\n\tgetChartDimensions: () => {\n\t\twidth: number;\n\t\theight: number;\n\t\tmargin: { top?: number; right?: number; bottom?: number; left?: number };\n\t};\n}\n\n// Local context for chart implicit state sharing\nexport interface ChartInstanceContextValue {\n\tchartId: string;\n\tchartRef?: React.RefObject< ChartInstanceRef >;\n\tchartWidth?: number;\n\tchartHeight?: number;\n}\n\nexport const ChartInstanceContext = createContext< ChartInstanceContextValue | null >( null );\n\n// Backward compatibility exports\nexport const SingleChartContext = ChartInstanceContext;\nexport type SingleChartContextValue = ChartInstanceContextValue;\nexport type SingleChartRef = ChartInstanceRef;\n","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './single-chart-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n\nexport const useSingleChartContext = useChartInstanceContext;\n","/**\n * Utility function to create chart components with composition API.\n *\n * This function attaches subcomponents to a chart component to enable\n * dot notation access like <Chart.Legend />, <Chart.Tooltip />, etc.\n *\n * @param Chart - The main chart component\n * @param subComponents - Object containing subcomponents to attach\n * @return Chart component with attached subcomponents\n */\nexport function attachSubComponents< TChart, TSubComponents extends Record< string, unknown > >(\n\tChart: TChart,\n\tsubComponents: TSubComponents\n): TChart & TSubComponents {\n\treturn Object.assign( Chart, subComponents );\n}\n","/**\n * @file Date parsing utilities using date-fns for local timezone handling\n *\n * This module provides utilities for parsing various date string formats and converting\n * them to local timezone dates using the battle-tested date-fns library. For formats\n * without timezone info, they're treated as local. For formats with timezone info,\n * they're converted to the equivalent local time.\n *\n * Note: And specifically it prevents format `YYYY-MM-DD` being parsed as UTC date.\n *\n * Key Features:\n * - All parsed dates are in local timezone\n * - Converts timezone-aware strings to local equivalent\n * - Robust input validation and error handling using date-fns\n * - TypeScript type safety\n * - Much smaller codebase than custom parsing\n *\n * Supported Formats:\n * - YYYY-MM-DD (treated as local)\n * - YYYY-MM-DD HH:mm:ss (treated as local)\n * - YYYY-MM-DD HH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ss (treated as local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (treated as local)\n * - YYYY-MM-DDTHH:mm (treated as local)\n * - YYYY-MM-DDTHH:mm:ssZ (converted to local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (converted to local)\n *\n * @example\n * ```typescript\n * parseAsLocalDate(\"2025-01-01\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30:00\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01 14:30\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:45.123\"); // Local timezone\n * parseAsLocalDate(\"2025-01-01T14:30:00Z\"); // UTC 14:30 → Local equivalent\n * parseAsLocalDate(\"2025-01-01T14:30:00+05:00\"); // +05:00 14:30 → Local equivalent\n * ```\n */\n\nimport { parse, parseISO, isValid } from 'date-fns';\n\n/**\n * Checks if a date string contains timezone information\n * @param {string} dateString - The date string to check for timezone information\n * @return {boolean} True if the date string contains timezone information, false otherwise\n */\nconst hasTimezone = ( dateString: string ): boolean => {\n\tconst tIndex = dateString.indexOf( 'T' );\n\tif ( tIndex === -1 ) {\n\t\treturn false;\n\t}\n\n\tif ( dateString.endsWith( 'Z' ) ) {\n\t\treturn true;\n\t}\n\n\treturn /[+-]\\d{2}:?\\d{2}$/.test( dateString.slice( tIndex + 1 ) );\n};\n\n/**\n * Parses any supported date string format and returns a local timezone date\n *\n * Uses date-fns for robust parsing and validation. For strings without timezone\n * info, treats as local timezone. For strings with timezone info, converts to\n * local timezone equivalent.\n *\n * Supports:\n * - YYYY-MM-DD (local)\n * - YYYY-MM-DD HH:mm:ss (local)\n * - YYYY-MM-DD HH:mm (local)\n * - YYYY-MM-DDTHH:mm:ss (local)\n * - YYYY-MM-DDTHH:mm:ss.SSS (local)\n * - YYYY-MM-DDTHH:mm (local)\n * - YYYY-MM-DDTHH:mm:ssZ (UTC → local)\n * - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)\n * @param {string} dateString - The date string to parse into a local timezone date\n * @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails\n */\nexport const parseAsLocalDate = ( dateString: string ): Date => {\n\tconst trimmedString = dateString.trim();\n\n\t// If it has timezone information, parse as ISO and convert to local\n\tif ( hasTimezone( trimmedString ) ) {\n\t\tconst isoDate = parseISO( trimmedString );\n\n\t\tif ( ! isValid( isoDate ) ) {\n\t\t\treturn new Date( NaN );\n\t\t}\n\n\t\t// parseISO automatically converts to local timezone\n\t\treturn isoDate;\n\t}\n\n\t// For naive strings, try different local formats\n\tconst formats = [\n\t\t'yyyy-MM-dd', // 2025-01-01\n\t\t'yyyy-MM-dd HH:mm:ss', // 2025-01-01 14:30:45\n\t\t'yyyy-MM-dd HH:mm', // 2025-01-01 14:30\n\t\t\"yyyy-MM-dd'T'HH:mm:ss\", // 2025-01-01T14:30:45\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSS\", // 2025-01-01T14:30:45.123\n\t\t\"yyyy-MM-dd'T'HH:mm\", // 2025-01-01T14:30\n\t];\n\n\tfor ( const format of formats ) {\n\t\tconst result = parse( trimmedString, format, new Date() );\n\t\tif ( isValid( result ) ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\t// If no format matched, return invalid date\n\treturn new Date( NaN );\n};\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\n\n/**\n * Types for formatMetricValue\n */\nexport type MetricValueType = 'number' | 'average' | 'currency';\n\ntype FormatMetricValueOptions = {\n\tdecimals?: number;\n\tuseMultipliers?: boolean;\n\tsignDisplay?: Intl.NumberFormatOptions[ 'signDisplay' ];\n};\n\n/**\n * Format a numeric metric value based on type, precision and scale.\n * Supports currency, number and percentage, using `@automattic/number-formatters`.\n *\n * @param value - The value to format\n * @param type - The type of formatting to apply\n * @param options - Formatting options\n * @param options.decimals - Number of decimal places to show\n * @param options.useMultipliers - Whether to use K, M, B suffixes for large numbers\n * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)\n * @return Formatted string\n */\nexport const formatMetricValue = (\n\tvalue: string | number,\n\ttype: MetricValueType = 'number',\n\t{ decimals, useMultipliers = false, signDisplay }: FormatMetricValueOptions = {}\n): string => {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\n\tconst numericValue = Number( value );\n\tif ( isNaN( numericValue ) ) {\n\t\treturn '';\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'currency': {\n\t\t\t// Basic currency formatting - can be enhanced with full currency support\n\t\t\tconst formatted = useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 2,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 2,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t\treturn `$${ formatted }`;\n\t\t}\n\n\t\tcase 'average': {\n\t\t\tif ( ! Number.isFinite( numericValue ) ) {\n\t\t\t\treturn '—';\n\t\t\t}\n\n\t\t\treturn formatNumber( numericValue, {\n\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\tstyle: 'percent',\n\t\t\t\t\tsignDisplay: signDisplay ?? 'exceptZero',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcase 'number':\n\t\tdefault: {\n\t\t\treturn useMultipliers\n\t\t\t\t? formatNumberCompact( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tmaximumFractionDigits: decimals ?? 0,\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } )\n\t\t\t\t: formatNumber( numericValue, {\n\t\t\t\t\t\tdecimals: decimals ?? 0,\n\t\t\t\t\t\tnumberFormatOptions: {\n\t\t\t\t\t\t\tsignDisplay,\n\t\t\t\t\t\t},\n\t\t\t\t } );\n\t\t}\n\t}\n};\n","import { formatNumber } from '@automattic/number-formatters';\n\n/**\n * Format a percentage value with smart decimal handling.\n * Uses `@automattic/number-formatters` for consistent formatting.\n * Removes unnecessary trailing zeros and caps at 2 decimal places.\n *\n * @param value - The percentage value (0-100 range)\n * @return Formatted percentage string (e.g., \"30%\", \"30.1%\", \"30.25%\")\n */\nexport const formatPercentage = ( value: number ): string => {\n\t// Use formatNumber with percentage style, but convert from 0-100 range to 0-1 range\n\treturn formatNumber( value / 100, {\n\t\tnumberFormatOptions: {\n\t\t\tstyle: 'percent',\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t},\n\t} );\n};\n","import { getStringWidth } from '@visx/text';\nimport type { TickFormatter } from '@visx/axis';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns the width of the longest tick.\n *\n * @param ticks - Ticks to get the width of.\n * @param formatTick - Function to format the tick.\n * @param {object} labelStyle - Style object for the label.\n * @return {number} - Width of the longest tick.\n */\nexport const getLongestTickWidth = < T extends AnyD3Scale >(\n\tticks: ScaleInput< T >[],\n\tformatTick: TickFormatter< ScaleInput< T > >,\n\tlabelStyle?: object\n) => {\n\tconst formattedTicks = ticks.map( tick => formatTick( tick, 0, [] ) );\n\tconst longestTick = formattedTicks.reduce(\n\t\t( longest, current ) => ( longest.length >= current.length ? longest : current ),\n\t\tformattedTicks[ 0 ]\n\t);\n\n\treturn getStringWidth( longestTick, labelStyle );\n};\n","import type { BarStyles, ChartTheme, LegendShape, SeriesData } from '../types';\nimport type { LineStyles } from '@visx/xychart';\n\n/**\n * Utility function to get consolidated line styles for a series\n * This consolidates the logic used by both LineChart and Legend components\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {LineStyles} The consolidated line styles for the series\n */\nexport function getSeriesLineStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): LineStyles {\n\t// Get theme-based line styles for line type\n\tconst themeSemanticLineStyle = providerTheme?.lineChart?.lineStyles?.[ seriesData.options?.type ];\n\n\t// Get theme-based line styles for index of series data\n\tconst themeSeriesLineStyle =\n\t\tproviderTheme?.seriesLineStyles?.[ index % providerTheme.seriesLineStyles.length ];\n\n\t// Priority order: custom series style > theme line type style > default theme series style\n\treturn (\n\t\tseriesData.options?.seriesLineStyle ?? themeSemanticLineStyle ?? themeSeriesLineStyle ?? {}\n\t);\n}\n\n/**\n * Utility to get consolidated bar styles for a series by semantic type.\n * Mirrors getSeriesLineStyles: a series with `options.type` (e.g. 'comparison')\n * resolves to `theme.barChart.barStyles[ type ]`.\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} providerTheme - The chart theme configuration\n * @return {BarStyles} The consolidated bar styles for the series\n */\nexport function getSeriesBarStyles(\n\tseriesData: SeriesData,\n\tindex: number,\n\tproviderTheme: ChartTheme\n): BarStyles {\n\tconst type = seriesData.options?.type;\n\treturn ( type && providerTheme?.barChart?.barStyles?.[ type ] ) ?? {};\n}\n\n/**\n * Utility function to get stroke color for a series\n *\n * @param {SeriesData} seriesData - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {string[]} themeColors - Array of theme colors\n * @return {string} The stroke color for the series\n */\nexport function getSeriesStroke(\n\tseriesData: SeriesData,\n\tindex: number,\n\tthemeColors: string[]\n): string {\n\treturn seriesData.options?.stroke ?? themeColors[ index % themeColors.length ];\n}\n\n/**\n * Utility function to get shape styles for a legend item\n *\n * @param {SeriesData} series - The series data containing styling options\n * @param {number} index - The index of the series in the data array\n * @param {ChartTheme} theme - The chart theme configuration\n * @param {LegendShape} legendShape - The shape to use for the item (optional)\n * @return {Record< string, unknown >} The shape styles for the item\n */\nexport function getItemShapeStyles(\n\tseries: SeriesData,\n\tindex: number,\n\ttheme: ChartTheme,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): Record< string, unknown > {\n\tconst seriesShapeStyles = series.options?.legendShapeStyle ?? {};\n\tconst lineStyles = legendShape === 'line' ? getSeriesLineStyles( series, index, theme ) : {};\n\t// For non-line legends (e.g. bar 'rect'), reflect the comparison bar's opacity on the\n\t// swatch so the legend marker matches the translucent comparison bar. Line-type legends\n\t// convey comparison via the dashed stroke (lineStyles) instead.\n\tconst barOpacity =\n\t\tlegendShape !== 'line' ? getSeriesBarStyles( series, index, theme ).opacity : undefined;\n\tconst barShapeStyles = barOpacity !== undefined ? { opacity: barOpacity } : {};\n\tconst themeShapeStyles = theme.legend?.shapeStyles?.[ index ];\n\n\t// Series-level styles (custom shape style + line styles) take precedence; otherwise fall\n\t// back to the per-index theme shape styles.\n\tconst explicitStyles = {\n\t\t...seriesShapeStyles,\n\t\t...lineStyles,\n\t};\n\tconst hasExplicitStyles = Object.values( explicitStyles ).some(\n\t\tvalue => value !== undefined && value !== null && value !== ''\n\t);\n\tconst baseShapeStyles = hasExplicitStyles ? explicitStyles : themeShapeStyles ?? {};\n\n\t// Layer the comparison bar opacity on top so the swatch matches the translucent bar\n\t// without discarding the base (custom or theme) shape styles.\n\treturn { ...baseShapeStyles, ...barShapeStyles };\n}\n","export const isSafari = () => {\n\tif ( typeof navigator !== 'undefined' && navigator.userAgent ) {\n\t\treturn /^((?!chrome|android).)*safari/i.test( navigator.userAgent );\n\t}\n\treturn false;\n};\n","import deepmerge from 'deepmerge';\nimport type { ChartTheme, CompleteChartTheme } from '../types';\n\n/**\n * Merges chart themes with proper precedence.\n * The second theme (override) takes precedence over the first theme (base).\n *\n * @param baseTheme - Base theme object\n * @param overrideTheme - Theme to override base with (takes precedence)\n * @return Merged theme with overrideTheme values taking precedence\n */\nexport function mergeThemes(\n\tbaseTheme: CompleteChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): CompleteChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme;\nexport function mergeThemes(\n\tbaseTheme: ChartTheme,\n\toverrideTheme: Partial< ChartTheme >\n): ChartTheme {\n\t// Use deepmerge to properly merge nested objects, with overrideTheme taking precedence\n\treturn deepmerge( baseTheme, overrideTheme, {\n\t\t// Ensure arrays are replaced rather than concatenated\n\t\tarrayMerge: ( _destinationArray, sourceArray ) => sourceArray,\n\t} ) as ChartTheme;\n}\n","import { color as d3Color, hsl as d3Hsl } from '@visx/vendor/d3-color';\n\n/**\n * Check if a value is a valid 6-digit hex color\n * @param hex - The value to check\n * @return true if valid hex color format (e.g., '#ff0000')\n */\nexport const isValidHexColor = ( hex: unknown ): hex is string => {\n\treturn typeof hex === 'string' && /^#[0-9a-fA-F]{6}$/.test( hex );\n};\n\n/**\n * Validate hex color format, throwing descriptive errors if invalid\n * @param hex - The hex color string to validate\n * @throws {Error} if hex string is malformed\n */\nexport const validateHexColor = ( hex: unknown ): void => {\n\tif ( isValidHexColor( hex ) ) {\n\t\treturn;\n\t}\n\n\t// Provide specific error messages for common issues\n\tif ( typeof hex !== 'string' ) {\n\t\tthrow new Error( 'Hex color must be a string' );\n\t}\n\tif ( ! hex.startsWith( '#' ) ) {\n\t\tthrow new Error( 'Hex color must start with #' );\n\t}\n\tif ( hex.length !== 7 ) {\n\t\tthrow new Error( 'Hex color must be 7 characters long (e.g., #ff0000)' );\n\t}\n\tthrow new Error( 'Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed' );\n};\n\n/**\n * Convert hex color to rgba with specified opacity.\n * This is genuinely reusable across chart components.\n * @param hex - The hex color string (e.g., '#ff0000')\n * @param alpha - The opacity value. Values outside the [0, 1] range will be clamped by the underlying d3 color library.\n * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)')\n * @throws {Error} if hex string is malformed or alpha is not a valid number\n */\nexport const hexToRgba = ( hex: string, alpha: number ): string => {\n\tvalidateHexColor( hex );\n\n\tif ( typeof alpha !== 'number' || isNaN( alpha ) ) {\n\t\tthrow new Error( 'Alpha must be a number' );\n\t}\n\n\t// Safe to use non-null assertion since validateHexColor ensures valid hex\n\treturn d3Color( hex )!.copy( { opacity: alpha } ).formatRgb();\n};\n\n/**\n * Calculate the perceptual distance between two HSL colors\n * @param hsl1 - first color in HSL format [h, s, l]\n * @param hsl2 - second color in HSL format [h, s, l]\n * @return distance value (0-100+, lower means more similar)\n */\nexport const getColorDistance = (\n\thsl1: [ number, number, number ],\n\thsl2: [ number, number, number ]\n): number => {\n\tconst [ h1, s1, l1 ] = hsl1;\n\tconst [ h2, s2, l2 ] = hsl2;\n\n\t// Calculate hue difference, accounting for circular nature (0° = 360°)\n\tlet hueDiff = Math.abs( h1 - h2 );\n\thueDiff = Math.min( hueDiff, 360 - hueDiff );\n\n\t// Weight the differences: hue is most important, then lightness, then saturation\n\tconst hueWeight = 2;\n\tconst lightnessWeight = 1;\n\tconst saturationWeight = 0.5;\n\n\treturn Math.sqrt(\n\t\tMath.pow( hueDiff * hueWeight, 2 ) +\n\t\t\tMath.pow( ( l1 - l2 ) * lightnessWeight, 2 ) +\n\t\t\tMath.pow( ( s1 - s2 ) * saturationWeight, 2 )\n\t);\n};\n\n/**\n * Parse an HSL string like 'hsl(120, 50%, 50%)' into an HSL tuple.\n *\n * @param hslString - HSL color string\n * @return HSL tuple [h, s, l] or null if invalid\n */\nexport const parseHslString = ( hslString: string ): [ number, number, number ] | null => {\n\tconst lower = hslString.toLowerCase().trim();\n\n\t// Check prefix - d3-color handles the parsing\n\tif ( ! lower.startsWith( 'hsl(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Hsl( lower );\n\n\t// d3Hsl returns NaN values for invalid colors\n\tif ( isNaN( parsed.h ) && isNaN( parsed.s ) && isNaN( parsed.l ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize hue to 0-360 range (d3 may return NaN for achromatic colors)\n\tconst h = isNaN( parsed.h ) ? 0 : ( ( parsed.h % 360 ) + 360 ) % 360;\n\n\t// d3-color uses 0-1 scale, convert to 0-100\n\treturn [ h, parsed.s * 100, parsed.l * 100 ];\n};\n\n/**\n * Parse an RGB string like 'rgb(255, 0, 0)' into a hex color.\n *\n * @deprecated Use normalizeColorToHex() instead, which handles all color formats including rgb() and rgba().\n * @param rgbString - RGB color string (not RGBA)\n * @return hex color string or null if invalid\n */\nexport const parseRgbString = ( rgbString: string ): string | null => {\n\tconst lower = rgbString.toLowerCase().trim();\n\n\t// Check prefix - only handle rgb(), not rgba()\n\t// This is intentional - use normalizeColorToHex for rgba() support\n\tif ( ! lower.startsWith( 'rgb(' ) || lower.startsWith( 'rgba(' ) ) {\n\t\treturn null;\n\t}\n\n\tconst parsed = d3Color( lower );\n\n\t// d3Color returns null for invalid colors\n\tif ( ! parsed ) {\n\t\treturn null;\n\t}\n\n\t// d3-color clamps values automatically\n\treturn parsed.formatHex();\n};\n\n/**\n * Normalize any CSS color value to a hex color string.\n * Handles hex, HSL, HSLA, RGB, RGBA, named CSS colors, and CSS variables.\n *\n * @param color - Any CSS color value\n * @param element - Optional DOM element for resolving CSS variables\n * @param resolveCss - Function to resolve CSS variables (injected for testability)\n * @param _depth - Internal recursion depth counter to prevent infinite loops\n * @return hex color string, or the original value if conversion fails\n */\nexport const normalizeColorToHex = (\n\tcolor: string,\n\telement?: HTMLElement | null,\n\tresolveCss?: ( value: string, el?: HTMLElement | null ) => string | null,\n\t_depth = 0\n): string => {\n\tif ( ! color || typeof color !== 'string' ) {\n\t\treturn '';\n\t}\n\n\t// Already a valid hex color (6-digit format)\n\tif ( /^#[0-9a-fA-F]{6}$/.test( color ) ) {\n\t\treturn color;\n\t}\n\n\tconst trimmed = color.trim().toLowerCase();\n\n\t// Handle 3-digit hex colors - expand to 6-digit\n\tif ( /^#[0-9a-f]{3}$/i.test( trimmed ) ) {\n\t\tconst r = trimmed[ 1 ];\n\t\tconst g = trimmed[ 2 ];\n\t\tconst b = trimmed[ 3 ];\n\t\treturn `#${ r }${ r }${ g }${ g }${ b }${ b }`;\n\t}\n\n\t// Handle CSS variables - must be resolved before d3-color can parse\n\tif ( trimmed.startsWith( '--' ) || trimmed.startsWith( 'var(' ) ) {\n\t\tif ( resolveCss ) {\n\t\t\tconst resolved = resolveCss( color, element );\n\t\t\tif ( resolved && resolved !== color && _depth < 10 ) {\n\t\t\t\t// Recursively normalize the resolved value\n\t\t\t\treturn normalizeColorToHex( resolved, element, resolveCss, _depth + 1 );\n\t\t\t}\n\t\t}\n\t\t// Can't resolve CSS variable, return original\n\t\treturn color;\n\t}\n\n\t// Handle HSL, HSLA, RGB, and RGBA strings using d3-color\n\tif (\n\t\ttrimmed.startsWith( 'hsl(' ) ||\n\t\ttrimmed.startsWith( 'hsla(' ) ||\n\t\ttrimmed.startsWith( 'rgb(' ) ||\n\t\ttrimmed.startsWith( 'rgba(' )\n\t) {\n\t\tconst parsed = d3Color( trimmed );\n\t\tif ( parsed ) {\n\t\t\treturn parsed.formatHex();\n\t\t}\n\t\treturn color;\n\t}\n\n\t// Attempt d3-color for any remaining format (e.g. named CSS colors like \"steelblue\")\n\tconst parsed = d3Color( trimmed );\n\tif ( parsed ) {\n\t\treturn parsed.formatHex();\n\t}\n\n\t// Unknown format, return as-is\n\treturn color;\n};\n\n/**\n * Lighten a hex color by blending it with white.\n * Useful for creating color gradients or lighter variants.\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @param blend - Blend amount with white (0 = original color, 1 = white)\n * @return Lightened hex color string (e.g., '#cce4ef')\n * @throws {Error} if hex string is malformed\n */\nexport const lightenHexColor = ( hex: string, blend: number ): string => {\n\tvalidateHexColor( hex );\n\n\tconst r = parseInt( hex.slice( 1, 3 ), 16 );\n\tconst g = parseInt( hex.slice( 3, 5 ), 16 );\n\tconst b = parseInt( hex.slice( 5, 7 ), 16 );\n\n\t// Blend with white (255, 255, 255)\n\tconst newR = Math.round( r + ( 255 - r ) * blend );\n\tconst newG = Math.round( g + ( 255 - g ) * blend );\n\tconst newB = Math.round( b + ( 255 - b ) * blend );\n\n\treturn `#${ newR.toString( 16 ).padStart( 2, '0' ) }${ newG\n\t\t.toString( 16 )\n\t\t.padStart( 2, '0' ) }${ newB.toString( 16 ).padStart( 2, '0' ) }`;\n};\n\n/**\n * WCAG relative luminance of a hex color (0 = black, 1 = white).\n *\n * @param hex - Hex color string (e.g., '#98C8DF')\n * @return Relative luminance in the range [0, 1]\n * @throws {Error} if hex string is malformed\n */\nexport const relativeLuminance = ( hex: string ): number => {\n\tvalidateHexColor( hex );\n\n\tconst toLinear = ( value: number ): number => {\n\t\tconst channel = value / 255;\n\t\treturn channel <= 0.03928 ? channel / 12.92 : Math.pow( ( channel + 0.055 ) / 1.055, 2.4 );\n\t};\n\n\tconst r = toLinear( parseInt( hex.slice( 1, 3 ), 16 ) );\n\tconst g = toLinear( parseInt( hex.slice( 3, 5 ), 16 ) );\n\tconst b = toLinear( parseInt( hex.slice( 5, 7 ), 16 ) );\n\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/**\n * Whether light text reads better than dark text on the given background, using the W3C\n * luminance threshold (0.179) that maximizes contrast against black vs white.\n *\n * @param backgroundHex - Hex background color\n * @return true if light text should be used; false (dark text) for malformed colors\n */\nexport const prefersLightText = ( backgroundHex: string ): boolean => {\n\tif ( ! isValidHexColor( backgroundHex ) ) {\n\t\treturn false;\n\t}\n\treturn relativeLuminance( backgroundHex ) <= 0.179;\n};\n","/**\n * Pattern for valid CSS custom property names (e.g., '--my-color', '--jp-gray-10')\n */\nconst CSS_VAR_NAME_PATTERN = /^--[\\w-]+$/;\n\n/**\n * Resolves a CSS custom property (variable) to its computed value.\n * Handles multiple formats:\n * - Plain variable names: '--my-color'\n * - CSS var() syntax: 'var(--my-color)'\n * - CSS var() with fallback: 'var(--my-color, #ffffff)'\n * - Regular values (returned as-is): '#ffffff', 'red'\n *\n * @param value - A CSS variable name, var() expression, or regular value\n * @param element - Optional DOM element to resolve the variable from (defaults to document.documentElement)\n * @return The resolved value, fallback value, or null if unresolvable\n */\nexport const resolveCssVariable = (\n\tvalue: string,\n\telement?: HTMLElement | null\n): string | null => {\n\tif ( ! value ) {\n\t\treturn null;\n\t}\n\n\t// Check if it's a var() expression: var(--name) or var(--name, fallback)\n\t// Parse manually to avoid regex backtracking vulnerabilities\n\tif ( value.startsWith( 'var(' ) && value.endsWith( ')' ) ) {\n\t\tconst parsed = parseVarExpression( value );\n\n\t\tif ( parsed ) {\n\t\t\tconst resolved = resolveVariableName( parsed.varName, element );\n\n\t\t\treturn resolved || parsed.fallback;\n\t\t}\n\t}\n\n\t// Check if it's a plain variable name (starts with --)\n\tif ( value.startsWith( '--' ) ) {\n\t\treturn resolveVariableName( value, element );\n\t}\n\n\t// Return regular values as-is (e.g., '#ffffff', 'red')\n\treturn value;\n};\n\n/**\n * Parses a var() expression into its variable name and optional fallback.\n * Uses string manipulation instead of complex regex to avoid ReDoS.\n *\n * @param expr - A var() expression like 'var(--name)' or 'var(--name, fallback)'\n * @return Parsed result or null if invalid\n */\nfunction parseVarExpression( expr: string ): { varName: string; fallback: string | null } | null {\n\t// Remove 'var(' prefix and ')' suffix\n\tconst inner = expr.slice( 4, -1 ).trim();\n\n\tif ( ! inner.startsWith( '--' ) ) {\n\t\treturn null;\n\t}\n\n\t// Find the comma separator (if any)\n\tconst commaIndex = inner.indexOf( ',' );\n\n\tif ( commaIndex === -1 ) {\n\t\t// No fallback: var(--name)\n\t\tconst varName = inner.trim();\n\t\t// Validate variable name format\n\t\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn { varName, fallback: null };\n\t}\n\n\t// Has fallback: var(--name, fallback)\n\tconst varName = inner.slice( 0, commaIndex ).trim();\n\n\t// Validate variable name format\n\tif ( ! CSS_VAR_NAME_PATTERN.test( varName ) ) {\n\t\treturn null;\n\t}\n\n\tconst fallback = inner.slice( commaIndex + 1 ).trim();\n\n\treturn { varName, fallback: fallback || null };\n}\n\n/**\n * Resolves a plain CSS variable name to its computed value.\n *\n * @param varName - A CSS variable name like '--my-color'\n * @param element - Optional DOM element to resolve from\n * @return The computed value or null\n */\nfunction resolveVariableName( varName: string, element?: HTMLElement | null ): string | null {\n\tif ( typeof window === 'undefined' || typeof document === 'undefined' ) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst targetElement = element || document.documentElement;\n\t\tconst computedValue = getComputedStyle( targetElement ).getPropertyValue( varName ).trim();\n\n\t\treturn computedValue || null;\n\t} catch {\n\t\t// Return null if getComputedStyle throws (e.g., detached element)\n\t\treturn null;\n\t}\n}\n","/**\n * Resolve a theme `fontSize` value into a plain number suitable for\n * canvas-based measurement (e.g. `getStringWidth`).\n *\n * Accepts:\n * - A number — returned as-is\n * - A pixel string like `\"12px\"` — parsed and returned as a number\n *\n * Returns `undefined` for any other input (missing value, NaN, or\n * relative units like `rem`/`em`/`%`/`vh`) so callers can fall back to\n * their own default. Relative units are intentionally rejected because\n * we cannot resolve them to absolute pixels here without a parent\n * computed style, and silently returning the unitless prefix\n * (`parseFloat(\"0.875rem\") === 0.875`) would produce nearly-zero\n * widths in measurement code.\n * @param val - Raw font size value from a theme, axis style, or props\n * @return Parsed numeric font size in pixels, or `undefined` when unresolvable\n */\nexport const resolveFontSize = ( val?: number | string ): number | undefined => {\n\tif ( typeof val === 'number' ) {\n\t\treturn isNaN( val ) ? undefined : val;\n\t}\n\n\tif ( typeof val === 'string' ) {\n\t\t// Only accept plain numeric strings or pixel values.\n\t\t// Reject rem, em, %, vh, vw, etc. — they cannot be resolved to\n\t\t// absolute pixels without a computed style context.\n\t\tconst match = val.trim().match( /^(-?\\d+\\.?\\d*|-?\\.\\d+)(px)?$/ );\n\t\tif ( ! match ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst parsed = parseFloat( match[ 1 ] );\n\t\treturn isNaN( parsed ) ? undefined : parsed;\n\t}\n\n\treturn undefined;\n};\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport { getColorDistance } from '../../../utils';\n\nexport interface ColorCache {\n\tcolors: string[];\n\thues: number[];\n\texistingHslColors: Array< [ number, number, number ] >;\n\tminHue: number;\n\tmaxHue: number;\n}\n\n/**\n * Golden ratio for mathematically pleasing color distribution\n * Used to generate evenly spaced hues that are visually distinct\n */\nconst GOLDEN_RATIO = 0.618033988749;\n\n/**\n * Minimum perceptual distance between colors to ensure visual distinction\n * Based on weighted HSL distance calculation optimized for chart readability\n */\nconst MIN_COLOR_DISTANCE = 25;\n\n/**\n * Maximum attempts to find a sufficiently different color\n * Prevents infinite loops while allowing reasonable search space\n */\nconst MAX_COLOR_GENERATION_ATTEMPTS = 50;\n\n/**\n * Color variation attempt offset\n * Small increment to explore slightly different color variations per attempt\n */\nconst VARIATION_ATTEMPT_OFFSET = 0.1;\n\n// Saturation configuration for generated colors\n\n/**\n * Base saturation percentage for generated colors\n * 45% provides muted, professional colors without being washed out\n */\nconst BASE_SATURATION = 45;\n\n/**\n * Number of saturation variation steps\n * Creates 3 different saturation levels for variety\n */\nconst SATURATION_VARIATION_STEPS = 3;\n\n/**\n * Saturation increment per variation step\n * 10% increments provide subtle variation while keeping colors muted\n * Results in saturation levels: 45%, 55%, 65%\n */\nconst SATURATION_INCREMENT = 10;\n\n// Lightness configuration for WCAG AA accessibility compliance\n\n/**\n * Base lightness percentage for generated colors\n * 35% ensures sufficient contrast against white backgrounds for WCAG AA compliance\n * WCAG AA requires 4.5:1 contrast ratio for normal text\n */\nconst BASE_LIGHTNESS = 35;\n\n/**\n * Number of lightness variation steps\n * Creates 4 different lightness levels for variety\n */\nconst LIGHTNESS_VARIATION_STEPS = 4;\n\n/**\n * Lightness increment per variation step\n * 8% increments provide subtle lightness variation while maintaining accessibility\n * Results in lightness levels: 35%, 43%, 51%, 59%\n * All levels maintain WCAG AA compliance against white backgrounds\n */\nconst LIGHTNESS_INCREMENT = 8;\n\n// Hue range expansion and constraints\n\n/**\n * Minimum hue range in degrees to ensure sufficient color variety\n * 60 degrees provides reasonable color spread even for narrow palettes\n */\nconst MIN_HUE_RANGE_DEGREES = 60;\n\n/**\n * Hue range expansion factor\n * 1.3x expansion provides slightly more variety than the original palette\n */\nconst HUE_RANGE_EXPANSION_FACTOR = 1.3;\n\n/**\n * Threshold for detecting hue wrap-around (color wheel boundary crossing)\n * 180 degrees indicates the colors span more than half the color wheel\n */\nconst HUE_WRAP_THRESHOLD_DEGREES = 180;\n\n/**\n * Full color wheel rotation in degrees\n */\nconst FULL_HUE_ROTATION_DEGREES = 360;\n\n/**\n * Factor for single color hue range\n */\nconst SINGLE_COLOR_HUE_RANGE_FACTOR = 0.33;\n\n/**\n * Get a color from the colors array or generate a new color using the golden ratio\n *\n * @param index - the index of the color to get\n * @param colorCache - pre-computed color data for performance\n * @return a color from the colors array or a new color using the golden ratio\n */\nexport const getChartColor = ( index: number, colorCache: ColorCache ): string => {\n\tconst {\n\t\tcolors,\n\t\thues,\n\t\texistingHslColors,\n\t\tminHue: cachedMinHue,\n\t\tmaxHue: cachedMaxHue,\n\t} = colorCache;\n\n\tif ( index < colors.length ) {\n\t\treturn colors[ index ];\n\t}\n\n\tlet minHue = cachedMinHue;\n\tlet maxHue = cachedMaxHue;\n\n\t// Generate additional colors using golden ratio, avoiding similar colors\n\tfor ( let attempt = 0; attempt < MAX_COLOR_GENERATION_ATTEMPTS; attempt++ ) {\n\t\t// Calculate hue using golden ratio distribution with variation per attempt\n\t\t// Formula: ((base_index + attempt_variation) * golden_ratio * 360°) mod 360°\n\t\t// This ensures mathematically pleasing spacing while allowing slight shifts per attempt\n\t\tlet hue =\n\t\t\t( ( index - colors.length + attempt * VARIATION_ATTEMPT_OFFSET ) *\n\t\t\t\tGOLDEN_RATIO *\n\t\t\t\tFULL_HUE_ROTATION_DEGREES ) %\n\t\t\tFULL_HUE_ROTATION_DEGREES;\n\n\t\t// If we have existing colors, constrain new colors to their hue range\n\t\tif ( hues.length > 0 ) {\n\t\t\t// Handle hue wrap-around (e.g., if colors span across 0 degrees)\n\t\t\tlet hueRange = maxHue - minHue;\n\n\t\t\t// If there's only one color, use a set hue range for limited variety\n\t\t\tif ( hues.length === 1 ) {\n\t\t\t\thueRange = FULL_HUE_ROTATION_DEGREES * SINGLE_COLOR_HUE_RANGE_FACTOR;\n\t\t\t} else if ( hueRange > HUE_WRAP_THRESHOLD_DEGREES ) {\n\t\t\t\t// If the range is very large, it might be wrapping around the color wheel\n\t\t\t\t// Check if a smaller range exists when considering wrap-around\n\t\t\t\tconst altMinHue = Math.min( ...hues.filter( h => h > HUE_WRAP_THRESHOLD_DEGREES ) );\n\t\t\t\tconst altMaxHue =\n\t\t\t\t\tMath.max( ...hues.filter( h => h < HUE_WRAP_THRESHOLD_DEGREES ) ) +\n\t\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t\t\tconst altRange = altMaxHue - altMinHue;\n\n\t\t\t\tif ( altRange < hueRange ) {\n\t\t\t\t\tminHue = altMinHue;\n\t\t\t\t\tmaxHue = altMaxHue;\n\t\t\t\t\thueRange = altRange;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Expand the range slightly to provide some variation\n\t\t\tconst expandedRange = Math.max(\n\t\t\t\thueRange * HUE_RANGE_EXPANSION_FACTOR,\n\t\t\t\tMIN_HUE_RANGE_DEGREES\n\t\t\t);\n\t\t\tconst rangeCenter = ( minHue + maxHue ) / 2;\n\t\t\tconst expandedMin = rangeCenter - expandedRange / 2;\n\n\t\t\t// Map the generated hue to the expanded range\n\t\t\thue = expandedMin + ( hue / FULL_HUE_ROTATION_DEGREES ) * expandedRange;\n\n\t\t\t// Normalize to 0-360 range\n\t\t\thue =\n\t\t\t\t( ( hue % FULL_HUE_ROTATION_DEGREES ) + FULL_HUE_ROTATION_DEGREES ) %\n\t\t\t\tFULL_HUE_ROTATION_DEGREES;\n\t\t}\n\n\t\tconst saturation =\n\t\t\tBASE_SATURATION + ( ( index + attempt ) % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\t\tconst lightness =\n\t\t\tBASE_LIGHTNESS + ( ( index + attempt ) % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\n\t\tconst candidateHsl: [ number, number, number ] = [ hue, saturation, lightness ];\n\n\t\t// Check if this color is sufficiently different from existing colors\n\t\tlet isSufficientlyDifferent = true;\n\t\tfor ( const existingHsl of existingHslColors ) {\n\t\t\tif ( getColorDistance( candidateHsl, existingHsl ) < MIN_COLOR_DISTANCE ) {\n\t\t\t\tisSufficientlyDifferent = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( isSufficientlyDifferent ) {\n\t\t\t// d3-color uses 0-1 scale for saturation and lightness\n\t\t\treturn d3Hsl( Math.round( hue ), saturation / 100, lightness / 100 ).formatHex();\n\t\t}\n\t}\n\n\t// Fallback if we couldn't find a sufficiently different color\n\t// Formula: ((base_index) * golden_ratio * 360°) mod 360°\n\t// This ensures mathematically pleasing spacing while maintaining consistency\n\tconst fallbackHue =\n\t\t( ( index - colors.length ) * GOLDEN_RATIO * FULL_HUE_ROTATION_DEGREES ) %\n\t\tFULL_HUE_ROTATION_DEGREES;\n\tconst fallbackSaturation =\n\t\tBASE_SATURATION + ( index % SATURATION_VARIATION_STEPS ) * SATURATION_INCREMENT;\n\tconst fallbackLightness =\n\t\tBASE_LIGHTNESS + ( index % LIGHTNESS_VARIATION_STEPS ) * LIGHTNESS_INCREMENT;\n\t// d3-color uses 0-1 scale for saturation and lightness\n\treturn d3Hsl(\n\t\tMath.round( fallbackHue ),\n\t\tfallbackSaturation / 100,\n\t\tfallbackLightness / 100\n\t).formatHex();\n};\n","import type { CompleteChartTheme } from '../../types';\n\n/**\n * Default theme configuration\n */\nconst defaultTheme: CompleteChartTheme = {\n\tbackgroundColor: 'var(--wpds-color-bg-surface-neutral-strong, #fff)',\n\tlabelBackgroundColor: 'transparent', // label background color (transparent by default)\n\t// White label text sits on top of arbitrary series colors, so it has no WPDS\n\t// content-foreground equivalent and stays hardcoded (tokenization outlier).\n\tlabelTextColor: '#FFFFFF',\n\tcolors: [ '#98C8DF', '#006DAB', '#A6DC80', '#1F9828', '#FF8C8F' ],\n\tgridStyles: {\n\t\tstroke: 'var(--wpds-color-stroke-surface-neutral, #dbdbdb)',\n\t\tstrokeWidth: 1,\n\t},\n\ttickLength: 4,\n\tgridColor: '',\n\tgridColorDark: '',\n\txTickLineStyles: { stroke: 'var(--wpds-color-stroke-surface-neutral, #dbdbdb)', strokeWidth: 1 },\n\txAxisLineStyles: { stroke: 'var(--wpds-color-stroke-surface-neutral, #dbdbdb)', strokeWidth: 1 },\n\tlegend: {\n\t\tlabelStyles: {\n\t\t\tcolor: 'var(--wpds-color-fg-content-neutral, #1e1e1e)',\n\t\t},\n\t\tcontainerStyles: {},\n\t\tshapeStyles: [],\n\t},\n\tseriesLineStyles: [],\n\tglyphs: [],\n\t// `fontFamily: 'inherit'` overrides visx's hardcoded default font stack\n\t// (`-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif`)\n\t// that `buildChartTheme` injects as an inline style on SVG `<text>`\n\t// elements for axis labels and ticks. Setting `inherit` lets SVG text\n\t// pick up the host application's font-family via normal CSS inheritance.\n\tsvgLabelSmall: { fill: 'var(--wpds-color-fg-content-neutral, #1e1e1e)', fontFamily: 'inherit' },\n\tsvgLabelBig: { fontFamily: 'inherit' },\n\tannotationStyles: {\n\t\tlabel: {\n\t\t\tanchorLineStroke: 'var(--wpds-color-fg-content-neutral, #1e1e1e)',\n\t\t\tbackgroundFill: 'var(--wpds-color-bg-surface-neutral-strong, #fff)',\n\t\t},\n\t\tconnector: {\n\t\t\tstroke: 'var(--wpds-color-fg-content-neutral, #1e1e1e)',\n\t\t},\n\t\tcircleSubject: {\n\t\t\tstroke: 'transparent',\n\t\t\tfill: 'var(--wpds-color-fg-content-neutral, #1e1e1e)',\n\t\t\tradius: 5,\n\t\t},\n\t},\n\tgeoChart: {\n\t\tfeatureFillColor: 'var(--wpds-color-bg-surface-neutral-weak, #f4f4f4)',\n\t},\n\tleaderboardChart: {\n\t\trowGap: 12,\n\t\tcolumnGap: 4,\n\t\tlabelSpacing: 'xs',\n\t\t// [negative, neutral, positive]\n\t\tdeltaColors: [\n\t\t\t'var(--wpds-color-fg-content-error-weak, #cc1818)',\n\t\t\t'var(--wpds-color-fg-content-neutral-weak, #707070)',\n\t\t\t'var(--wpds-color-fg-content-success-weak, #008030)',\n\t\t],\n\t},\n\tconversionFunnelChart: {\n\t\tbackgroundColor: 'var(--wpds-color-bg-surface-neutral-weak, #f4f4f4)',\n\t\tpositiveChangeColor: 'var(--wpds-color-fg-content-success-weak, #008030)',\n\t\tnegativeChangeColor: 'var(--wpds-color-fg-content-error-weak, #cc1818)',\n\t},\n\tlineChart: {\n\t\tlineStyles: {\n\t\t\tcomparison: {\n\t\t\t\tstrokeDasharray: '4 4',\n\t\t\t\tstrokeLinecap: 'square',\n\t\t\t},\n\t\t},\n\t},\n\tbarChart: {\n\t\tbarStyles: {\n\t\t\tcomparison: {\n\t\t\t\twidthFactor: 1.5,\n\t\t\t\topacity: 0.5,\n\t\t\t},\n\t\t},\n\t},\n\tsparkline: {\n\t\tmargin: { top: 2, right: 2, bottom: 2, left: 2 },\n\t\tstrokeWidth: 1.5,\n\t},\n\t// `primaryColor` is left unset so it falls back to the palette's `colors[0]`. The compact\n\t// 11px square / 2px gap is the contribution-graph rhythm, which has no WPDS dimension.\n\theatmapChart: {\n\t\tcompactCellGap: 2,\n\t\tcompactCellSize: 11,\n\t},\n};\n\nexport { defaultTheme };\n","import { hsl as d3Hsl } from '@visx/vendor/d3-color';\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n} from 'react';\nimport {\n\tgetItemShapeStyles,\n\tgetSeriesBarStyles,\n\tgetSeriesLineStyles,\n\tmergeThemes,\n\tresolveCssVariable,\n\tnormalizeColorToHex,\n} from '../../utils';\nimport { getChartColor, type ColorCache } from './private/get-chart-color';\nimport { defaultTheme } from './themes';\nimport type { GlobalChartsContextValue, ChartRegistration } from './types';\nimport type { ChartTheme, CompleteChartTheme } from '../../types';\nimport type { FC, ReactNode } from 'react';\n\nexport const GlobalChartsContext = createContext< GlobalChartsContextValue | null >( null );\n\nexport interface GlobalChartsProviderProps {\n\tchildren: ReactNode;\n\ttheme?: Partial< ChartTheme >;\n}\n\nexport const GlobalChartsProvider: FC< GlobalChartsProviderProps > = ( { children, theme } ) => {\n\tconst [ charts, setCharts ] = useState< Map< string, ChartRegistration > >( () => new Map() );\n\t// Track hidden series per chart: chartId -> Set<seriesLabel>\n\tconst [ hiddenSeries, setHiddenSeries ] = useState< Map< string, Set< string > > >(\n\t\t() => new Map()\n\t);\n\n\t// Ref to the wrapper element for resolving scoped CSS variables\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst providerTheme: CompleteChartTheme = useMemo( () => {\n\t\treturn theme ? mergeThemes( defaultTheme, theme ) : defaultTheme;\n\t}, [ theme ] );\n\n\t// Cache expensive color computations that only change when theme colors change\n\t// Using useState + useLayoutEffect instead of useMemo to ensure CSS variables\n\t// in <style> tags are applied to the DOM before we try to resolve them\n\tconst [ colorCache, setColorCache ] = useState< ColorCache >( () => ( {\n\t\tcolors: [],\n\t\thues: [],\n\t\texistingHslColors: [],\n\t\tminHue: 360,\n\t\tmaxHue: 0,\n\t} ) );\n\n\t// Track if the color palette has been resolved from the DOM\n\t// Useful for animations that should only run after the color palette is resolved\n\tconst [ isColorPaletteResolved, setIsColorPaletteResolved ] = useState( false );\n\n\t// Compute color cache after DOM is updated (so CSS variables are available)\n\t// Resolves CSS variables from the wrapper element's scope to handle scoped variables\n\t// Note: Only re-runs when providerTheme changes, not when wrapper element changes.\n\t// This is intentional, as wrapperRef is expected to be stable for the lifetime of the provider.\n\tuseLayoutEffect( () => {\n\t\tsetIsColorPaletteResolved( false );\n\t\tconst { colors } = providerTheme;\n\t\tconst resolvedColors: string[] = [];\n\t\tconst hues: number[] = [];\n\t\tconst existingHslColors: Array< [ number, number, number ] > = [];\n\t\tlet minHue = 360;\n\t\tlet maxHue = 0;\n\n\t\t// Process all colors once and cache the results\n\t\tif ( Array.isArray( colors ) ) {\n\t\t\tfor ( const color of colors ) {\n\t\t\t\tif ( color && typeof color === 'string' ) {\n\t\t\t\t\t// Normalize color to hex format, handling CSS variables, RGB, HSL, etc.\n\t\t\t\t\t// This uses normalizeColorToHex which resolves CSS variables and converts\n\t\t\t\t\t// rgb(), rgba(), hsl() formats to hex\n\t\t\t\t\tconst normalizedColor = normalizeColorToHex(\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\twrapperRef.current,\n\t\t\t\t\t\tresolveCssVariable\n\t\t\t\t\t);\n\n\t\t\t\t\t// Only process valid hex colors\n\t\t\t\t\tif ( normalizedColor.startsWith( '#' ) ) {\n\t\t\t\t\t\tresolvedColors.push( normalizedColor );\n\t\t\t\t\t\tconst hslColor = d3Hsl( normalizedColor );\n\t\t\t\t\t\t// d3Hsl returns NaN values for invalid colors\n\t\t\t\t\t\tif ( ! isNaN( hslColor.h ) ) {\n\t\t\t\t\t\t\tconst hslTuple: [ number, number, number ] = [\n\t\t\t\t\t\t\t\thslColor.h,\n\t\t\t\t\t\t\t\thslColor.s * 100,\n\t\t\t\t\t\t\t\thslColor.l * 100,\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\thues.push( hslTuple[ 0 ] );\n\t\t\t\t\t\t\texistingHslColors.push( hslTuple );\n\t\t\t\t\t\t\tminHue = Math.min( minHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t\tmaxHue = Math.max( maxHue, hslTuple[ 0 ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetColorCache( {\n\t\t\tcolors: resolvedColors,\n\t\t\thues,\n\t\t\texistingHslColors,\n\t\t\tminHue,\n\t\t\tmaxHue,\n\t\t} );\n\t}, [ providerTheme ] );\n\n\tuseEffect( () => {\n\t\tif ( colorCache.colors.length > 0 ) {\n\t\t\tsetIsColorPaletteResolved( true );\n\t\t}\n\t}, [ colorCache ] );\n\n\tconst [ groupToColorMap, setGroupToColorMap ] = useState< Map< string, string > >(\n\t\t() => new Map()\n\t);\n\n\t// Reset group color mappings when theme colors change\n\tuseEffect( () => {\n\t\t// Create a completely new Map instance to trigger dependencies, e.g. useChartLegendItems\n\t\tsetGroupToColorMap( new Map() );\n\t}, [ providerTheme.colors ] );\n\n\tconst registerChart = useCallback( ( id: string, data: ChartRegistration ) => {\n\t\tsetCharts( prev => new Map( prev ).set( id, data ) );\n\t}, [] );\n\n\tconst unregisterChart = useCallback( ( id: string ) => {\n\t\tsetCharts( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tnewMap.delete( id );\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst getChartData = useCallback(\n\t\t( id: string ) => {\n\t\t\treturn charts.get( id );\n\t\t},\n\t\t[ charts ]\n\t);\n\n\tconst resolveColor = useCallback(\n\t\t( {\n\t\t\tgroup,\n\t\t\tindex,\n\t\t\toverrideColor,\n\t\t}: {\n\t\t\tgroup?: string;\n\t\t\tindex: number;\n\t\t\toverrideColor?: string;\n\t\t} ): string => {\n\t\t\t// Highest precedence: eg. explicit series stroke or chart color prop\n\t\t\tif ( overrideColor ) {\n\t\t\t\treturn normalizeColorToHex( overrideColor, wrapperRef.current, resolveCssVariable );\n\t\t\t}\n\n\t\t\t// If group provided, maintain a stable assignment\n\t\t\tif ( group ) {\n\t\t\t\tconst existing = groupToColorMap.get( group );\n\n\t\t\t\tif ( existing ) {\n\t\t\t\t\treturn existing;\n\t\t\t\t}\n\n\t\t\t\t// Use map size as index to assign colors sequentially (0, 1, 2...)\n\t\t\t\t// ensuring each new group gets the next available palette color\n\t\t\t\tconst assignedCount = groupToColorMap.size;\n\t\t\t\tconst color = getChartColor( assignedCount, colorCache );\n\t\t\t\tgroupToColorMap.set( group, color );\n\n\t\t\t\treturn color;\n\t\t\t}\n\n\t\t\treturn getChartColor( index, colorCache );\n\t\t},\n\t\t[ colorCache, groupToColorMap ]\n\t);\n\n\tconst getElementStyles = useCallback< GlobalChartsContextValue[ 'getElementStyles' ] >(\n\t\t( { data, index, overrideColor, legendShape } ) => {\n\t\t\tconst isSeriesData = data && typeof data === 'object' && 'data' in data && 'options' in data;\n\t\t\t// DataPointPercentage has a numeric 'value' directly, unlike SeriesData which has 'data' array\n\t\t\tconst isPointPercentageData =\n\t\t\t\tdata &&\n\t\t\t\ttypeof data === 'object' &&\n\t\t\t\t'value' in data &&\n\t\t\t\ttypeof data.value === 'number' &&\n\t\t\t\t! ( 'data' in data );\n\n\t\t\treturn {\n\t\t\t\tcolor: resolveColor( {\n\t\t\t\t\tgroup: data?.group,\n\t\t\t\t\tindex,\n\t\t\t\t\toverrideColor:\n\t\t\t\t\t\toverrideColor ||\n\t\t\t\t\t\t( isSeriesData && data?.options?.stroke ) ||\n\t\t\t\t\t\t( isPointPercentageData && data?.color ),\n\t\t\t\t} ),\n\t\t\t\tlineStyles: isSeriesData ? getSeriesLineStyles( data, index, providerTheme ) : {},\n\t\t\t\tbarStyles: isSeriesData ? getSeriesBarStyles( data, index, providerTheme ) : {},\n\t\t\t\tglyph: providerTheme.glyphs?.[ index ],\n\t\t\t\tshapeStyles: isSeriesData\n\t\t\t\t\t? getItemShapeStyles( data, index, providerTheme, legendShape )\n\t\t\t\t\t: {},\n\t\t\t};\n\t\t},\n\t\t[ providerTheme, resolveColor ]\n\t);\n\n\t// Series visibility management methods\n\tconst toggleSeriesVisibility = useCallback( ( chartId: string, seriesLabel: string ) => {\n\t\tsetHiddenSeries( prev => {\n\t\t\tconst newMap = new Map( prev );\n\t\t\tconst chartHidden = newMap.get( chartId ) || new Set();\n\t\t\tconst newSet = new Set( chartHidden );\n\n\t\t\tif ( newSet.has( seriesLabel ) ) {\n\t\t\t\tnewSet.delete( seriesLabel );\n\t\t\t} else {\n\t\t\t\tnewSet.add( seriesLabel );\n\t\t\t}\n\n\t\t\tif ( newSet.size === 0 ) {\n\t\t\t\tnewMap.delete( chartId );\n\t\t\t} else {\n\t\t\t\tnewMap.set( chartId, newSet );\n\t\t\t}\n\n\t\t\treturn newMap;\n\t\t} );\n\t}, [] );\n\n\tconst isSeriesVisible = useCallback(\n\t\t( chartId: string, seriesLabel: string ) => {\n\t\t\tconst chartHidden = hiddenSeries.get( chartId );\n\t\t\treturn ! chartHidden || ! chartHidden.has( seriesLabel );\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst getHiddenSeries = useCallback(\n\t\t( chartId: string ): Set< string > => {\n\t\t\tconst set = hiddenSeries.get( chartId );\n\t\t\treturn set ? new Set( set ) : new Set< string >();\n\t\t},\n\t\t[ hiddenSeries ]\n\t);\n\n\tconst value: GlobalChartsContextValue = useMemo(\n\t\t() => ( {\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\ttheme: providerTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t} ),\n\t\t[\n\t\t\tcharts,\n\t\t\tregisterChart,\n\t\t\tunregisterChart,\n\t\t\tgetChartData,\n\t\t\tproviderTheme,\n\t\t\tgetElementStyles,\n\t\t\ttoggleSeriesVisibility,\n\t\t\tisSeriesVisible,\n\t\t\tgetHiddenSeries,\n\t\t\tisColorPaletteResolved,\n\t\t]\n\t);\n\n\treturn (\n\t\t<GlobalChartsContext.Provider value={ value }>\n\t\t\t<div ref={ wrapperRef } style={ { display: 'contents' } }>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</GlobalChartsContext.Provider>\n\t);\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport type { GlobalChartsContextValue } from '../types';\n\nexport const useGlobalChartsContext = (): GlobalChartsContextValue => {\n\tconst context = useContext( GlobalChartsContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useGlobalChartsContext must be used within a GlobalChartsProvider' );\n\t}\n\treturn context;\n};\n","import { useId } from 'react';\n\nexport const useChartId = ( providedId?: string ): string => {\n\tconst generatedId = useId();\n\treturn providedId || generatedId;\n};\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import isEqual from 'fast-deep-equal';\nimport { useRef } from 'react';\n\n/**\n * Custom hook to memoize a value using deep equality comparison.\n * Prevents unnecessary re-renders when objects have the same content but different references.\n *\n * @param value - The value to memoize with deep equality comparison\n * @return The memoized value that only changes when deeply different\n */\nexport const useDeepMemo = < T >( value: T ): T => {\n\tconst ref = useRef< T >( value );\n\n\tif ( ! isEqual( ref.current, value ) ) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n};\n","import { buildChartTheme } from '@visx/xychart';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../providers';\nimport { resolveCssVariable } from '../utils';\nimport type { SeriesData } from '../types';\n\n// visx applies grid, axis, and tick-label colors as SVG presentation attributes,\n// where CSS var() cannot resolve. Resolve WPDS tokens to concrete values (or their\n// fallbacks) before handing the theme to buildChartTheme.\nconst resolveColor = ( value?: string ): string | undefined =>\n\tvalue ? resolveCssVariable( value ) ?? value : value;\n\nexport const useXYChartTheme = ( data: SeriesData[] ) => {\n\tconst theme = useGlobalChartsTheme();\n\n\treturn useMemo( () => {\n\t\tconst seriesColors = ( data ?? [] )\n\t\t\t.map( series => series.options?.stroke )\n\t\t\t.filter( ( color ): color is string => Boolean( color ) );\n\n\t\treturn buildChartTheme( {\n\t\t\t...theme,\n\t\t\tcolors: [ ...seriesColors, ...( theme.colors ?? [] ) ],\n\t\t\tbackgroundColor: resolveColor( theme.backgroundColor ),\n\t\t\tgridStyles: theme.gridStyles && {\n\t\t\t\t...theme.gridStyles,\n\t\t\t\tstroke: resolveColor( theme.gridStyles.stroke ),\n\t\t\t},\n\t\t\txAxisLineStyles: theme.xAxisLineStyles && {\n\t\t\t\t...theme.xAxisLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xAxisLineStyles.stroke ),\n\t\t\t},\n\t\t\txTickLineStyles: theme.xTickLineStyles && {\n\t\t\t\t...theme.xTickLineStyles,\n\t\t\t\tstroke: resolveColor( theme.xTickLineStyles.stroke ),\n\t\t\t},\n\t\t\tsvgLabelSmall: theme.svgLabelSmall && {\n\t\t\t\t...theme.svgLabelSmall,\n\t\t\t\tfill: resolveColor( theme.svgLabelSmall.fill ),\n\t\t\t},\n\t\t} );\n\t}, [ theme, data ] );\n};\n","import { useMemo } from 'react';\nimport { parseAsLocalDate } from '../utils';\nimport type { SeriesData } from '../types';\n\n/**\n * Hook that transforms and sorts chart data, handling date parsing and sorting\n *\n * This hook extracts the common data transformation logic used in both line-chart\n * and bar-chart components. It:\n * 1. Parses date strings into Date objects using parseAsLocalDate\n * 2. Sorts data points by date when date properties are present\n * 3. Returns the original data unchanged when no date properties are found\n *\n * @param {SeriesData[]} data - The raw chart data to transform\n * @return {SeriesData[]} The transformed and sorted data\n */\nexport const useChartDataTransform = ( data: SeriesData[] ) => {\n\treturn useMemo( () => {\n\t\t// Check if the first data point has date or dateString properties\n\t\tconst firstPoint = data?.[ 0 ]?.data?.[ 0 ];\n\t\tconst hasDateProperties = firstPoint && ( 'date' in firstPoint || 'dateString' in firstPoint );\n\n\t\t// If no date properties found, return data unchanged\n\t\tif ( ! hasDateProperties ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Transform and sort data with date properties\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data\n\t\t\t\t.map( point => {\n\t\t\t\t\tlet date: Date | undefined;\n\n\t\t\t\t\tif ( 'date' in point && point.date ) {\n\t\t\t\t\t\tdate = point.date;\n\t\t\t\t\t} else if ( 'dateString' in point && point.dateString ) {\n\t\t\t\t\t\tdate = parseAsLocalDate( point.dateString );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.sort( ( a, b ) => {\n\t\t\t\t\tif ( ! a.date || ! b.date ) return 0;\n\t\t\t\t\treturn a.date.getTime() - b.date.getTime();\n\t\t\t\t} ),\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { createScale, getTicks } from '@visx/scale';\nimport { useMemo } from 'react';\nimport { getLongestTickWidth, resolveFontSize } from '../utils';\nimport type { BaseChartProps, DataPointDate, SeriesData } from '../types';\nimport type { XYChartTheme } from '@visx/xychart';\n\n/**\n * Base top margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_TOP = 10;\n\n/**\n * Base right margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_RIGHT = 20;\n\n/**\n * Base bottom margin used for charts with a bottom X-axis.\n * This is large enough for typical font sizes and will be increased\n * dynamically when tick labels require more space.\n */\nconst DEFAULT_MARGIN_BOTTOM = 20;\n\n/**\n * Base left margin used when no dynamic adjustments are necessary.\n */\nconst DEFAULT_MARGIN_LEFT = 20;\n\n/**\n * Bottom margin to use when the X-axis is rendered at the top.\n * We only need a small buffer below the chart in that case.\n */\nconst DEFAULT_BOTTOM_FOR_TOP_AXIS = 10;\n\n/**\n * Fallback font size used when we cannot derive a font size\n * from the theme or axis styles for X-axis tick labels.\n */\nconst DEFAULT_FONT_SIZE = 12;\n\n/**\n * Fallback tick length used when tickLength is not provided\n * by the theme for either axis.\n */\nconst DEFAULT_TICK_LENGTH = 8;\n\n/**\n * Fallback width used for Y-axis tick labels when we cannot\n * measure them via getLongestTickWidth.\n */\nconst DEFAULT_Y_TICK_WIDTH = 40;\n\nconst getXAxisLabelMetrics = ( theme: XYChartTheme, orientation: 'top' | 'bottom' ) => {\n\tconst xAxisStyles =\n\t\torientation === 'top' ? theme.axisStyles?.x?.top : theme.axisStyles?.x?.bottom;\n\n\tconst fontSize =\n\t\tresolveFontSize( xAxisStyles?.axisLabel?.fontSize ) ||\n\t\tresolveFontSize( theme.svgLabelSmall?.fontSize ) ||\n\t\tDEFAULT_FONT_SIZE;\n\n\tconst tickLength = xAxisStyles?.tickLength ?? DEFAULT_TICK_LENGTH;\n\n\treturn { fontSize, tickLength };\n};\n\nexport const useChartMargin = (\n\theight: number,\n\toptions: BaseChartProps[ 'options' ],\n\tdata: SeriesData[],\n\ttheme: XYChartTheme,\n\thorizontal: boolean = false\n) => {\n\tconst yTicks = useMemo( () => {\n\t\tconst allDataPoints = data.flatMap( series => series.data as DataPointDate[] );\n\n\t\tif ( horizontal ) {\n\t\t\t// When horizontal, y ticks renders fixed tick labels.\n\t\t\treturn allDataPoints.map(\n\t\t\t\td => d.label || options.axis?.y?.tickFormat( d.date.getTime(), 0, [] )\n\t\t\t);\n\t\t}\n\n\t\tif ( options.axis?.y?.tickValues?.length ) {\n\t\t\treturn options.axis.y.tickValues;\n\t\t}\n\n\t\tconst minY = Math.min( ...allDataPoints.map( d => d.value ) );\n\t\tconst maxY = Math.max( ...allDataPoints.map( d => d.value ) );\n\t\tconst yScale = createScale( {\n\t\t\t...options.yScale,\n\t\t\tdomain: [ minY, maxY ],\n\t\t\trange: [ height, 0 ],\n\t\t} );\n\n\t\treturn getTicks( yScale, options.axis?.y?.numTicks );\n\t}, [ options, data, height, horizontal ] );\n\n\treturn useMemo( () => {\n\t\t// Default margin is for bottom axis labels.\n\t\tconst defaultMargin = {\n\t\t\ttop: DEFAULT_MARGIN_TOP,\n\t\t\tright: DEFAULT_MARGIN_RIGHT,\n\t\t\tbottom: DEFAULT_MARGIN_BOTTOM,\n\t\t\tleft: DEFAULT_MARGIN_LEFT,\n\t\t};\n\n\t\t// Auto-calculate margin for y axis labels based on orientation and tick width.\n\t\tconst yAxisOrientation = options.axis?.y?.orientation;\n\t\tconst yAxisStyles =\n\t\t\tyAxisOrientation === 'right' ? theme.axisStyles.y.right : theme.axisStyles.y.left;\n\t\tconst yTickWidth = getLongestTickWidth(\n\t\t\tyTicks,\n\t\t\toptions.axis?.y?.tickFormat,\n\t\t\tyAxisStyles.axisLabel\n\t\t);\n\t\tconst yMarginValue = ( yTickWidth ?? DEFAULT_Y_TICK_WIDTH ) + ( yAxisStyles?.tickLength ?? 0 );\n\n\t\tif ( yAxisOrientation === 'right' ) {\n\t\t\tdefaultMargin.right = yMarginValue;\n\t\t} else {\n\t\t\tdefaultMargin.left = yMarginValue;\n\t\t}\n\n\t\t// Dynamically compute X-axis margin (bottom by default, or top if orientation is 'top').\n\t\t// This mirrors Y-axis behavior where margin is based on label size and tick length,\n\t\t// but keeps the padding minimal so consumers can control container spacing themselves.\n\t\tconst xOrientation = options.axis?.x?.orientation === 'top' ? 'top' : 'bottom';\n\t\tconst { fontSize, tickLength } = getXAxisLabelMetrics( theme, xOrientation );\n\t\tconst computedXMargin = fontSize + tickLength;\n\n\t\tif ( xOrientation === 'top' ) {\n\t\t\tdefaultMargin.top = Math.max( defaultMargin.top, computedXMargin );\n\t\t\tdefaultMargin.bottom = DEFAULT_BOTTOM_FOR_TOP_AXIS;\n\t\t} else {\n\t\t\tdefaultMargin.bottom = Math.max( defaultMargin.bottom, computedXMargin );\n\t\t}\n\n\t\treturn defaultMargin;\n\t}, [ options, theme, yTicks ] );\n};\n","import { useState, useCallback, useRef } from 'react';\n\n/**\n * Hook to measure the width and height of a DOM element.\n * Returns a ref callback to attach to the element and the current dimensions in pixels.\n *\n * @param {object} props - Optional props.\n * @param {number} props.initialWidth - The initial width to use.\n * @param {number} props.initialHeight - The initial height to use.\n *\n * @return {[Function, number, number]} A tuple containing a ref callback, width, and height in pixels\n */\nexport function useElementSize< T extends HTMLElement = HTMLDivElement >( {\n\tinitialWidth = 0,\n\tinitialHeight = 0,\n}: {\n\tinitialWidth?: number;\n\tinitialHeight?: number;\n} = {} ): [ ( node: T | null ) => void, number, number ] {\n\tconst [ width, setWidth ] = useState( initialWidth );\n\tconst [ height, setHeight ] = useState( initialHeight );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback( ( node: T | null ) => {\n\t\tif ( observerRef.current ) {\n\t\t\tobserverRef.current.disconnect();\n\t\t\tobserverRef.current = null;\n\t\t}\n\t\tif ( node ) {\n\t\t\tconst handleResize = () => {\n\t\t\t\tconst rect = node.getBoundingClientRect();\n\t\t\t\tsetWidth( rect.width || 0 );\n\t\t\t\tsetHeight( rect.height || 0 );\n\t\t\t};\n\t\t\thandleResize();\n\t\t\tconst resizeObserver = new ResizeObserver( handleResize );\n\t\t\tresizeObserver.observe( node );\n\t\t\tobserverRef.current = resizeObserver;\n\t\t}\n\t}, [] );\n\n\treturn [ refCallback, width, height ];\n}\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * Hook to detect if text content is truncated within its container.\n * Uses ResizeObserver to dynamically track changes in element size.\n *\n * @param enabled - Whether truncation detection should be active. Defaults to true.\n * @return A tuple containing:\n * - [0] refCallback: Function to attach to the text element as a ref\n * - [1] isTruncated: Boolean indicating if the text is currently truncated\n *\n * @example\n * ```tsx\n * const [textRef, isTruncated] = useTextTruncation(true);\n *\n * return (\n * <span ref={textRef} title={isTruncated ? fullText : undefined}>\n * {text}\n * </span>\n * );\n * ```\n */\nexport function useTextTruncation(\n\tenabled: boolean = true\n): [ ( node: HTMLElement | null ) => void, boolean ] {\n\tconst [ isTruncated, setIsTruncated ] = useState( false );\n\tconst observerRef = useRef< ResizeObserver | null >( null );\n\n\tconst refCallback = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\t// Cleanup existing observer\n\t\t\tif ( observerRef.current ) {\n\t\t\t\tobserverRef.current.disconnect();\n\t\t\t\tobserverRef.current = null;\n\t\t\t}\n\n\t\t\tif ( node && enabled ) {\n\t\t\t\tconst checkTruncation = () => {\n\t\t\t\t\t// Check if content width exceeds container width (indicates truncation)\n\t\t\t\t\tconst truncated = node.scrollWidth > node.clientWidth;\n\t\t\t\t\tsetIsTruncated( truncated );\n\t\t\t\t};\n\n\t\t\t\t// Initial check\n\t\t\t\tcheckTruncation();\n\n\t\t\t\t// Watch for size changes\n\t\t\t\tconst resizeObserver = new ResizeObserver( checkTruncation );\n\t\t\t\tresizeObserver.observe( node );\n\t\t\t\tobserverRef.current = resizeObserver;\n\t\t\t} else {\n\t\t\t\tsetIsTruncated( false );\n\t\t\t}\n\t\t},\n\t\t[ enabled ]\n\t);\n\n\treturn [ refCallback, isTruncated ];\n}\n","import { useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../types';\n\nexport type EnhancedDataPoint = DataPointDate & {\n\tvisualValue?: number;\n};\n\nexport interface EnhancedSeriesData extends Omit< SeriesData, 'data' > {\n\tdata: EnhancedDataPoint[];\n}\n\nexport interface UseZeroValueDisplayOptions {\n\tenabled: boolean;\n\t/**\n\t * The pixel length of the value axis (height for vertical charts, width for\n\t * horizontal charts). Used to calculate a minimum visible value that ensures\n\t * zero-value bars are at least MIN_PIXEL_HEIGHT pixels tall along that axis.\n\t */\n\tvalueAxisLength?: number;\n}\n\n/**\n * Minimum pixel size for near-zero bars (non-zero values that would render too small).\n * Using 3px to be visible but not misleading - larger values might look like actual data.\n */\nconst MIN_PIXEL_SIZE = 3;\n\n/**\n * Pixel size for zero-value bars (1px less than near-zero to be visually distinguishable).\n */\nconst ZERO_PIXEL_SIZE = MIN_PIXEL_SIZE - 1;\n\nexport const useZeroValueDisplay = (\n\tdata: SeriesData[],\n\toptions: UseZeroValueDisplayOptions = { enabled: false }\n): SeriesData[] | EnhancedSeriesData[] => {\n\tconst { enabled, valueAxisLength } = options;\n\n\treturn useMemo( () => {\n\t\tif ( ! enabled || ! valueAxisLength || valueAxisLength <= 0 ) return data;\n\n\t\t// Find max absolute value\n\t\tlet maxAbsoluteValue = 0;\n\t\tfor ( const series of data ) {\n\t\t\tfor ( const point of series.data ) {\n\t\t\t\tif ( point.value !== null && point.value !== 0 ) {\n\t\t\t\t\tmaxAbsoluteValue = Math.max( maxAbsoluteValue, Math.abs( point.value ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( maxAbsoluteValue === 0 ) return data;\n\n\t\t// Calculate values that render as specific pixel sizes, clamped to maxAbsoluteValue\n\t\t// to prevent visual distortion when valueAxisLength is very small\n\t\tconst minNonZeroValue = Math.min(\n\t\t\t( MIN_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\t\tconst zeroVisualValue = Math.min(\n\t\t\t( ZERO_PIXEL_SIZE / valueAxisLength ) * maxAbsoluteValue,\n\t\t\tmaxAbsoluteValue\n\t\t);\n\n\t\treturn data.map( series => ( {\n\t\t\t...series,\n\t\t\tdata: series.data.map( ( point: DataPointDate ): EnhancedDataPoint => {\n\t\t\t\t// Zero values get a smaller visual representation (2px)\n\t\t\t\tif ( point.value === 0 ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: zeroVisualValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Null values should remain untouched\n\t\t\t\tif ( point.value === null ) {\n\t\t\t\t\treturn point;\n\t\t\t\t}\n\n\t\t\t\tconst absValue = Math.abs( point.value );\n\n\t\t\t\t// Near-zero values that would render below MIN_PIXEL_SIZE get boosted to 3px\n\t\t\t\t// Preserve the sign for negative values\n\t\t\t\tif ( absValue < minNonZeroValue ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...point,\n\t\t\t\t\t\tvisualValue: Math.sign( point.value ) * minNonZeroValue,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn point;\n\t\t\t} ),\n\t\t} ) );\n\t}, [ data, enabled, valueAxisLength ] );\n};\n","import { useMemo } from 'react';\n\ninterface DataPointWithValue {\n\tvalue: number;\n}\n\n/**\n * Hook to calculate percentages from values for chart data.\n * Ensures percentages are always derived from values (single source of truth).\n *\n * @param data - Array of data points with values\n * @return Data with calculated percentages\n */\nexport const useDataWithPercentages = < T extends DataPointWithValue >(\n\tdata: T[]\n): ( T & { percentage: number } )[] => {\n\treturn useMemo( () => {\n\t\tconst totalValue = data.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn data.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data ] );\n};\n","import { useMemo } from 'react';\n\n/**\n * Data point interface for charts with interactive legends.\n * Requires label for series identification, value for calculations,\n * and percentage (should be pre-calculated by the chart component).\n */\ninterface DataPointWithPercentage {\n\tlabel: string;\n\tvalue: number;\n\tpercentage: number;\n}\n\n/**\n * Parameters for the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataParams< T extends DataPointWithPercentage > {\n\t/** The chart data with pre-calculated percentages */\n\tdata: T[];\n\t/** Unique chart identifier, required for interactive legends */\n\tchartId: string | undefined;\n\t/** Whether interactive legend filtering is enabled */\n\tlegendInteractive: boolean;\n\t/** Function to check if a series is visible in the legend */\n\tisSeriesVisible: ( chartId: string, label: string ) => boolean;\n}\n\n/**\n * Return value from the useInteractiveLegendData hook.\n */\ninterface UseInteractiveLegendDataResult< T extends DataPointWithPercentage > {\n\t/** Filtered data array containing only visible segments with recalculated percentages */\n\tvisibleData: T[];\n\t/** Boolean indicating if all segments are hidden */\n\tallSegmentsHidden: boolean;\n\t/**\n\t * Legend data with stable percentage formatting.\n\t * Hidden items keep their original percentage.\n\t * Visible items show recalculated percentages that total 100%.\n\t */\n\tlegendData: T[];\n}\n\n/**\n * Custom hook to filter and recalculate chart data for interactive legends.\n *\n * When interactive legends are enabled, this hook:\n * 1. Filters data to show only visible series based on legend selection\n * 2. Recalculates percentages so visible segments total 100%\n * 3. Tracks whether all segments are hidden to show empty state\n *\n * This is particularly useful for pie charts, donut charts, and semi-circle charts\n * where segment visibility and percentages need to be dynamically adjusted.\n *\n * @example\n * ```tsx\n * const { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData({\n * data: chartData,\n * chartId: 'my-pie-chart',\n * legendInteractive: true,\n * isSeriesVisible: (id, label) => context.isSeriesVisible(id, label),\n * });\n *\n * // Use legendData for creating legend items (shows recalculated percentages)\n * const legendItems = useChartLegendItems(legendData, legendOptions);\n *\n * if (allSegmentsHidden) {\n * return <EmptyState />;\n * }\n *\n * // Use visibleData for rendering the chart (only visible segments)\n * return <PieChart data={visibleData} />;\n * ```\n *\n * @param params - Configuration object for the hook\n * @param params.data - The chart data to filter\n * @param params.chartId - Unique identifier for the chart (required for interactive mode)\n * @param params.legendInteractive - Whether to enable interactive filtering\n * @param params.isSeriesVisible - Function to check series visibility\n * @return Object containing visibleData, allSegmentsHidden flag, and legendData with recalculated percentages\n */\nexport const useInteractiveLegendData = < T extends DataPointWithPercentage >( {\n\tdata,\n\tchartId,\n\tlegendInteractive,\n\tisSeriesVisible,\n}: UseInteractiveLegendDataParams< T > ): UseInteractiveLegendDataResult< T > => {\n\t// Filter and recalculate data for interactive legends\n\t// Note: data should already have percentages calculated by the chart component\n\tconst visibleData = useMemo( () => {\n\t\t// If interactive mode is disabled or no chartId, return data as-is\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Filter to only visible segments based on legend state\n\t\tconst filtered = data.filter( segment => isSeriesVisible( chartId, segment.label ) );\n\n\t\t// If no segments are visible, return empty array\n\t\tif ( filtered.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Recalculate percentages from values so visible segments total 100%\n\t\tconst totalValue = filtered.reduce( ( sum, segment ) => sum + segment.value, 0 );\n\t\treturn filtered.map( segment => ( {\n\t\t\t...segment,\n\t\t\tpercentage: totalValue > 0 ? ( segment.value / totalValue ) * 100 : 0,\n\t\t} ) );\n\t}, [ data, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all segments are hidden (only relevant in interactive mode)\n\tconst allSegmentsHidden = useMemo( () => {\n\t\treturn legendInteractive && visibleData.length === 0;\n\t}, [ legendInteractive, visibleData ] );\n\n\t// Prepare legend data with percentages\n\t// Hidden items keep their original percentage (calculated from all values)\n\t// Visible items show recalculated percentages (totaling 100%)\n\tconst legendData = useMemo( () => {\n\t\tif ( ! legendInteractive || ! chartId ) {\n\t\t\treturn data;\n\t\t}\n\n\t\t// Build a Map for O(1) lookups instead of O(n) find() calls\n\t\tconst visibleDataMap = new Map( visibleData.map( d => [ d.label, d ] ) );\n\n\t\treturn data.map( segment => {\n\t\t\tconst isVisible = isSeriesVisible( chartId, segment.label );\n\t\t\tif ( ! isVisible ) {\n\t\t\t\t// Hidden items keep original percentage\n\t\t\t\treturn segment;\n\t\t\t}\n\n\t\t\t// For visible items, get the recalculated percentage from visibleData\n\t\t\treturn visibleDataMap.get( segment.label ) || segment;\n\t\t} );\n\t}, [ data, visibleData, legendInteractive, chartId, isSeriesVisible ] );\n\n\treturn { visibleData, allSegmentsHidden, legendData };\n};\n","import { useState, useEffect } from 'react';\n\n// 'no-preference' returns false in unsupported browsers,\n// causing a safe fallback to reduced motion instead of animating.\nconst QUERY = '(prefers-reduced-motion: no-preference)';\n\nconst getInitialState = () => ! window.matchMedia( QUERY ).matches;\n\n/**\n * Custom hook to determine if the user prefers reduced motion.\n * @return {boolean} A boolean indicating the user's preference for reduced motion.\n */\nexport function usePrefersReducedMotion() {\n\tconst [ prefersReducedMotion, setPrefersReducedMotion ] = useState( getInitialState );\n\n\tuseEffect( () => {\n\t\tconst mediaQueryList = window.matchMedia( QUERY );\n\n\t\tconst listener = event => {\n\t\t\tsetPrefersReducedMotion( ! event.matches );\n\t\t};\n\n\t\tmediaQueryList.addEventListener( 'change', listener );\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener( 'change', listener );\n\t\t};\n\t}, [] );\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useMemo } from 'react';\nimport { useDeepMemo } from '../../../hooks';\nimport { useGlobalChartsContext } from './use-global-charts-context';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { ChartType } from '../../../types';\n\nexport const useChartRegistration = ( {\n\tchartId,\n\tlegendItems,\n\tchartType,\n\tisDataValid,\n\tmetadata,\n}: {\n\tchartId: string;\n\tlegendItems: BaseLegendItem[];\n\tchartType: ChartType;\n\tisDataValid: boolean;\n\tmetadata?: Record< string, unknown >;\n} ): void => {\n\tconst { registerChart, unregisterChart } = useGlobalChartsContext();\n\n\t// Memoize legendItems with deep comparison to prevent infinite loops\n\tconst stableLegendItems = useDeepMemo( legendItems );\n\n\t// Memoize metadata to prevent unnecessary re-renders\n\tconst memoizedMetadata = useMemo( () => metadata, [ metadata ] );\n\n\tuseEffect( () => {\n\t\t// Only register if data is valid\n\t\tif ( isDataValid ) {\n\t\t\tregisterChart( chartId, {\n\t\t\t\tlegendItems: stableLegendItems,\n\t\t\t\tchartType,\n\t\t\t\tmetadata: memoizedMetadata,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tunregisterChart( chartId );\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchartId,\n\t\tstableLegendItems,\n\t\tchartType,\n\t\tmemoizedMetadata,\n\t\tisDataValid,\n\t\t// Removed registerChart and unregisterChart from dependencies\n\t\t// They are stable functions created with useCallback and empty deps\n\t] );\n};\n","import { useContext } from 'react';\nimport { GlobalChartsContext } from '../global-charts-provider';\nimport { defaultTheme } from '../themes';\nimport type { CompleteChartTheme } from '../../../types';\n\n/**\n * Hook to get the global chart theme from GlobalChartsProvider\n *\n * @return The global chart theme\n */\nexport const useGlobalChartsTheme = (): CompleteChartTheme => {\n\t// Get context but don't throw if it doesn't exist (for testing or standalone usage)\n\tconst context = useContext( GlobalChartsContext );\n\tconst globalTheme = context?.theme;\n\n\treturn globalTheme ?? defaultTheme;\n};\n","export function mergeObjects(a, b) {\n if (a && !b) {\n return a;\n }\n if (!a && b) {\n return b;\n }\n if (a || b) {\n return {\n ...a,\n ...b\n };\n }\n return undefined;\n}","import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}","/**\n * Creates a formatErrorMessage function with a custom URL and prefix.\n * @param baseUrl - The base URL for the error page (e.g., 'https://base-ui.com/production-error')\n * @param prefix - The prefix for the error message (e.g., 'Base UI')\n * @returns A function that formats error messages with the given URL and prefix\n */\nexport function createFormatErrorMessage(baseUrl, prefix) {\n return function formatErrorMessage(code, ...args) {\n const url = new URL(baseUrl);\n url.searchParams.set('code', code.toString());\n args.forEach(arg => url.searchParams.append('args[]', arg));\n return `${prefix} error #${code}; visit ${url} for the full message.`;\n };\n}\n\n/**\n * WARNING: Don't import this directly. It's imported by the code generated by\n * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`\n * constructors to ensure the plugin works as expected. Supported patterns include:\n * throw new Error('My message');\n * throw new Error(`My message: ${foo}`);\n * throw new Error(`My message: ${foo}` + 'another string');\n * ...\n */\nconst formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');\nexport default formatErrorMessage;","'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}","import { useRefWithInit } from \"./useRefWithInit.js\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}","import * as React from 'react';\nconst majorVersion = parseInt(React.version, 10);\nexport function isReactVersionAtLeast(reactVersionToCheck) {\n return majorVersion >= reactVersionToCheck;\n}","import * as React from 'react';\nimport { isReactVersionAtLeast } from \"./reactVersion.js\";\n\n/**\n * Extracts the `ref` from a React element, handling different React versions.\n */\nexport function getReactElementRef(element) {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n return null;\n }\n const reactElement = element;\n const propsWithRef = reactElement.props;\n return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;\n}","let set;\nif (process.env.NODE_ENV !== 'production') {\n set = new Set();\n}\nexport function warn(...messages) {\n if (process.env.NODE_ENV !== 'production') {\n const messageKey = messages.join(' ');\n if (!set.has(messageKey)) {\n set.add(messageKey);\n console.warn(`Base UI: ${messageKey}`);\n }\n }\n}","export function NOOP() {}\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});","export function getStateAttributesProps(state, customMapping) {\n const props = {};\n\n /* eslint-disable-next-line guard-for-in */\n for (const key in state) {\n const value = state[key];\n if (customMapping?.hasOwnProperty(key)) {\n const customProps = customMapping[key](value);\n if (customProps != null) {\n Object.assign(props, customProps);\n }\n continue;\n }\n if (value === true) {\n props[`data-${key.toLowerCase()}`] = '';\n } else if (value) {\n props[`data-${key.toLowerCase()}`] = value.toString();\n }\n }\n return props;\n}","/**\n * If the provided className is a string, it will be returned as is.\n * Otherwise, the function will call the className function with the state as the first argument.\n *\n * @param className\n * @param state\n */\nexport function resolveClassName(className, state) {\n return typeof className === 'function' ? className(state) : className;\n}","/**\n * If the provided style is an object, it will be returned as is.\n * Otherwise, the function will call the style function with the state as the first argument.\n *\n * @param style\n * @param state\n */\nexport function resolveStyle(style, state) {\n return typeof style === 'function' ? style(state) : style;\n}","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useMergedRefs, useMergedRefsN } from '@base-ui/utils/useMergedRefs';\nimport { getReactElementRef } from '@base-ui/utils/getReactElementRef';\nimport { mergeObjects } from '@base-ui/utils/mergeObjects';\nimport { warn } from '@base-ui/utils/warn';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getStateAttributesProps } from \"./getStateAttributesProps.js\";\nimport { resolveClassName } from \"../utils/resolveClassName.js\";\nimport { resolveStyle } from \"../utils/resolveStyle.js\";\nimport { mergeProps, mergePropsN, mergeClassNames } from \"../merge-props/index.js\";\nimport { createElement as _createElement } from \"react\";\n/**\n * Renders a Base UI element.\n *\n * @param element The default HTML element to render. Can be overridden by the `render` prop.\n * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored.\n * @param params Additional parameters for rendering the element.\n */\nexport function useRenderElement(element, componentProps, params = {}) {\n const renderProp = componentProps.render;\n const outProps = useRenderElementProps(componentProps, params);\n if (params.enabled === false) {\n return null;\n }\n const state = params.state ?? EMPTY_OBJECT;\n return evaluateRenderProp(element, renderProp, outProps, state);\n}\n\n/**\n * Computes render element final props.\n */\nfunction useRenderElementProps(componentProps, params = {}) {\n const {\n className: classNameProp,\n style: styleProp,\n render: renderProp\n } = componentProps;\n const {\n state = EMPTY_OBJECT,\n ref,\n props,\n stateAttributesMapping,\n enabled = true\n } = params;\n const className = enabled ? resolveClassName(classNameProp, state) : undefined;\n const style = enabled ? resolveStyle(styleProp, state) : undefined;\n const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;\n const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;\n\n // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.\n // This prevents potential TypeError when setting ref, className, or style properties,\n // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.\n const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;\n\n // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,\n // switching between them at runtime is safe. If this assertion fails, React will\n // throw at runtime anyway.\n // This also skips the `useMergedRefs` call on the server, which is fine because\n // refs are not used on the server side.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (typeof document !== 'undefined') {\n if (!enabled) {\n useMergedRefs(null, null);\n } else if (Array.isArray(ref)) {\n outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);\n } else {\n outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);\n }\n }\n if (!enabled) {\n return EMPTY_OBJECT;\n }\n if (className !== undefined) {\n outProps.className = mergeClassNames(outProps.className, className);\n }\n if (style !== undefined) {\n outProps.style = mergeObjects(outProps.style, style);\n }\n return outProps;\n}\nfunction resolveRenderFunctionProps(props) {\n if (Array.isArray(props)) {\n return mergePropsN(props);\n }\n return mergeProps(undefined, props);\n}\n\n// The symbol React uses internally for lazy components\n// https://github.com/facebook/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31\n//\n// TODO delete once https://github.com/facebook/react/issues/32392 is fixed\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\nconst COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;\nconst LOWERCASE_CHARACTER_PATTERN = /[a-z]/;\nfunction evaluateRenderProp(element, render, props, state) {\n if (render) {\n if (typeof render === 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warnIfRenderPropLooksLikeComponent(render);\n }\n return render(props, state);\n }\n const mergedProps = mergeProps(props, render.props);\n mergedProps.ref = props.ref;\n let newElement = render;\n\n // Workaround for https://github.com/facebook/react/issues/32392\n // This works because the toArray() logic unwrap lazy element type in\n // https://github.com/facebook/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/react/src/ReactChildren.js#L186\n if (newElement?.$$typeof === REACT_LAZY_TYPE) {\n const children = React.Children.toArray(render);\n newElement = children[0];\n }\n\n // There is a high number of indirections, the error message thrown by React.cloneElement() is\n // hard to use for developers, this logic provides a better context.\n //\n // Our general guideline is to never change the control flow depending on the environment.\n // However, React.cloneElement() throws if React.isValidElement() is false,\n // so we can throw before with custom message.\n if (process.env.NODE_ENV !== 'production') {\n if (! /*#__PURE__*/React.isValidElement(newElement)) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(['Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.', 'A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.', 'https://base-ui.com/r/invalid-render-prop'].join('\\n'));\n }\n }\n return /*#__PURE__*/React.cloneElement(newElement, mergedProps);\n }\n if (element) {\n if (typeof element === 'string') {\n return renderTag(element, props);\n }\n }\n // Unreachable, but the typings on `useRenderElement` need to be reworked\n // to annotate it correctly.\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: Render element or function are not defined.' : _formatErrorMessage(8));\n}\nfunction warnIfRenderPropLooksLikeComponent(renderFn) {\n const functionName = renderFn.name;\n if (functionName.length === 0) {\n return;\n }\n if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {\n return;\n }\n if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {\n return;\n }\n warn(`The \\`render\\` prop received a function named \\`${functionName}\\` that starts with an uppercase letter.`, 'This usually means a React component was passed directly as `render={Component}`.', 'Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.', 'If this is an intentional render callback, rename it to start with a lowercase letter.', 'Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.', 'https://base-ui.com/r/invalid-render-prop');\n}\nfunction renderTag(Tag, props) {\n if (Tag === 'button') {\n return /*#__PURE__*/_createElement(\"button\", {\n type: \"button\",\n ...props,\n key: props.key\n });\n }\n if (Tag === 'img') {\n return /*#__PURE__*/_createElement(\"img\", {\n alt: \"\",\n ...props,\n key: props.key\n });\n }\n return /*#__PURE__*/React.createElement(Tag, props);\n}","import { useRenderElement } from \"../internals/useRenderElement.js\";\n/**\n * Renders a Base UI element.\n *\n * @public\n */\nexport function useRender(params) {\n return useRenderElement(params.defaultTagName ?? 'div', params, params);\n}","// packages/ui/src/stack/stack.tsx\nimport { useRender, mergeProps } from \"@base-ui/react\";\nimport { forwardRef } from \"@wordpress/element\";\n\n// packages/style-runtime/src/index.ts\nvar STYLE_HASH_ATTRIBUTE = \"data-wp-hash\";\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: /* @__PURE__ */ new Map(),\n styles: /* @__PURE__ */ new Map(),\n injectedStyles: /* @__PURE__ */ new WeakMap()\n };\n if (typeof document !== \"undefined\") {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(\n `style[${STYLE_HASH_ATTRIBUTE}]`\n )) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = /* @__PURE__ */ new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement(\"style\");\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\nfunction registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(\n targetDocument,\n (runtime.documents.get(targetDocument) ?? 0) + 1\n );\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === void 0) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\nfunction registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}\n\n// packages/ui/src/stack/style.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"b51ff41489\", \"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}\");\n}\nvar style_default = { \"stack\": \"_19ce0419607e1896__stack\" };\n\n// packages/ui/src/stack/stack.tsx\nvar gapTokens = {\n xs: \"var(--wpds-dimension-gap-xs, 4px)\",\n sm: \"var(--wpds-dimension-gap-sm, 8px)\",\n md: \"var(--wpds-dimension-gap-md, 12px)\",\n lg: \"var(--wpds-dimension-gap-lg, 16px)\",\n xl: \"var(--wpds-dimension-gap-xl, 24px)\",\n \"2xl\": \"var(--wpds-dimension-gap-2xl, 32px)\",\n \"3xl\": \"var(--wpds-dimension-gap-3xl, 40px)\"\n};\nvar Stack = forwardRef(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {\n const style = {\n gap: gap && gapTokens[gap],\n alignItems: align,\n justifyContent: justify,\n flexDirection: direction,\n flexWrap: wrap\n };\n const element = useRender({\n render,\n ref,\n props: mergeProps(props, { style, className: style_default.stack })\n });\n return element;\n});\nexport {\n Stack\n};\n//# sourceMappingURL=stack.mjs.map\n","// packages/ui/src/text/text.tsx\nimport { useRender, mergeProps } from \"@base-ui/react\";\nimport clsx from \"clsx\";\nimport { forwardRef } from \"@wordpress/element\";\n\n// packages/style-runtime/src/index.ts\nvar STYLE_HASH_ATTRIBUTE = \"data-wp-hash\";\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: /* @__PURE__ */ new Map(),\n styles: /* @__PURE__ */ new Map(),\n injectedStyles: /* @__PURE__ */ new WeakMap()\n };\n if (typeof document !== \"undefined\") {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(\n `style[${STYLE_HASH_ATTRIBUTE}]`\n )) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = /* @__PURE__ */ new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement(\"style\");\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\nfunction registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(\n targetDocument,\n (runtime.documents.get(targetDocument) ?? 0) + 1\n );\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === void 0) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\nfunction registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}\n\n// packages/ui/src/text/style.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"0c8601dd83\", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\"Segoe UI\",\"Roboto\",\"Oxygen-Sans\",\"Ubuntu\",\"Cantarell\",\"Helvetica Neue\",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}');\n}\nvar style_default = { \"text\": \"_83ed8a8da5dd50ea__text\", \"heading-2xl\": \"_14437cfb77831647__heading-2xl\", \"heading-xl\": \"_3c78b7fa9b4072dd__heading-xl\", \"heading-lg\": \"aa58f227716bcde2__heading-lg\", \"heading-md\": \"fc4da56d8dfe52c4__heading-md\", \"heading-sm\": \"a9b78c7c82e8dff7__heading-sm\", \"body-xl\": \"_305ff559e52180d5__body-xl\", \"body-lg\": \"ca1aa3fc2029e958__body-lg\", \"body-md\": \"_131101940be12424__body-md\", \"body-sm\": \"_0e8d87a42c1f75fa__body-sm\" };\n\n// packages/ui/src/utils/css/global-css-defense.module.css\nif (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n registerStyle(\"1fb29d3a3c\", \"._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}\");\n}\nvar global_css_defense_default = { \"button\": \"_6defc79820e382c6__button\", \"input\": \"d2cff2e5dea83bd1__input\", \"textarea\": \"_547d86373d02e108__textarea\", \"div\": \"_8c15fd0ed9f28ba4__div\", \"p\": \"_43cec3e1eec1066d__p\", \"heading\": \"e97669c6d9a38497__heading\", \"a\": \"_2c0831b0499dbd6e__a\" };\n\n// packages/ui/src/text/text.tsx\nvar Text = forwardRef(function Text2({ variant = \"body-md\", render, className, ...props }, ref) {\n const element = useRender({\n render,\n defaultTagName: \"span\",\n ref,\n props: mergeProps(props, {\n className: clsx(\n style_default.text,\n global_css_defense_default.heading,\n global_css_defense_default.p,\n style_default[variant],\n className\n )\n })\n });\n return element;\n});\nexport {\n Text\n};\n//# sourceMappingURL=text.mjs.map\n","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\ttype RefAttributes,\n\ttype ForwardRefExoticComponent,\n\ttype KeyboardEvent,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n} from 'react';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport type { BaseLegendProps } from '../types';\n\nconst ALIGNMENT_TO_FLEX = {\n\tstart: 'flex-start',\n\tcenter: 'center',\n\tend: 'flex-end',\n} as const;\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ( {\n\ttext,\n\ttextOverflow,\n\tmaxWidth,\n}: {\n\ttext: string;\n\ttextOverflow: 'ellipsis' | 'wrap';\n\tmaxWidth?: string;\n} ) => {\n\tconst isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n\tconst [ textRef, isTruncated ] = useTextTruncation( Boolean( isEllipsis ) );\n\n\treturn (\n\t\t<span\n\t\t\tref={ textRef }\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'legend-item-text' ],\n\t\t\t\tmaxWidth != null && styles[ `legend-item-text--${ textOverflow }` ]\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...( maxWidth != null && {\n\t\t\t\t\tmaxWidth,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t} ),\n\t\t\t} }\n\t\t\ttitle={ isEllipsis && isTruncated ? text : undefined }\n\t\t>\n\t\t\t{ text }\n\t\t</span>\n\t);\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend: ForwardRefExoticComponent<\n\tBaseLegendProps & RefAttributes< HTMLDivElement >\n> = forwardRef< HTMLDivElement, BaseLegendProps >(\n\t(\n\t\t{\n\t\t\titems,\n\t\t\tclassName,\n\t\t\torientation = 'horizontal',\n\t\t\talignment = 'center',\n\t\t\tshape = 'rect',\n\t\t\tfill = valueOrIdentityString,\n\t\t\tsize = valueOrIdentityString,\n\t\t\tlabelFormat = valueOrIdentity,\n\t\t\tlabelTransform = labelTransformFactory,\n\t\t\titemStyles,\n\t\t\titemClassName,\n\t\t\tlabelStyles,\n\t\t\tlabelClassName,\n\t\t\tshapeStyles,\n\t\t\trender,\n\t\t\tinteractive = false,\n\t\t\tchartId,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { margin: itemMargin = '0', flexDirection: itemDirection = 'row' } = itemStyles ?? {};\n\t\tconst {\n\t\t\tjustifyContent: labelJustifyContent = 'flex-start',\n\t\t\tflex: labelFlex = '0 0 auto',\n\t\t\tmargin: labelMargin = '0 4px',\n\t\t\tmaxWidth,\n\t\t\ttextOverflow = 'wrap',\n\t\t} = labelStyles ?? {};\n\t\tconst {\n\t\t\twidth: shapeWidth = 16,\n\t\t\theight: shapeHeight = 16,\n\t\t\tmargin: shapeMargin = '2px 4px 2px 0',\n\t\t} = shapeStyles ?? {};\n\n\t\tconst theme = useGlobalChartsTheme();\n\t\tconst context = useContext( GlobalChartsContext );\n\n\t\tconst legendScale = scaleOrdinal( {\n\t\t\tdomain: items.map( item => item.label ),\n\t\t\trange: items.map( item => item.color ),\n\t\t} );\n\t\tconst domain = legendScale.domain();\n\n\t\tconst getShapeStyle = useCallback(\n\t\t\t( { index }: { index: number } ) => items[ index ]?.shapeStyle,\n\t\t\t[ items ]\n\t\t);\n\n\t\t// Handle legend item clicks for interactive mode\n\t\tconst handleLegendClick = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( interactive && chartId && context ) {\n\t\t\t\t\tcontext.toggleSeriesVisibility( chartId, seriesLabel );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Check if a series is visible\n\t\tconst isSeriesVisible = useCallback(\n\t\t\t( seriesLabel: string ) => {\n\t\t\t\tif ( ! interactive || ! chartId || ! context ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn context.isSeriesVisible( chartId, seriesLabel );\n\t\t\t},\n\t\t\t[ interactive, chartId, context ]\n\t\t);\n\n\t\t// Create event handlers to avoid inline arrow functions\n\t\tconst createClickHandler = useCallback(\n\t\t\t( labelText: string ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn () => handleLegendClick( labelText );\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst createKeyDownHandler = useCallback(\n\t\t\t( labelText: string ) => {\n\t\t\t\tif ( ! interactive ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn ( event: KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\thandleLegendClick( labelText );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ interactive, handleLegendClick ]\n\t\t);\n\n\t\tconst flexAlignment = ALIGNMENT_TO_FLEX[ alignment ] ?? 'center';\n\n\t\treturn render ? (\n\t\t\trender( items )\n\t\t) : (\n\t\t\t<LegendOrdinal\n\t\t\t\tscale={ legendScale }\n\t\t\t\tlabelFormat={ labelFormat }\n\t\t\t\tlabelTransform={ labelTransform }\n\t\t\t>\n\t\t\t\t{ labels => (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tdirection={ orientation === 'vertical' ? 'column' : 'row' }\n\t\t\t\t\t\tgap={ orientation === 'vertical' ? 'sm' : 'lg' }\n\t\t\t\t\t\talign={ orientation === 'vertical' ? flexAlignment : undefined }\n\t\t\t\t\t\tjustify={ orientation === 'horizontal' ? flexAlignment : undefined }\n\t\t\t\t\t\twrap={ orientation === 'horizontal' ? 'wrap' : undefined }\n\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\tdata-testid={ `legend-${ orientation }` }\n\t\t\t\t\t\tclassName={ clsx( styles.legend, className ) }\n\t\t\t\t\t\tstyle={ theme.legend?.containerStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ labels.map( ( label, i ) => {\n\t\t\t\t\t\t\tconst visible = isSeriesVisible( label.text );\n\t\t\t\t\t\t\tconst handleClick = createClickHandler( label.text );\n\t\t\t\t\t\t\tconst handleKeyDown = createKeyDownHandler( label.text );\n\t\t\t\t\t\t\tconst matchedItem = items[ i ];\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LegendItem\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'visx-legend-item',\n\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item' ],\n\t\t\t\t\t\t\t\t\t\tinteractive && styles[ 'legend-item--interactive' ],\n\t\t\t\t\t\t\t\t\t\t! visible && styles[ 'legend-item--inactive' ],\n\t\t\t\t\t\t\t\t\t\titemClassName\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tdata-testid=\"legend-item\"\n\t\t\t\t\t\t\t\t\tkey={ `legend-${ label.text }-${ i }` }\n\t\t\t\t\t\t\t\t\tmargin={ itemMargin }\n\t\t\t\t\t\t\t\t\tflexDirection={\n\t\t\t\t\t\t\t\t\t\torientation === 'vertical' && alignment === 'end'\n\t\t\t\t\t\t\t\t\t\t\t? 'row-reverse'\n\t\t\t\t\t\t\t\t\t\t\t: itemDirection\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\t\t\t\t\trole={ interactive ? 'button' : undefined }\n\t\t\t\t\t\t\t\t\ttabIndex={ interactive ? 0 : undefined }\n\t\t\t\t\t\t\t\t\taria-pressed={ interactive ? visible : undefined }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\tinteractive\n\t\t\t\t\t\t\t\t\t\t\t? `${ label.text }: ${ visible ? 'visible' : 'hidden' }. Toggle visibility.`\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph ? (\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\twidth={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\theight={ items[ i ]?.glyphSize * 2 }\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-glyph\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t{ items[ i ]?.renderGlyph( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey: `legend-glyph-${ label.text }`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdatum: {},\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolor: fill( label ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsize: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\tx: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\ty: items[ i ]?.glyphSize,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<LegendShape\n\t\t\t\t\t\t\t\t\t\t\tshape={ shape }\n\t\t\t\t\t\t\t\t\t\t\theight={ shapeHeight }\n\t\t\t\t\t\t\t\t\t\t\twidth={ shapeWidth }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ shapeMargin }\n\t\t\t\t\t\t\t\t\t\t\titem={ domain[ i ] }\n\t\t\t\t\t\t\t\t\t\t\titemIndex={ i }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\tfill={ fill }\n\t\t\t\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\t\t\t\tshapeStyle={ getShapeStyle }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<LegendLabel\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"legend-label\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'visx-legend-label',\n\t\t\t\t\t\t\t\t\t\t\tstyles[ 'legend-item-label' ],\n\t\t\t\t\t\t\t\t\t\t\tlabelClassName\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tflex: labelFlex,\n\t\t\t\t\t\t\t\t\t\t\tmargin: labelMargin,\n\t\t\t\t\t\t\t\t\t\t\t...theme.legend?.labelStyles,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Stack align=\"center\" gap=\"sm\" justify={ labelJustifyContent }>\n\t\t\t\t\t\t\t\t\t\t\t<LegendText\n\t\t\t\t\t\t\t\t\t\t\t\ttext={ label.text }\n\t\t\t\t\t\t\t\t\t\t\t\ttextOverflow={ textOverflow }\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ matchedItem?.value != null && matchedItem.value !== '' && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'legend-item-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ '\\u00A0' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ matchedItem.value }\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</LegendLabel>\n\t\t\t\t\t\t\t\t</LegendItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\t\t\t</LegendOrdinal>\n\t\t);\n\t}\n);\n","import { useContext, useMemo, forwardRef } from 'react';\nimport { SingleChartContext } from '../../charts/private/single-chart-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport type { LegendProps } from './types';\nimport type { ChartType, LegendShape } from '../../types';\n\nconst defaultShapeByChartType: Partial<\n\tRecord< ChartType, Extract< LegendShape< unknown, unknown >, string > >\n> = {\n\tarea: 'rect',\n\tline: 'line',\n\tbar: 'rect',\n\tpie: 'circle',\n\t'pie-semi-circle': 'circle',\n\tleaderboard: 'circle',\n};\n\nexport const Legend = forwardRef< HTMLDivElement, LegendProps >(\n\t( { chartId, items, shape, ...props }, ref ) => {\n\t\t// Get context but don't throw if it doesn't exist\n\t\tconst context = useContext( GlobalChartsContext );\n\t\tconst singleChartContext = useContext( SingleChartContext );\n\n\t\t// When chartId is used, it is standalone mode\n\t\t// When chartId is not provided, we use the context's chartId, meaning it is in a single chart context\n\t\tconst contextChartId = chartId ?? singleChartContext?.chartId;\n\n\t\tconst chartData = useMemo(\n\t\t\t() => ( contextChartId && context ? context.getChartData( contextChartId ) : undefined ),\n\t\t\t[ contextChartId, context ]\n\t\t);\n\n\t\tconst contextItems = chartData?.legendItems;\n\n\t\t// Derive the default legend shape from the chart type when no explicit shape is provided\n\t\tconst resolvedShape =\n\t\t\tshape ??\n\t\t\t( chartData?.chartType ? defaultShapeByChartType[ chartData.chartType ] : undefined );\n\n\t\t// Provided items take precedence over context items\n\t\tconst legendItems = ( items || contextItems ) as typeof items;\n\n\t\tif ( ! legendItems ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseLegend\n\t\t\t\tref={ ref }\n\t\t\t\titems={ legendItems }\n\t\t\t\tshape={ resolvedShape }\n\t\t\t\t{ ...props }\n\t\t\t\tchartId={ contextChartId }\n\t\t\t/>\n\t\t);\n\t}\n);\n","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type {\n\tSeriesData,\n\tDataPointDate,\n\tDataPointPercentageCalculated,\n\tLegendShape,\n} from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentageCalculated,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentageCalculated (pie chart data with calculated percentage)\n\tif ( 'percentage' in point ) {\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( point.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( point.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn point.valueDisplay || formatNumber( point.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\n/**\n * Processes SeriesData into legend items\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( series: SeriesData, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: series,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: series.label,\n\t\t\tvalue: showValues ? series.data?.length?.toString() || '0' : '',\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn seriesData.map( mapper );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentageCalculated )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentageCalculated, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentageCalculated,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentageCalculated[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentageCalculated (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentageCalculated )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n","import { formatNumber } from '@automattic/number-formatters';\nimport styles from './base-tooltip.module.scss';\nimport type { CSSProperties, ComponentType, ReactNode } from 'react';\n\ntype TooltipData = {\n\tlabel: string;\n\tvalue: number;\n\tvalueDisplay?: string;\n};\n\ntype TooltipComponentProps = {\n\tdata: TooltipData;\n\tclassName?: string;\n};\n\ntype TooltipCommonProps = {\n\ttop: number;\n\tleft: number;\n\tstyle?: CSSProperties;\n\tclassName?: string;\n\t/**\n\t * Whether to render the tooltip container div. When false, only renders the content.\n\t * Useful when the tooltip is rendered inside a portal or custom container.\n\t * @default true\n\t */\n\trenderContainer?: boolean;\n};\n\ntype DefaultDataTooltip = {\n\tdata: TooltipData;\n\tcomponent?: ComponentType< TooltipComponentProps >;\n\tchildren?: never;\n};\n\ntype CustomTooltip = {\n\tchildren: ReactNode;\n\tdata?: never;\n\tcomponent?: never;\n};\n\ntype BaseTooltipProps = TooltipCommonProps & ( DefaultDataTooltip | CustomTooltip );\n\nconst DefaultTooltipContent = ( { data }: TooltipComponentProps ) => (\n\t<>\n\t\t{ data?.label }: { data?.valueDisplay || formatNumber( data?.value ) }\n\t</>\n);\n\nexport const BaseTooltip = ( {\n\tdata,\n\ttop,\n\tleft,\n\tcomponent: Component = DefaultTooltipContent,\n\tchildren,\n\tclassName,\n\tstyle,\n\trenderContainer = true,\n}: BaseTooltipProps ) => {\n\tconst content = children || ( data && <Component data={ data } className={ className } /> );\n\n\tif ( ! renderContainer ) {\n\t\treturn content;\n\t}\n\n\treturn (\n\t\t<div className={ styles.tooltip } style={ { top, left, ...style } } role=\"tooltip\">\n\t\t\t{ content }\n\t\t</div>\n\t);\n};\n\nexport type { BaseTooltipProps, TooltipData };\n","import { Tooltip, TooltipContext } from '@visx/xychart';\nimport { useContext, useEffect, useCallback, useMemo } from 'react';\nimport type { SeriesData, DataPointDate } from '../../types';\nimport type { RenderTooltipParams, XyChartTooltipProps } from '../../visx/types';\nimport type { ReactNode } from 'react';\n\n// Type for flattened tooltip data used in individual mode\nexport type FlattenedTooltipData = {\n\tdatum: DataPointDate;\n\tseriesLabel: string;\n\tseriesIndex: number;\n\tdataPointIndex: number;\n};\n\n// Enhanced tooltip with keyboard navigation and accessibility\ninterface AccessibleTooltipProps\n\textends Omit< XyChartTooltipProps< DataPointDate >, 'renderTooltip' > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\tselectedIndex?: number | undefined;\n\ttooltipRef?: ( element: HTMLDivElement | null ) => void;\n\tkeyboardFocusedClassName?: string;\n\t/**\n\t * Flattened tooltip data prepared by parent component\n\t * Each index corresponds to one tooltip to show\n\t */\n\ttooltipData?: FlattenedTooltipData[];\n\t/**\n\t * For line charts: series data to show all series at selected data point\n\t * When provided, shows all series instead of individual tooltips\n\t */\n\tseries?: SeriesData[];\n\t/**\n\t * Whether to combine tooltip information from multiple series into a single tooltip. This is useful for line charts.\n\t * Or to show individual tooltips for each series. This is useful for bar charts.\n\t */\n\tmode?: 'individual' | 'group';\n}\n\nexport const AccessibleTooltip: React.FC< AccessibleTooltipProps > = ( {\n\trenderTooltip,\n\tselectedIndex,\n\ttooltipRef,\n\tkeyboardFocusedClassName,\n\tseries = [],\n\tmode = 'group',\n\t...props\n} ) => {\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst tooltipData = useMemo( () => {\n\t\tif ( mode !== 'individual' ) return [];\n\t\tif ( series.length === 0 ) return [];\n\n\t\tconst maxDataPoints = Math.max( ...series.map( s => s.data.length ) );\n\t\tconst flattened: Array< {\n\t\t\tdatum: DataPointDate;\n\t\t\tseriesLabel: string;\n\t\t\tseriesIndex: number;\n\t\t\tdataPointIndex: number;\n\t\t} > = [];\n\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tfor ( let dataPointIndex = 0; dataPointIndex < maxDataPoints; dataPointIndex++ ) {\n\t\t\tfor ( let seriesIndex = 0; seriesIndex < series.length; seriesIndex++ ) {\n\t\t\t\tconst seriesData = series[ seriesIndex ];\n\t\t\t\tif ( dataPointIndex < seriesData.data.length ) {\n\t\t\t\t\tflattened.push( {\n\t\t\t\t\t\tdatum: seriesData.data[ dataPointIndex ] as DataPointDate,\n\t\t\t\t\t\tseriesLabel: seriesData.label,\n\t\t\t\t\t\tseriesIndex,\n\t\t\t\t\t\tdataPointIndex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn flattened;\n\t}, [ series, mode ] );\n\n\t// Handle tooltip highlighting for keyboard navigation\n\tuseEffect( () => {\n\t\tif ( selectedIndex === undefined ) {\n\t\t\ttooltipContext?.hideTooltip();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( mode === 'group' ) {\n\t\t\t// Show all series at the selected data point index in single tooltip.\n\t\t\tseries.forEach( ( s, index ) => {\n\t\t\t\tif ( selectedIndex < s.data.length ) {\n\t\t\t\t\tconst datum = s.data[ selectedIndex ];\n\n\t\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\t\tdatum,\n\t\t\t\t\t\tkey: s.label,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( mode === 'individual' ) {\n\t\t\t// Show individual tooltips for each datapoint from each series.\n\t\t\tif ( selectedIndex < tooltipData.length ) {\n\t\t\t\tconst tooltipItem = tooltipData[ selectedIndex ];\n\n\t\t\t\ttooltipContext?.showTooltip( {\n\t\t\t\t\tdatum: tooltipItem.datum,\n\t\t\t\t\tkey: tooltipItem.seriesLabel,\n\t\t\t\t\tindex: tooltipItem.seriesIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Don't include tooltipContext in the dependency array to avoid loop.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ selectedIndex, tooltipData, series ] );\n\n\t// Create a focusable renderTooltip that includes accessibility features\n\tconst focusableRenderTooltip = useMemo( () => {\n\t\tif ( ! renderTooltip ) return undefined;\n\n\t\treturn ( params: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst tooltipContent = renderTooltip( params );\n\n\t\t\tif ( selectedIndex !== undefined ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ tooltipRef }\n\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\trole=\"tooltip\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName={ keyboardFocusedClassName }\n\t\t\t\t\t\tdata-testid={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t\tkey={ `chart-tooltip-${ selectedIndex }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div role=\"tooltip\" aria-live=\"polite\">\n\t\t\t\t\t{ tooltipContent }\n\t\t\t\t</div>\n\t\t\t);\n\t\t};\n\t}, [ renderTooltip, selectedIndex, tooltipRef, keyboardFocusedClassName ] );\n\n\treturn <Tooltip { ...props } renderTooltip={ focusableRenderTooltip } />;\n};\n\n// Keyboard navigation hook for charts\ninterface UseKeyboardNavigationProps {\n\tselectedIndex: number | undefined;\n\tsetSelectedIndex: ( index: number | undefined ) => void;\n\tisNavigating: boolean;\n\tsetIsNavigating: ( navigating: boolean ) => void;\n\tchartRef: React.RefObject< HTMLDivElement >;\n\t/**\n\t * Total number of navigation points (length of tooltip data array)\n\t */\n\ttotalPoints: number;\n}\n\nexport const useKeyboardNavigation = ( {\n\tselectedIndex,\n\tsetSelectedIndex,\n\tisNavigating,\n\tsetIsNavigating,\n\tchartRef,\n\ttotalPoints,\n}: UseKeyboardNavigationProps ) => {\n\t// Focus the tooltip as soon as it is rendered\n\tconst tooltipRef = useCallback(\n\t\t( element: HTMLDivElement | null ) => {\n\t\t\tif ( element && selectedIndex !== undefined ) {\n\t\t\t\telement.focus();\n\t\t\t}\n\t\t},\n\t\t[ selectedIndex ]\n\t);\n\n\t// On each focus of chart, reset the selectedIndex to 0, if keyboard navigation is not already active\n\tconst onChartFocus = useCallback( () => {\n\t\tif ( ! isNavigating && selectedIndex !== undefined ) {\n\t\t\tsetSelectedIndex( 0 );\n\t\t}\n\t}, [ isNavigating, selectedIndex, setSelectedIndex ] );\n\n\t// On each blur of chart, keyboard navigation should restart from first tooltip\n\tconst onChartBlur = useCallback( () => {\n\t\tsetIsNavigating( false );\n\t}, [ setIsNavigating ] );\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( totalPoints === 0 ) return;\n\n\t\t\t// Keep focus on the chart if tab is pressed\n\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst currentSelectedIndex = selectedIndex === undefined ? -1 : selectedIndex;\n\n\t\t\tif ( currentSelectedIndex + 1 >= totalPoints && [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tchartRef.current?.focus();\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( [ 'ArrowRight' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex + 1 ) % totalPoints );\n\t\t\t} else if ( [ 'ArrowLeft' ].includes( event.key ) ) {\n\t\t\t\tsetIsNavigating( true );\n\t\t\t\tsetSelectedIndex( ( currentSelectedIndex - 1 + totalPoints ) % totalPoints );\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\tsetIsNavigating( false );\n\t\t\t\tchartRef.current?.focus();\n\t\t\t}\n\t\t},\n\t\t[ totalPoints, selectedIndex, setSelectedIndex, setIsNavigating, chartRef ]\n\t);\n\n\treturn {\n\t\ttooltipRef,\n\t\tonChartFocus,\n\t\tonChartBlur,\n\t\tonChartKeyDown,\n\t};\n};\n\n// Re-export the base Tooltip for backwards compatibility\nexport { Tooltip };\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';\n","import type { FC, PropsWithChildren } from 'react';\n\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML: FC< PropsWithChildren > = ( { children } ) => {\n\t// This component doesn't render directly - its children are extracted by the parent chart\n\t// We just return the children as-is\n\treturn <>{ children }</>;\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';\n","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n","import { Stack } from '@wordpress/ui';\nimport { useEffect } from 'react';\nimport { useElementSize } from '../../../hooks';\nimport { renderLegendSlot } from '../chart-composition';\nimport styles from './chart-layout.module.scss';\nimport type { GapSize, LegendPosition } from '../../../types';\nimport type { LegendChild } from '../chart-composition/use-chart-children';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Measurements provided to the render prop when ChartLayout handles resize listening.\n */\nexport interface ContentMeasurements {\n\t/** Measured width of the content area in pixels */\n\tcontentWidth: number;\n\t/** Measured height of the content area in pixels */\n\tcontentHeight: number;\n\t/** True when a non-zero contentHeight measurement is available */\n\tisMeasured: boolean;\n}\n\nexport interface ChartLayoutProps {\n\t/** Position for the prop-based legend element */\n\tlegendPosition: LegendPosition;\n\t/** The legend element rendered via the showLegend prop (false when hidden) */\n\tlegendElement?: ReactNode;\n\t/** Legend children from the composition API */\n\tlegendChildren: LegendChild[];\n\t/** Chart content — either a ReactNode or a render prop receiving content measurements */\n\tchildren: ReactNode | ( ( measurements: ContentMeasurements ) => ReactNode );\n\t/** Content rendered after the bottom legend (e.g., nonLegendChildren, htmlChildren, tooltips) */\n\ttrailingContent?: ReactNode;\n\t/** Called when the measured content height changes (for render-prop mode) */\n\tonContentHeightChange?: ( height: number ) => void;\n\t/** Gap between Stack items */\n\tgap?: GapSize;\n\t/** Additional class names */\n\tclassName?: string;\n\t/** Inline styles (width, height, etc.) */\n\tstyle?: CSSProperties;\n\t/** Test ID for the container */\n\t'data-testid'?: string;\n\t/** Chart ID attribute */\n\t'data-chart-id'?: string;\n}\n\nexport const ChartLayout = ( {\n\tlegendPosition,\n\tlegendElement,\n\tlegendChildren,\n\tchildren,\n\ttrailingContent,\n\tonContentHeightChange,\n\tgap,\n\tclassName,\n\tstyle,\n\t'data-testid': dataTestId,\n\t'data-chart-id': dataChartId,\n}: ChartLayoutProps ) => {\n\tconst [ contentRef, contentWidth, contentHeight ] = useElementSize< HTMLDivElement >();\n\tconst isRenderProp = typeof children === 'function';\n\tconst isMeasured = contentHeight > 0;\n\n\t// When using render-prop children, hide the layout until measurement is available\n\t// to prevent layout shift. Plain ReactNode children don't need this since they\n\t// don't depend on measured dimensions.\n\tconst visibilityStyle: { visibility?: 'hidden' | 'visible' } =\n\t\tisRenderProp && ! isMeasured ? { visibility: 'hidden' } : {};\n\n\tuseEffect( () => {\n\t\tif ( isRenderProp && onContentHeightChange && isMeasured ) {\n\t\t\tonContentHeightChange( contentHeight );\n\t\t}\n\t}, [ isRenderProp, contentHeight, isMeasured, onContentHeightChange ] );\n\tconst renderedChildren = isRenderProp\n\t\t? children( { contentWidth, contentHeight, isMeasured } )\n\t\t: children;\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={ gap }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { ...style, ...visibilityStyle } }\n\t\t\tdata-testid={ dataTestId }\n\t\t\tdata-chart-id={ dataChartId }\n\t\t>\n\t\t\t{ legendPosition === 'top' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'top' ) }\n\n\t\t\t{ isRenderProp ? (\n\t\t\t\t<div ref={ contentRef } className={ styles[ 'chart-layout__content' ] }>\n\t\t\t\t\t{ renderedChildren }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\trenderedChildren\n\t\t\t) }\n\n\t\t\t{ legendPosition === 'bottom' && legendElement }\n\t\t\t{ renderLegendSlot( legendChildren, 'bottom' ) }\n\n\t\t\t{ trailingContent }\n\t\t</Stack>\n\t);\n};\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { RenderLineGlyphProps } from '../../line-chart';\n\nexport const DefaultGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\tconst { theme } = useContext( DataContext ) || {};\n\tconst position = props.position || 'start';\n\n\treturn (\n\t\t<circle\n\t\t\tcx={ props.x }\n\t\t\tcy={ props.y }\n\t\t\tr={ props.size }\n\t\t\tfill={ props.color }\n\t\t\tstroke={ theme?.backgroundColor }\n\t\t\tstrokeWidth={ 1.5 }\n\t\t\tpaintOrder=\"fill\"\n\t\t\tdata-testid={ `${ position }-glyph-${ props.index }` }\n\t\t\t{ ...props.glyphStyle }\n\t\t/>\n\t);\n};\n","import { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { forwardRef, type ComponentPropsWithoutRef } from 'react';\nimport styles from './center.module.scss';\n\nexport type CenterProps = ComponentPropsWithoutRef< typeof Stack >;\n\n/**\n * Centers its children on both axes and fills its parent.\n *\n * A thin wrapper around `Stack` with `align=\"center\"` and `justify=\"center\"`\n * defaults (both overridable) plus `width: 100%; height: 100%`. Reads more\n * honestly than a `Stack` with both axes centered, and lets call sites drop\n * ad-hoc `*__centering` classes. Forwards its ref and spreads remaining props\n * onto the underlying `Stack`.\n *\n * @param props - Stack props; `align`/`justify` default to `\"center\"`.\n * @param ref - Forwarded to the underlying element.\n * @return The centered layout element.\n */\nexport const Center = forwardRef< HTMLDivElement, CenterProps >(\n\t( { align = 'center', justify = 'center', className, ...props }, ref ) => (\n\t\t<Stack\n\t\t\tref={ ref }\n\t\t\talign={ align }\n\t\t\tjustify={ justify }\n\t\t\tclassName={ clsx( styles.center, className ) }\n\t\t\t{ ...props }\n\t\t/>\n\t)\n);\n\nCenter.displayName = 'Center';\n","import { Center } from '../center';\nimport styles from './svg-empty-state.module.scss';\nimport type { FC, ReactNode } from 'react';\n\ninterface SvgEmptyStateProps {\n\t/** X coordinate of the center point */\n\tx: number;\n\t/** Y coordinate of the center point */\n\ty: number;\n\t/** Available width for the text area */\n\twidth: number;\n\t/** Available height for the text area */\n\theight: number;\n\t/** Text content */\n\tchildren: ReactNode;\n}\n\n/**\n * Renders empty-state text inside an SVG using foreignObject so that the\n * message wraps onto multiple lines instead of being clipped.\n *\n * The component centers the text within the specified area.\n *\n * @param root0 - Component props\n * @param root0.x - X coordinate of the center point\n * @param root0.y - Y coordinate of the center point\n * @param root0.width - Available width for the text area\n * @param root0.height - Available height for the text area\n * @param root0.children - Text content\n * @return {JSX.Element} A foreignObject element containing the centered text.\n */\nexport const SvgEmptyState: FC< SvgEmptyStateProps > = ( { x, y, width, height, children } ) => {\n\treturn (\n\t\t<foreignObject x={ x - width / 2 } y={ y - height / 2 } width={ width } height={ height }>\n\t\t\t<Center className={ styles[ 'svg-empty-state' ] }>{ children }</Center>\n\t\t</foreignObject>\n\t);\n};\n","import { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { scaleTime } from '@visx/scale';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport type { useChartDataTransform } from '../../hooks';\nimport type { CurveType } from '../line-chart/types';\n\n// Approximate min pixel width for an x-axis tick label.\nconst X_TICK_WIDTH = 60;\n\n// Resolve the visx curve generator for a given `curveType` / `smoothing`\n// combination. Shared by LineChart and AreaChart so the two render\n// identically when given the same props.\n//\n// Explicit return type avoids a TS2742 portable-name error in the .d.ts\n// build: the inferred type traces back to `@types/d3-shape` (a transitive\n// dep), but `typeof curveLinear` resolves through `@visx/curve` which we\n// own directly.\nexport const getCurveType = ( type?: CurveType, smoothing?: boolean ): typeof curveLinear => {\n\tif ( ! type ) {\n\t\treturn smoothing ? curveCatmullRom : curveLinear;\n\t}\n\n\tswitch ( type ) {\n\t\tcase 'smooth':\n\t\t\treturn curveCatmullRom;\n\t\tcase 'monotone':\n\t\t\treturn curveMonotoneX;\n\t\tcase 'linear':\n\t\t\treturn curveLinear;\n\t\tdefault:\n\t\t\treturn curveLinear;\n\t}\n};\n\nconst formatYearTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, { year: 'numeric' } );\n};\n\nconst formatDateTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, { month: 'short', day: 'numeric' } );\n};\n\nconst formatHourTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleTimeString( undefined, { hour: 'numeric', hour12: true } );\n};\n\n// Pick the most informative tick formatter for the data's time span: hours\n// within a day, calendar dates within a year, otherwise just years.\nexport const getFormatter = ( sortedData: ReturnType< typeof useChartDataTransform > ) => {\n\tconst minX = Math.min( ...sortedData.map( datom => datom.data.at( 0 )?.date ) );\n\tconst maxX = Math.max( ...sortedData.map( datom => datom.data.at( -1 )?.date ) );\n\n\tconst diffInHours = Math.abs( differenceInHours( maxX, minX ) );\n\tif ( diffInHours <= 24 ) {\n\t\treturn formatHourTick;\n\t}\n\n\tconst diffInYears = Math.abs( differenceInYears( maxX, minX ) );\n\tif ( diffInYears <= 1 ) {\n\t\treturn formatDateTick;\n\t}\n\n\treturn formatYearTick;\n};\n\n// Estimate the largest number of x-axis ticks that fit without producing\n// consecutive duplicate labels under the given formatter. Used so the axis\n// adapts to the data's resolution rather than picking a fixed count.\nexport const guessOptimalNumTicks = (\n\tdata: ReturnType< typeof useChartDataTransform >,\n\tchartWidth: number,\n\ttickFormatter: ( timestamp: number, index?: number, values?: unknown ) => string\n) => {\n\tconst minX = Math.min( ...data.map( datom => datom.data.at( 0 )?.date ) );\n\tconst maxX = Math.max( ...data.map( datom => datom.data.at( -1 )?.date ) );\n\tconst xScale = scaleTime( { domain: [ minX, maxX ] } );\n\n\tconst upperBound = Math.min(\n\t\tdata[ 0 ]?.data.length || 3,\n\t\tMath.ceil( chartWidth / X_TICK_WIDTH )\n\t);\n\tlet secondBestGuess = 1;\n\n\tfor ( let numTicks = upperBound; numTicks > 1; --numTicks ) {\n\t\tconst ticks = xScale.ticks( numTicks ).map( d => tickFormatter( d.getTime() ) );\n\n\t\tif ( ticks.length > upperBound ) continue;\n\n\t\tsecondBestGuess = Math.max( secondBestGuess, ticks.length );\n\n\t\tconst uniqueTicks = Array.from( new Set( ticks ) );\n\t\tif ( uniqueTicks.length === 1 ) return 1;\n\n\t\tconst hasConsecutiveDuplicate = ticks.some(\n\t\t\t( tick, idx ) => idx > 0 && tick === ticks[ idx - 1 ]\n\t\t);\n\t\tif ( hasConsecutiveDuplicate ) continue;\n\n\t\treturn ticks.length;\n\t}\n\n\treturn secondBestGuess;\n};\n","import { useParentSize } from '@visx/responsive';\nimport styles from './with-responsive.module.scss';\nimport type { BaseChartProps } from '../../../types';\nimport type { ComponentType } from 'react';\n\ntype DimensionProps = {\n\twidth?: number;\n\theight?: number;\n\tsize?: number;\n};\n\nexport type ResponsiveConfig = {\n\t/**\n\t * The maximum width of the chart. Defaults to 1200.\n\t */\n\tmaxWidth?: number;\n\t/**\n\t * The aspect ratio of the chart (height = width * aspectRatio).\n\t * When provided, height is calculated from width.\n\t * When omitted, the chart fills the parent container's height.\n\t */\n\taspectRatio?: number;\n\t/**\n\t * Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.\n\t */\n\tresizeDebounceTime?: number;\n};\n\nconst useResponsiveDimensions = ( {\n\tresizeDebounceTime = 300,\n\tmaxWidth = 1200,\n\taspectRatio,\n}: ResponsiveConfig ) => {\n\tconst {\n\t\tparentRef,\n\t\twidth: parentWidth,\n\t\theight: parentHeight,\n\t} = useParentSize( {\n\t\tdebounceTime: resizeDebounceTime,\n\t\tenableDebounceLeadingCall: true,\n\t} );\n\n\tconst containerWidth = parentWidth > 0 ? Math.min( parentWidth, maxWidth ) : 0;\n\tconst containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n\n\treturn {\n\t\tparentRef,\n\t\twidth: containerWidth,\n\t\theight: containerHeight,\n\t\t/**\n\t\t * Whether an aspectRatio was provided. Used to determine container\n\t\t * height styling: 'auto' when true (height derived from width),\n\t\t * '100%' when false (fill parent container).\n\t\t */\n\t\thasAspectRatio: aspectRatio !== undefined,\n\t};\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive< T extends Exclude< BaseChartProps< unknown >, 'options' > >( // 'options' is excluded so that each chart can define its own options type\n\tWrappedComponent: ComponentType< T >\n) {\n\treturn function ResponsiveChart( {\n\t\tresizeDebounceTime = 300,\n\t\tmaxWidth = 1200,\n\t\taspectRatio,\n\t\tsize,\n\t\twidth,\n\t\theight,\n\t\t...chartProps\n\t}: Omit< T, 'width' | 'height' | 'size' > & DimensionProps & ResponsiveConfig ) {\n\t\tconst {\n\t\t\tparentRef,\n\t\t\twidth: measuredWidth,\n\t\t\theight: measuredHeight,\n\t\t\thasAspectRatio,\n\t\t} = useResponsiveDimensions( {\n\t\t\tresizeDebounceTime,\n\t\t\tmaxWidth,\n\t\t\taspectRatio,\n\t\t} );\n\n\t\t// Use measured dimensions, but fall back to explicit width/height props if measurement returns 0\n\t\t// (e.g., during initial render or in test environments without DOM measurement).\n\t\t// Do not use size here — size controls chart element dimensions (e.g. pie diameter), not container dimensions.\n\t\tconst effectiveWidth = measuredWidth || width || 0;\n\t\tconst effectiveHeight = measuredHeight || height || 0;\n\n\t\tconst defaultHeight = hasAspectRatio ? 'auto' : '100%';\n\t\t// Express the aspect ratio in CSS so the container height tracks its width\n\t\t// fluidly, rather than snapping to a debounced measured height. Cap the width\n\t\t// at maxWidth so the CSS-derived height matches the maxWidth-capped content\n\t\t// (the wrapped chart is sized from the capped `measuredWidth`).\n\t\tconst aspectRatioStyle =\n\t\t\thasAspectRatio && aspectRatio\n\t\t\t\t? {\n\t\t\t\t\t\taspectRatio: `${ 1 / aspectRatio }`,\n\t\t\t\t\t\tmaxWidth: width === undefined ? maxWidth : undefined,\n\t\t\t\t }\n\t\t\t\t: null;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ parentRef }\n\t\t\t\tdata-testid=\"responsive-wrapper\"\n\t\t\t\tclassName={ styles.container }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: width ?? '100%',\n\t\t\t\t\theight: height ?? defaultHeight,\n\t\t\t\t\t...aspectRatioStyle,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WrappedComponent\n\t\t\t\t\twidth={ effectiveWidth }\n\t\t\t\t\theight={ effectiveHeight }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\t{ ...( chartProps as T ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n}\n","import { DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport styles from './x-zoom.module.scss';\nimport type { SingleChartRef } from './single-chart-context';\nimport type { AxisScale } from '@visx/axis';\nimport type { EventHandlerParams } from '@visx/xychart';\nimport type { ReactNode, RefObject } from 'react';\n\nconst MIN_DRAG_PIXELS = 6;\n\ntype Drag = { a: number; b: number };\ntype PointerHandler = ( params: EventHandlerParams< object > ) => void;\n\n/**\n * Drag-to-zoom state + pointer handlers for an XY chart. Designed to be\n * embedded in a chart parent: the parent owns the result, spreads the\n * `domain` into its `xScale.domain` config, and renders the selection\n * rect and reset button this returns.\n *\n * The X scale `.invert()` is read lazily from the chart's existing\n * `internalChartRef.getScales()` at commit time, so no DataContext access\n * is required from the parent.\n *\n * @param params - Hook params.\n * @param params.enabled - When false, the hook becomes a passthrough.\n * @param params.chartRef - Chart's internal scales ref.\n * @param params.userHandlers - User-supplied pointer handlers to chain.\n * @param params.userHandlers.onPointerDown - Forwarded user pointerdown handler.\n * @param params.userHandlers.onPointerMove - Forwarded user pointermove handler.\n * @param params.userHandlers.onPointerUp - Forwarded user pointerup handler.\n * @return An object with `domain`, `drag`, `reset`, and chained `handlers`.\n */\nexport function useXZoom< T extends Date | number = Date >( {\n\tenabled,\n\tchartRef,\n\tuserHandlers,\n}: {\n\tenabled: boolean;\n\tchartRef: RefObject< SingleChartRef | null >;\n\tuserHandlers?: {\n\t\tonPointerDown?: PointerHandler;\n\t\tonPointerMove?: PointerHandler;\n\t\tonPointerUp?: PointerHandler;\n\t};\n} ) {\n\tconst [ domain, setDomain ] = useState< [ T, T ] | null >( null );\n\tconst [ drag, setDrag ] = useState< Drag | null >( null );\n\n\tconst reset = useCallback( () => setDomain( null ), [] );\n\n\tconst onPointerDown = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerDown?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( { a: params.svgPoint.x, b: params.svgPoint.x } );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerMove = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerMove?.( params );\n\t\t\tif ( ! enabled || ! params.svgPoint ) return;\n\t\t\tsetDrag( current => ( current ? { a: current.a, b: params.svgPoint!.x } : current ) );\n\t\t},\n\t\t[ enabled, userHandlers ]\n\t);\n\n\tconst onPointerUp = useCallback< PointerHandler >(\n\t\tparams => {\n\t\t\tuserHandlers?.onPointerUp?.( params );\n\t\t\tif ( ! enabled ) return;\n\t\t\tconst finalDrag = drag;\n\t\t\tsetDrag( null );\n\t\t\tif ( ! finalDrag ) return;\n\t\t\tconst lo = Math.min( finalDrag.a, finalDrag.b );\n\t\t\tconst hi = Math.max( finalDrag.a, finalDrag.b );\n\t\t\tif ( hi - lo < MIN_DRAG_PIXELS ) return;\n\t\t\tconst xScale = chartRef.current?.getScales()?.xScale as\n\t\t\t\t| ( AxisScale & { invert?: ( v: number ) => T } )\n\t\t\t\t| undefined;\n\t\t\tif ( ! xScale || typeof xScale.invert !== 'function' ) return;\n\t\t\tsetDomain( [ xScale.invert( lo ), xScale.invert( hi ) ] );\n\t\t},\n\t\t[ enabled, drag, chartRef, userHandlers ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tdomain,\n\t\t\tdrag,\n\t\t\treset,\n\t\t\thandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} ),\n\t\t[ domain, drag, reset, onPointerDown, onPointerMove, onPointerUp ]\n\t);\n}\n\n/**\n * Live selection rectangle drawn inside `<XYChart>` while the user is\n * dragging. Reads plot dimensions from visx's `DataContext`.\n *\n * @param props - Props.\n * @param props.drag - Current drag, or null when idle.\n * @return JSX or null.\n */\nexport function ZoomSelectionRect( { drag }: { drag: Drag | null } ) {\n\tconst { margin, innerHeight } = useContext( DataContext );\n\tif ( ! drag || drag.a === drag.b ) return null;\n\tconst x = Math.min( drag.a, drag.b );\n\tconst w = Math.abs( drag.b - drag.a );\n\treturn (\n\t\t<rect\n\t\t\tclassName={ styles[ 'x-zoom__selection' ] }\n\t\t\tx={ x }\n\t\t\ty={ margin?.top ?? 0 }\n\t\t\twidth={ w }\n\t\t\theight={ innerHeight ?? 0 }\n\t\t\tdata-testid=\"chart-zoom-selection\"\n\t\t/>\n\t);\n}\n\n/**\n * Wraps a chart's series in a group that is clipped to the inner plot rectangle\n * while `active`. Reads the plot geometry from visx's `DataContext` (the same\n * source as `ZoomSelectionRect`), so the host charts don't compute any margins.\n * The group is always rendered (only its `clip-path` toggles) so toggling zoom\n * never remounts or re-animates the series.\n *\n * @param props - Props.\n * @param props.active - Whether to clip (e.g. `zoomable`, or `zoomable && zoomed`).\n * @param props.chartId - Chart id; used to build a unique clip-path id.\n * @param props.children - The series to clip.\n * @return JSX element.\n */\nexport function ZoomClip( {\n\tactive,\n\tchartId,\n\tchildren,\n}: {\n\tactive: boolean;\n\tchartId?: string;\n\tchildren: ReactNode;\n} ) {\n\tconst { margin, innerWidth, innerHeight } = useContext( DataContext );\n\t// Sanitise the chart id to a valid SVG/CSS id, and keep it unique per chart.\n\tconst id = `chart-zoom-clip-${ String( chartId ?? '' ).replace( /[^A-Za-z0-9_-]/g, '' ) }`;\n\tconst clip = active && ( innerWidth ?? 0 ) > 0 && ( innerHeight ?? 0 ) > 0;\n\treturn (\n\t\t<>\n\t\t\t{ clip && (\n\t\t\t\t<defs>\n\t\t\t\t\t<clipPath id={ id } data-testid=\"chart-zoom-clip\">\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tx={ margin?.left ?? 0 }\n\t\t\t\t\t\t\ty={ margin?.top ?? 0 }\n\t\t\t\t\t\t\twidth={ innerWidth }\n\t\t\t\t\t\t\theight={ innerHeight }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t) }\n\t\t\t<g clipPath={ clip ? `url(#${ id })` : undefined } data-testid=\"chart-series-clip-group\">\n\t\t\t\t{ children }\n\t\t\t</g>\n\t\t</>\n\t);\n}\n\n/**\n * Visible icon-only reset button rendered as an HTML overlay on top of\n * the chart container. The host should wrap its SVG in a `position: relative`\n * container so the button anchors correctly.\n *\n * @param props - Props.\n * @param props.onClick - Click handler. Typically the `reset` from `useXZoom`.\n * @return JSX element.\n */\nexport function ZoomResetButton( { onClick }: { onClick: () => void } ) {\n\tconst label = __( 'Reset zoom', 'jetpack-charts' );\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={ styles[ 'x-zoom__reset' ] }\n\t\t\tonClick={ onClick }\n\t\t\taria-label={ label }\n\t\t\ttitle={ label }\n\t\t\tdata-testid=\"chart-zoom-reset\"\n\t\t>\n\t\t\t<svg\n\t\t\t\tclassName={ styles[ 'x-zoom__reset-icon' ] }\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tfocusable=\"false\"\n\t\t\t>\n\t\t\t\t<circle cx=\"10\" cy=\"10\" r=\"6\" />\n\t\t\t\t<line x1=\"15\" y1=\"15\" x2=\"20\" y2=\"20\" />\n\t\t\t\t<line x1=\"7\" y1=\"10\" x2=\"13\" y2=\"10\" />\n\t\t\t</svg>\n\t\t</button>\n\t);\n}\n","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useSingleChartContext } from '../../private/single-chart-context';\nimport styles from '../line-chart.module.scss';\nimport type { AxisScale } from '@visx/axis';\nimport type { FC, ReactNode } from 'react';\n\nexport interface LineChartAnnotationsProps {\n\tchildren?: ReactNode;\n}\n\ninterface ScaleData {\n\txScale: AxisScale< Date >;\n\tyScale: AxisScale< number >;\n}\n\nconst LineChartAnnotationsOverlay: FC< LineChartAnnotationsProps > = ( { children } ) => {\n\tconst { chartRef, chartWidth, chartHeight } = useSingleChartContext();\n\n\tconst [ scales, setScales ] = useState< ScaleData | null >( null );\n\tconst [ scalesStable, setScalesStable ] = useState< boolean >( false );\n\n\t// Create a signature for scale data to enable easy comparison\n\tconst createScaleSignature = useCallback( ( scaleData: ScaleData ) => {\n\t\tconst xDomain = scaleData.xScale.domain();\n\t\tconst yDomain = scaleData.yScale.domain();\n\t\tconst xRange = scaleData.xScale.range();\n\t\tconst yRange = scaleData.yScale.range();\n\n\t\treturn `${ xDomain.join( ',' ) }-${ yDomain.join( ',' ) }-${ xRange.join(\n\t\t\t','\n\t\t) }-${ yRange.join( ',' ) }`;\n\t}, [] );\n\n\t// Get scales from chart ref and return them with signature for comparison\n\tconst getScalesData = useCallback( () => {\n\t\tif ( chartRef?.current ) {\n\t\t\tconst scaleData = chartRef.current.getScales();\n\n\t\t\tif ( scaleData ) {\n\t\t\t\tconst scaleInfo = {\n\t\t\t\t\txScale: scaleData.xScale as AxisScale< Date >,\n\t\t\t\t\tyScale: scaleData.yScale as AxisScale< number >,\n\t\t\t\t};\n\n\t\t\t\treturn {\n\t\t\t\t\tscales: scaleInfo,\n\t\t\t\t\tsignature: createScaleSignature( scaleInfo ),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}, [ chartRef, createScaleSignature ] );\n\n\t// The chart resizes on render so we need to monitor the scales until they stabilize\n\tuseEffect( () => {\n\t\tlet timeoutId: number | null = null;\n\t\tlet lastSignature: string | null = null;\n\t\tlet retryCount = 0;\n\t\tconst maxRetries = 20; // 20 * 50ms = 1 second max\n\t\tconst checkInterval = 50; // Check every 50ms\n\n\t\t// Reset stability state when monitoring starts\n\t\tsetScalesStable( false );\n\n\t\tconst monitorScales = () => {\n\t\t\tconst currentScaleData = getScalesData();\n\n\t\t\t// If we got scales, compare signatures\n\t\t\tif ( currentScaleData ) {\n\t\t\t\t// Check if scales have settled by comparing signatures\n\t\t\t\tconst scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n\n\t\t\t\tif ( scalesSettled ) {\n\t\t\t\t\t// Scales have stabilized, mark as stable\n\t\t\t\t\tsetScalesStable( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update scales and remember signature for next comparison\n\t\t\t\tsetScales( currentScaleData.scales );\n\t\t\t\tlastSignature = currentScaleData.signature;\n\t\t\t}\n\n\t\t\t// Continue monitoring if we haven't exceeded max retries\n\t\t\tif ( retryCount < maxRetries ) {\n\t\t\t\tretryCount++;\n\t\t\t\ttimeoutId = setTimeout( monitorScales, checkInterval ) as unknown as number;\n\t\t\t}\n\t\t};\n\n\t\tmonitorScales();\n\n\t\treturn () => {\n\t\t\tif ( timeoutId ) {\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t}\n\t\t};\n\t}, [ getScalesData, chartWidth, chartHeight ] );\n\n\tif ( ! chartRef || ! children || ! chartWidth || ! chartHeight ) {\n\t\treturn null;\n\t}\n\n\tif ( ! scales || ! scalesStable ) {\n\t\treturn null;\n\t}\n\n\t// Create a DataContext value that mimics what visx provides\n\t// We're intentionally providing minimal context for annotations to work\n\tconst dataContextValue = {\n\t\txScale: scales.xScale,\n\t\tyScale: scales.yScale,\n\t\tmargin: { top: 0, right: 0, bottom: 0, left: 0 },\n\t\twidth: chartWidth,\n\t\theight: chartHeight,\n\t} as unknown as Parameters< typeof DataContext.Provider >[ 0 ][ 'value' ];\n\n\treturn (\n\t\t<DataContext.Provider value={ dataContextValue }>\n\t\t\t<svg\n\t\t\t\twidth={ chartWidth }\n\t\t\t\theight={ chartHeight }\n\t\t\t\tclassName={ styles[ 'line-chart__annotations-overlay' ] }\n\t\t\t\tdata-testid=\"line-chart-annotations-overlay\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</svg>\n\t\t</DataContext.Provider>\n\t);\n};\n\nexport default LineChartAnnotationsOverlay;\n","import { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport type { ButtonWithPopover, PopoverElement, ToggleEvent } from '../../../types';\nimport type { FC } from 'react';\n\nexport const POPOVER_BUTTON_SIZE = 44;\n\nconst CloseIcon = () => (\n\t<svg\n\t\twidth=\"16\"\n\t\theight=\"16\"\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\taria-hidden=\"true\"\n\t\tfocusable=\"false\"\n\t>\n\t\t<path d=\"M6 6l12 12M18 6L6 18\" />\n\t</svg>\n);\n\ninterface LineChartAnnotationLabelWithPopoverProps {\n\ttitle: string;\n\tsubtitle?: string;\n\trenderLabel: FC< { title: string; subtitle?: string } >;\n\trenderLabelPopover: FC< { title: string; subtitle?: string } >;\n}\n\nconst LineChartAnnotationLabelWithPopover: FC< LineChartAnnotationLabelWithPopoverProps > = ( {\n\ttitle,\n\tsubtitle,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst popoverId = useId();\n\tconst buttonRef = useRef< HTMLButtonElement >( null );\n\tconst popoverRef = useRef< HTMLDivElement >( null );\n\tconst [ isPositioned, setIsPositioned ] = useState( false );\n\tconst isBrowserSafari = isSafari();\n\n\tuseEffect( () => {\n\t\tconst button = buttonRef.current;\n\t\tconst popover = popoverRef.current;\n\n\t\tif ( ! button || ! popover ) return;\n\n\t\tconst positionPopover = () => {\n\t\t\t// Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n\t\t\tif ( ! isBrowserSafari ) {\n\t\t\t\tconst buttonRect = button.getBoundingClientRect();\n\t\t\t\tpopover.style.left = `${ buttonRect.right }px`;\n\t\t\t\tpopover.style.top = `${ buttonRect.top }px`;\n\t\t\t}\n\n\t\t\tsetIsPositioned( true );\n\t\t};\n\n\t\t// Position when popover shows\n\t\tpopover.addEventListener( 'toggle', ( e: ToggleEvent ) => {\n\t\t\tif ( e.newState === 'open' ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} );\n\n\t\t// Initial positioning if already open\n\t\ttry {\n\t\t\tif ( popover.matches( ':popover-open' ) ) {\n\t\t\t\tpositionPopover();\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n\t\t}\n\t}, [ isBrowserSafari ] );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__annotation-label' ] }>\n\t\t\t<button\n\t\t\t\tref={ buttonRef }\n\t\t\t\t{ ...( { popovertarget: popoverId } as ButtonWithPopover ) }\n\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-trigger-button' ] }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\theight: `${ POPOVER_BUTTON_SIZE }px`,\n\t\t\t\t\ttransform: `translate(${ POPOVER_BUTTON_SIZE / 2 }px, 0)`,\n\t\t\t\t} }\n\t\t\t\taria-label={ title || __( 'View details', 'jetpack-charts' ) }\n\t\t\t>\n\t\t\t\t{ renderLabel( { title, subtitle } ) }\n\t\t\t</button>\n\t\t\t<div\n\t\t\t\tref={ popoverRef }\n\t\t\t\tid={ popoverId }\n\t\t\t\t{ ...( { popover: 'auto' } as PopoverElement ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'line-chart__annotation-label-popover' ],\n\t\t\t\t\tisPositioned && styles[ 'line-chart__annotation-label-popover--visible' ],\n\t\t\t\t\tisBrowserSafari && styles[ 'line-chart__annotation-label-popover--safari' ]\n\t\t\t\t) }\n\t\t\t\tdata-testid=\"line-chart-annotation-label-popover\"\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"flex-start\" justify=\"space-between\">\n\t\t\t\t\t<div className={ styles[ 'line-chart__annotation-label-popover-content' ] }>\n\t\t\t\t\t\t{ renderLabelPopover( { title, subtitle } ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...( {\n\t\t\t\t\t\t\tpopovertarget: popoverId,\n\t\t\t\t\t\t\tpopovertargetaction: 'hide',\n\t\t\t\t\t\t} as ButtonWithPopover ) }\n\t\t\t\t\t\tclassName={ styles[ 'line-chart__annotation-label-popover-close-button' ] }\n\t\t\t\t\t\taria-label={ __( 'Close', 'jetpack-charts' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CloseIcon />\n\t\t\t\t\t</button>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default LineChartAnnotationLabelWithPopover;\n","import {\n\tAnnotation,\n\tCircleSubject,\n\tConnector,\n\tHtmlLabel,\n\tLabel,\n\tLineSubject,\n} from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { isSafari, resolveCssVariable } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, {\n\tPOPOVER_BUTTON_SIZE,\n} from './line-chart-annotation-label-popover';\nimport type { LineChartAnnotationProps } from '../types';\nimport type { LabelProps } from '@visx/annotation';\nimport type { TextProps } from '@visx/text';\nimport type { FC } from 'react';\n\ntype SubjectType = 'circle' | 'line-vertical' | 'line-horizontal';\n\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\n\nexport const getLabelPosition = ( {\n\tsubjectType,\n\tx,\n\txMax,\n\ty,\n\tyMin,\n\tyMax,\n\tmaxWidth,\n\theight,\n}: {\n\tsubjectType: SubjectType;\n\tx: number;\n\txMax: number;\n\ty: number;\n\tyMin: number;\n\tyMax: number;\n\tmaxWidth?: number;\n\theight?: number | null;\n} ): {\n\tdx: number;\n\tdy: number;\n\tisFlippedHorizontally: boolean;\n\tisFlippedVertically: boolean;\n} => {\n\tconst annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n\tconst annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n\tlet dx = 15;\n\tlet dy = 15;\n\tlet isFlippedHorizontally = false;\n\tlet isFlippedVertically = false;\n\n\tif ( subjectType === 'line-horizontal' ) {\n\t\tdx = 0;\n\t\tdy = 20;\n\t}\n\n\tif ( subjectType === 'line-vertical' ) {\n\t\tdx = 20;\n\t\tdy = 0;\n\t}\n\n\t// Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n\t// Account for the connector offset (dx) in boundary calculations\n\tconst effectiveX = x + dx;\n\n\tif ( effectiveX + annotationMaxWidth > xMax ) {\n\t\tisFlippedHorizontally = true;\n\n\t\tif ( subjectType === 'circle' ) {\n\t\t\tdx = -dx; // Just flip to the left side with same offset\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tdx = -20; // Position to the left of the line\n\t\t}\n\t}\n\n\t// Smart vertical positioning: check both top and bottom edges\n\t// For circle annotations, they are positioned below by default (dy > 0)\n\t// Only flip when close to bottom edge to position above\n\tif ( subjectType === 'circle' ) {\n\t\t// Check if positioning below would extend beyond bottom edge\n\t\tif ( y + dy + annotationHeight > yMin ) {\n\t\t\t// Too close to bottom edge, position above\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t}\n\t\t// When close to top edge, keep default below positioning (no flip needed)\n\t} else if ( y - annotationHeight < yMax ) {\n\t\t// Too close to top edge, position below\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = Math.abs( dy ); // Ensure positive value to position below the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t} else if ( y + annotationHeight > yMin ) {\n\t\t// Too close to bottom edge, position above\n\t\tif ( subjectType === 'line-horizontal' ) {\n\t\t\tisFlippedVertically = true;\n\t\t\tdy = -Math.abs( dy ); // Ensure negative value to position above the point\n\t\t} else if ( subjectType === 'line-vertical' ) {\n\t\t\tisFlippedVertically = true; // For anchor adjustment only\n\t\t}\n\t}\n\n\treturn { dx, dy, isFlippedHorizontally, isFlippedVertically };\n};\n\nconst getHorizontalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedHorizontally: boolean\n): LabelProps[ 'horizontalAnchor' ] => {\n\tif ( subjectType === 'line-horizontal' ) {\n\t\treturn isFlippedHorizontally ? 'end' : 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst getVerticalAnchor = (\n\tsubjectType: SubjectType,\n\tisFlippedVertically: boolean,\n\ty: number,\n\tyMax: number,\n\theight: number\n): TextProps[ 'verticalAnchor' ] => {\n\tif ( subjectType === 'line-vertical' ) {\n\t\tif ( isFlippedVertically ) {\n\t\t\t// If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n\t\t\treturn y - height < yMax ? 'start' : 'end';\n\t\t}\n\n\t\treturn 'start';\n\t}\n\n\treturn undefined;\n};\n\nconst LineChartAnnotation: FC< LineChartAnnotationProps > = ( {\n\tdatum,\n\ttitle,\n\tsubtitle,\n\tsubjectType = 'circle',\n\tstyles: datumStyles,\n\ttestId,\n\trenderLabel,\n\trenderLabelPopover,\n} ) => {\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst labelRef = useRef< SVGGElement >( null );\n\tconst [ height, setHeight ] = useState< number | null >( null );\n\n\t// Deep merge styles to preserve nested object properties\n\tconst styles = merge( providerTheme.annotationStyles ?? {}, datumStyles ?? {} );\n\n\t// visx annotation parts apply these colors as SVG presentation attributes,\n\t// where CSS var() cannot resolve. Resolve WPDS tokens to concrete values first.\n\tconst resolveColor = ( value?: string ): string | undefined =>\n\t\tvalue ? resolveCssVariable( value ) ?? value : value;\n\n\t// Measure the label height once after initial render\n\tuseEffect( () => {\n\t\tif ( labelRef.current?.getBBox ) {\n\t\t\tconst bbox = labelRef.current.getBBox();\n\t\t\tsetHeight( bbox.height );\n\t\t}\n\t}, [] );\n\n\tconst positionData = useMemo( () => {\n\t\tif ( ! datum || ! datum.date || datum.value == null || ! xScale || ! yScale ) return null;\n\n\t\tconst x = xScale( datum.date );\n\t\tconst y = yScale( datum.value );\n\n\t\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\t\tconst [ yMin, yMax ] = yScale.range().map( Number );\n\t\tconst [ xMin, xMax ] = xScale.range().map( Number );\n\n\t\t// If a custom label is provided, use the provided position\n\t\tif ( renderLabel ) {\n\t\t\treturn {\n\t\t\t\tx,\n\t\t\t\tdx: 0,\n\t\t\t\ty,\n\t\t\t\tdy: 0,\n\t\t\t\tyMin,\n\t\t\t\tyMax,\n\t\t\t\txMin,\n\t\t\t\txMax,\n\t\t\t\tisFlippedHorizontally: false,\n\t\t\t\tisFlippedVertically: false,\n\t\t\t};\n\t\t}\n\n\t\tconst position = getLabelPosition( {\n\t\t\tsubjectType,\n\t\t\tx,\n\t\t\txMax,\n\t\t\ty,\n\t\t\tyMin,\n\t\t\tyMax,\n\t\t\tmaxWidth: styles?.label?.maxWidth,\n\t\t\theight,\n\t\t} );\n\n\t\treturn { x, y, yMin, yMax, xMin, xMax, ...position };\n\t}, [ datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel ] );\n\n\tif ( ! positionData ) return null;\n\n\tconst { x, y, yMin, yMax, xMin, xMax, dx, dy, isFlippedHorizontally, isFlippedVertically } =\n\t\tpositionData;\n\n\tconst getLabelY = () => {\n\t\tconst labelY = styles?.label?.y;\n\n\t\tif ( labelY === 'start' ) return yMax;\n\t\tif ( labelY === 'end' ) return yMin;\n\n\t\treturn labelY;\n\t};\n\n\tconst getLabelX = () => {\n\t\tconst labelX = styles?.label?.x;\n\n\t\tif ( labelX === 'start' ) return xMin;\n\t\tif ( labelX === 'end' ) return xMax;\n\n\t\treturn labelX;\n\t};\n\n\tconst labelPosition = {\n\t\tx: getLabelX(),\n\t\ty: getLabelY(),\n\t};\n\n\t// Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n\t// This is a workaround to position the label correctly\n\tconst getSafariHTMLLabelPosition = () => {\n\t\tconst labelWidth = POPOVER_BUTTON_SIZE;\n\t\tconst labelHeight = POPOVER_BUTTON_SIZE;\n\n\t\treturn isSafari()\n\t\t\t? {\n\t\t\t\t\ttransform: `translate(${\n\t\t\t\t\t\tx +\n\t\t\t\t\t\t( dx || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.x === 'number' ? labelPosition.x - x : 0 ) -\n\t\t\t\t\t\tlabelWidth\n\t\t\t\t\t}px, ${\n\t\t\t\t\t\ty +\n\t\t\t\t\t\t( dy || 0 ) +\n\t\t\t\t\t\t( typeof labelPosition.y === 'number' ? labelPosition.y - y : 0 ) -\n\t\t\t\t\t\tlabelHeight\n\t\t\t\t\t}px)`,\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\theight: labelHeight,\n\t\t\t }\n\t\t\t: undefined;\n\t};\n\n\treturn (\n\t\t<g data-testid={ testId }>\n\t\t\t<Annotation x={ x } y={ y } dx={ dx } dy={ dy }>\n\t\t\t\t<Connector { ...styles?.connector } stroke={ resolveColor( styles?.connector?.stroke ) } />\n\t\t\t\t{ subjectType === 'circle' && (\n\t\t\t\t\t<CircleSubject\n\t\t\t\t\t\t{ ...styles?.circleSubject }\n\t\t\t\t\t\tfill={ resolveColor( styles?.circleSubject?.fill ) }\n\t\t\t\t\t\tstroke={ resolveColor( styles?.circleSubject?.stroke ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-vertical' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ yMax }\n\t\t\t\t\t\tmax={ yMin }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'vertical' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ subjectType === 'line-horizontal' && (\n\t\t\t\t\t<LineSubject\n\t\t\t\t\t\tmin={ xMin }\n\t\t\t\t\t\tmax={ xMax }\n\t\t\t\t\t\t{ ...{ ...styles?.lineSubject, orientation: 'horizontal' } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ renderLabel ? (\n\t\t\t\t\t<HtmlLabel { ...styles?.label } { ...labelPosition }>\n\t\t\t\t\t\t<div style={ getSafariHTMLLabelPosition() }>\n\t\t\t\t\t\t\t{ renderLabelPopover ? (\n\t\t\t\t\t\t\t\t<LineChartAnnotationLabelWithPopover\n\t\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t\t\trenderLabel={ renderLabel }\n\t\t\t\t\t\t\t\t\trenderLabelPopover={ renderLabelPopover }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\trenderLabel( { title, subtitle } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</HtmlLabel>\n\t\t\t\t) : (\n\t\t\t\t\t<g ref={ labelRef }>\n\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\tsubtitle={ subtitle }\n\t\t\t\t\t\t\t{ ...styles?.label }\n\t\t\t\t\t\t\tanchorLineStroke={ resolveColor( styles?.label?.anchorLineStroke ) }\n\t\t\t\t\t\t\tbackgroundFill={ resolveColor( styles?.label?.backgroundFill ) }\n\t\t\t\t\t\t\t{ ...labelPosition }\n\t\t\t\t\t\t\thorizontalAnchor={ getHorizontalAnchor( subjectType, isFlippedHorizontally ) }\n\t\t\t\t\t\t\tverticalAnchor={ getVerticalAnchor(\n\t\t\t\t\t\t\t\tsubjectType,\n\t\t\t\t\t\t\t\tisFlippedVertically,\n\t\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\t\tyMax,\n\t\t\t\t\t\t\t\theight ?? ANNOTATION_INIT_HEIGHT\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t) }\n\t\t\t</Annotation>\n\t\t</g>\n\t);\n};\n\nexport default LineChartAnnotation;\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport type { LineChartGlyphProps } from '../types';\nimport type { FC } from 'react';\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\nconst LineChartGlyph: FC< LineChartGlyphProps > = ( {\n\tdata,\n\tindex,\n\tcolor,\n\tglyphStyle,\n\trenderGlyph,\n\taccessors,\n\tposition,\n} ) => {\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tif ( ! xScale || ! yScale ) return null;\n\n\tif ( data.data.length === 0 ) return null;\n\n\tconst point = position === 'start' ? data.data[ 0 ] : data.data[ data.data.length - 1 ];\n\n\tconst x = xScale( accessors.xAccessor( point ) );\n\tconst y = yScale( accessors.yAccessor( point ) );\n\n\tif ( typeof x !== 'number' || typeof y !== 'number' ) return null;\n\n\tconst size = Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 );\n\n\treturn renderGlyph( {\n\t\tkey: `${ position }-glyph-${ data.label }`,\n\t\tindex,\n\t\tdatum: point,\n\t\tcolor,\n\t\tsize,\n\t\tx,\n\t\ty,\n\t\tglyphStyle,\n\t\tposition,\n\t} );\n};\n\nexport default LineChartGlyph;\n","import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { LinearGradient } from '@visx/gradient';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { attachSubComponents, resolveCssVariable } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { SingleChartContext, type SingleChartRef } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport type { RenderLineGlyphProps, LineChartProps, TooltipDatum } from './types';\nimport type { DataPoint, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { FC, Ref } from 'react';\n\nconst defaultRenderGlyph = < Datum extends object >( props: RenderLineGlyphProps< Datum > ) => {\n\treturn <DefaultGlyph { ...props } key={ props.key } />;\n};\n\nconst toNumber = ( val?: number | string | null ): number | undefined => {\n\tconst num = typeof val === 'number' ? val : parseFloat( val );\n\treturn isNaN( num ) ? undefined : num;\n};\n\n/**\n * Default visx-tooltip render that prints the hovered date as a heading and\n * one row per visible series (label + formatted value), sorted descending by\n * value. Reused by AreaChart, which has the same multi-series shape.\n *\n * @param params - visx `RenderTooltipParams< DataPointDate >`.\n * @return Tooltip JSX, or `null` when no datum is hovered.\n */\nexport const renderDefaultTooltip = ( params: RenderTooltipParams< DataPointDate > ) => {\n\tconst { tooltipData } = params;\n\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\tif ( ! nearestDatum ) return null;\n\n\tconst tooltipPoints: TooltipDatum[] = Object.entries( tooltipData?.datumByKey || {} )\n\t\t.map( ( [ key, { datum } ] ) => ( {\n\t\t\tkey,\n\t\t\tvalue: datum.value as number,\n\t\t} ) )\n\t\t.sort( ( a, b ) => b.value - a.value );\n\n\treturn (\n\t\t<div className={ styles[ 'line-chart__tooltip' ] }>\n\t\t\t<div className={ styles[ 'line-chart__tooltip-date' ] }>\n\t\t\t\t{ nearestDatum.date?.toLocaleDateString() }\n\t\t\t</div>\n\t\t\t{ tooltipPoints.map( point => (\n\t\t\t\t<Stack\n\t\t\t\t\tkey={ point.key }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName={ styles[ 'line-chart__tooltip-row' ] }\n\t\t\t\t>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-label' ] }>{ point.key }:</span>\n\t\t\t\t\t<span className={ styles[ 'line-chart__tooltip-value' ] }>\n\t\t\t\t\t\t{ formatNumber( point.value ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t) ) }\n\t\t</div>\n\t);\n};\n\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef: FC< {\n\tchartRef?: Ref< SingleChartRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\txScale: context.xScale,\n\t\t\t\t\tyScale: context.yScale,\n\t\t\t\t};\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tmargin: margin || {},\n\t\t\t} ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null; // This component only provides the ref interface\n};\n\nconst LineChartInternal = forwardRef< SingleChartRef, LineChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\trenderGlyph = defaultRenderGlyph,\n\t\t\tglyphStyle = {},\n\t\t\twithLegendGlyph = false,\n\t\t\twithGradientFill = false,\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\twithStartGlyphs = false,\n\t\t\twithEndGlyphs = false,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown = undefined,\n\t\t\tonPointerUp = undefined,\n\t\t\tonPointerMove = undefined,\n\t\t\tonPointerOut = undefined,\n\t\t\tzoomable = false,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'line';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\t// Gradient stops apply this as an SVG attribute, where CSS var() cannot\n\t\t// resolve, so resolve the WPDS token to a concrete value first.\n\t\tconst resolvedBackgroundColor =\n\t\t\tresolveCssVariable( providerTheme.backgroundColor ) ?? providerTheme.backgroundColor;\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< SingleChartRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\t// Process children for composition API (Legend, etc.)\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LineChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\t// Callback for ChartLayout to notify us when the measured content height changes.\n\t\t// We compute chartHeight the same way the render prop does so the context stays in sync.\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\t// Forward the external ref to the internal ref\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t\t// Add visibility information to series when using interactive legends\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\t\treturn dataSorted.map( ( series, index ) => ( { series, index, isVisible: true } ) );\n\t\t\t}\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, chartId, isSeriesVisible, legendInteractive ] );\n\n\t\t// Check if all series are hidden\n\t\tconst allSeriesHidden = useMemo( () => {\n\t\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t\t}, [ seriesWithVisibility ] );\n\n\t\t// Use the keyboard navigation hook\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst formatter = options?.axis?.x?.tickFormat || getFormatter( dataSorted );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.x,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\tzero: false,\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, zoom.domain ] );\n\n\t\tconst tooltipRenderGlyph = useMemo( () => {\n\t\t\treturn ( props: GlyphProps< DataPointDate > ) => {\n\t\t\t\tconst seriesIndex = dataSorted.findIndex(\n\t\t\t\t\tseries =>\n\t\t\t\t\t\tseries.label === props.key || series.data.includes( props.datum as DataPointDate )\n\t\t\t\t);\n\n\t\t\t\tconst seriesData = dataSorted[ seriesIndex ];\n\n\t\t\t\tconst { color, glyph: themeGlyph } = getElementStyles( {\n\t\t\t\t\tdata: seriesData,\n\t\t\t\t\tindex: seriesIndex,\n\t\t\t\t} );\n\n\t\t\t\tconst propsWithResolvedColor = { ...props, color };\n\n\t\t\t\treturn themeGlyph\n\t\t\t\t\t? themeGlyph( propsWithResolvedColor )\n\t\t\t\t\t: renderGlyph( propsWithResolvedColor );\n\t\t\t};\n\t\t}, [ dataSorted, renderGlyph, getElementStyles ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\t// Memoize legend options to prevent unnecessary re-calculations\n\t\tconst legendOptions = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGlyph: withLegendGlyph,\n\t\t\t\tglyphSize: Math.max( 0, toNumber( glyphStyle?.radius ) ?? 4 ),\n\t\t\t\trenderGlyph,\n\t\t\t} ),\n\t\t\t[ withLegendGlyph, glyphStyle?.radius, renderGlyph ]\n\t\t);\n\n\t\t// Create legend items using the reusable hook\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\t// Memoize metadata to prevent unnecessary re-registration\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( {\n\t\t\t\twithGradientFill,\n\t\t\t\tsmoothing,\n\t\t\t\tcurveType,\n\t\t\t\twithStartGlyphs,\n\t\t\t\twithEndGlyphs,\n\t\t\t\twithLegendGlyph,\n\t\t\t} ),\n\t\t\t[ withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph ]\n\t\t);\n\n\t\t// Register chart with context only if data is valid\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'line',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\n\t\t// Create a custom renderTooltip that includes focus capability\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'line-chart', styles[ 'line-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'line-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<SingleChartContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'line-chart',\n\t\t\t\t\t\tstyles[ 'line-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'line-chart--animated' ] ]: animation && ! prefersReducedMotion },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"line-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\t// Use the measured height, falling back to the passed height if provided.\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Line chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t// xScale and yScale could be set in Axis as well, but they are `scale` props there.\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ gridVisibility !== 'none' && <Grid columns={ false } numTicks={ 4 } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.x.display && <Axis { ...chartOptions.axis.x } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.y.display && <Axis { ...chartOptions.axis.y } /> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Line is not animated, so clip only while zoomed; its edge glyphs sit on the plot border and must not be clipped. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable && !! zoom.domain } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t( { series: seriesData, index, isVisible } ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Skip rendering invisible series\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! isVisible ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst { color, lineStyles, glyph } = getElementStyles( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata: seriesData,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst lineProps = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstroke: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...lineStyles,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ seriesData?.label || index }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withGradientFill && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ `area-gradient-${ chartId }-${ index + 1 }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfromOpacity={ 0.4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttoOpacity={ 0.1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tto={ resolvedBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...seriesData.options?.gradient }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"line-gradient\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesData.options?.gradient?.stops?.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t( stop, stopIndex ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `${ stop.offset }-${ stop.color || color }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stop.offset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopColor={ stop.color || color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstopOpacity={ stop.opacity ?? 1 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid={ `line-gradient-stop-${ chartId }-${ index }-${ stopIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</LinearGradient>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<AreaSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twithGradientFill\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? `url(#area-gradient-${ chartId }-${ index + 1 })`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'transparent'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ true }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ getCurveType( curveType, smoothing ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlineProps={ lineProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withStartGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ withEndGlyphs && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LineChartGlyph\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ glyph ?? renderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taccessors={ accessors }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"end\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSeriesGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\trenderGlyph={ tooltipRenderGlyph }\n\t\t\t\t\t\t\t\t\t\t\t\t\tglyphStyle={ glyphStyle }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'line-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Component to expose scale data via ref */ }\n\t\t\t\t\t\t\t\t\t\t\t<LineChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n);\n\n// Component type definitions for composition API\ntype LineChartAnnotationComponents = {\n\tAnnotationsOverlay: typeof LineChartAnnotationsOverlay;\n\tAnnotation: typeof LineChartAnnotation;\n\tLegend: typeof Legend;\n};\n\ntype LineChartBaseProps = Optional< LineChartProps, 'width' | 'height' | 'size' >;\n\ntype LineChartComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & React.RefAttributes< SingleChartRef >\n> &\n\tLineChartAnnotationComponents;\n\ntype LineChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tLineChartBaseProps & ResponsiveConfig & React.RefAttributes< SingleChartRef >\n> &\n\tLineChartAnnotationComponents;\n\nconst LineChartWithProvider = forwardRef< SingleChartRef, LineChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <LineChartInternal { ...props } ref={ ref } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LineChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nLineChartWithProvider.displayName = 'LineChart';\n\nconst LineChart = attachSubComponents( LineChartWithProvider, {\n\tLegend: Legend,\n\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\tAnnotation: LineChartAnnotation,\n} ) as LineChartComponent;\n\nconst LineChartResponsive = attachSubComponents(\n\twithResponsive< LineChartProps >( LineChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tAnnotationsOverlay: LineChartAnnotationsOverlay,\n\t\tAnnotation: LineChartAnnotation,\n\t}\n) as LineChartResponsiveComponent;\n\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };\n","import { __ } from '@wordpress/i18n';\nimport type { DataPoint, DataPointDate, SeriesData } from '../../../types';\n\n/**\n * Up-front data validation. Returns a localised error message when the chart\n * cannot safely render, otherwise `null`. Catches the cases that would\n * NaN-cascade through the tick formatter and stack layout: empty top-level\n * array, empty per-series data, null/NaN values, invalid dates.\n *\n * @param data - Series data passed to AreaChart.\n * @return Error message, or `null` if the data is renderable.\n */\nexport const validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasEmptySeries = data.some( series => ! series.data?.length );\n\tif ( hasEmptySeries ) return __( 'No data available', 'jetpack-charts' );\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\t( point: DataPointDate | DataPoint ) =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( 'date' in point && point.date && isNaN( point.date.getTime() ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return __( 'Invalid data', 'jetpack-charts' );\n\treturn null;\n};\n","import { DataContext, TooltipContext } from '@visx/xychart';\nimport { useContext, useImperativeHandle } from 'react';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { SingleChartRef } from '../../private/single-chart-context';\nimport type { FC, ReactNode, Ref } from 'react';\n\nexport type VisibleSeriesEntry = { series: SeriesData; index: number; isVisible: boolean };\n\n// AreaChart only configures time + linear scales; cast to a callable shape\n// instead of spreading `any`. `Number(...)` + `isFinite` guards every call.\ntype ScaleFn = ( input: Date | number ) => number;\n\n// Bridges visx's `DataContext` to the chart's `SingleChartRef` so consumers\n// can read scales and dimensions imperatively. Must be inside `<XYChart>`.\nexport const AreaChartScalesRef: FC< {\n\tchartRef?: Ref< SingleChartRef >;\n\twidth: number;\n\theight: number;\n\tmargin?: { top?: number; right?: number; bottom?: number; left?: number };\n} > = ( { chartRef, width, height, margin } ) => {\n\tconst context = useContext( DataContext );\n\n\tuseImperativeHandle(\n\t\tchartRef,\n\t\t() => ( {\n\t\t\tgetScales: () => {\n\t\t\t\tif ( ! context?.xScale || ! context?.yScale ) return null;\n\t\t\t\treturn { xScale: context.xScale, yScale: context.yScale };\n\t\t\t},\n\t\t\tgetChartDimensions: () => ( { width, height, margin: margin || {} } ),\n\t\t} ),\n\t\t[ context, width, height, margin ]\n\t);\n\n\treturn null;\n};\n\n// Hover indicators for each visible series. visx's `showSeriesGlyphs`\n// mispositions on AreaStack (its registered yAccessor expects a stack-bar\n// but receives the unwrapped datum, yielding NaN), so we compute positions\n// from the chart's scales: cumulative top edge for stacked + offset='none'\n// (matches d3-stack — missing values count as 0); raw y for unstacked.\n// Skipped for `expand`/`wiggle`/`silhouette` — exact positions there would\n// need re-running the d3-stack layout.\nexport const HoverGlyphs: FC< {\n\tvisibleSeries: VisibleSeriesEntry[];\n\tstacked: boolean;\n\tstackOffset: 'none' | 'expand' | 'wiggle' | 'silhouette';\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\tstrokeColor: string;\n} > = ( { visibleSeries, stacked, stackOffset, getElementStyles, strokeColor } ) => {\n\tconst dataContext = useContext( DataContext );\n\tconst tooltipContext = useContext( TooltipContext );\n\n\tconst xScale = dataContext?.xScale as ScaleFn | undefined;\n\tconst yScale = dataContext?.yScale as ScaleFn | undefined;\n\tconst tooltipOpen = tooltipContext?.tooltipOpen;\n\tconst nearestDatum = tooltipContext?.tooltipData?.nearestDatum?.datum as\n\t\t| DataPointDate\n\t\t| undefined;\n\n\tif (\n\t\t! tooltipOpen ||\n\t\t! xScale ||\n\t\t! yScale ||\n\t\t! nearestDatum ||\n\t\t! nearestDatum.date ||\n\t\t( stacked && stackOffset !== 'none' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst xPx = Number( xScale( nearestDatum.date ) );\n\tif ( ! Number.isFinite( xPx ) ) return null;\n\n\tconst hoveredTime = nearestDatum.date.getTime();\n\tlet cumulative = 0;\n\tconst circles: ReactNode[] = [];\n\n\t// Always advance `cumulative` (d3-stack treats missing/null as 0), but\n\t// only render a glyph when the series has a real value at this x.\n\tfor ( const { series, index } of visibleSeries ) {\n\t\tconst datum = series.data.find(\n\t\t\td => ( d as DataPointDate ).date?.getTime() === hoveredTime\n\t\t) as DataPointDate | undefined;\n\n\t\tconst value = datum?.value ?? 0;\n\t\tif ( stacked ) {\n\t\t\tcumulative += value;\n\t\t}\n\n\t\tif ( ! datum || datum.value == null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst yPx = Number( yScale( stacked ? cumulative : value ) );\n\t\tif ( ! Number.isFinite( yPx ) ) continue;\n\n\t\tconst { color } = getElementStyles( { data: series, index } );\n\t\tcircles.push(\n\t\t\t<circle\n\t\t\t\tkey={ series.label || index }\n\t\t\t\tcx={ xPx }\n\t\t\t\tcy={ yPx }\n\t\t\t\tr={ 4 }\n\t\t\t\tfill={ color }\n\t\t\t\tstroke={ strokeColor }\n\t\t\t\tstrokeWidth={ 1.5 }\n\t\t\t\tpaintOrder=\"fill\"\n\t\t\t\tdata-testid={ `area-chart-hover-glyph-${ index }` }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( circles.length === 0 ) return null;\n\n\treturn (\n\t\t<g pointerEvents=\"none\" className=\"area-chart__hover-glyphs\">\n\t\t\t{ circles }\n\t\t</g>\n\t);\n};\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { XYChart, AnimatedAreaSeries, AnimatedAreaStack, Grid, Axis } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tuseMemo,\n\tuseContext,\n\tforwardRef,\n\tuseImperativeHandle,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { attachSubComponents, resolveCssVariable } from '../../utils';\nimport { renderDefaultTooltip } from '../line-chart';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext, type SingleChartRef } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { getCurveType, getFormatter, guessOptimalNumTicks } from '../private/time-axis';\nimport { withResponsive } from '../private/with-responsive';\nimport { useXZoom, ZoomResetButton, ZoomSelectionRect, ZoomClip } from '../private/x-zoom';\nimport styles from './area-chart.module.scss';\nimport { AreaChartScalesRef, HoverGlyphs, validateData } from './private';\nimport type { AreaChartProps } from './types';\nimport type { DataPointDate, Optional } from '../../types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { TickFormatter } from '@visx/axis';\n\nconst AreaChartInternal = forwardRef< SingleChartRef, AreaChartProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\tchartId: providedChartId,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tclassName,\n\t\t\tmargin,\n\t\t\twithTooltips = true,\n\t\t\twithTooltipCrosshairs,\n\t\t\tshowLegend = false,\n\t\t\tlegend = {},\n\t\t\tstacked = true,\n\t\t\tstackOffset = 'none',\n\t\t\tsmoothing = true,\n\t\t\tcurveType,\n\t\t\tfillOpacity,\n\t\t\twithStroke,\n\t\t\trenderTooltip = renderDefaultTooltip,\n\t\t\tanimation,\n\t\t\toptions = {},\n\t\t\tonPointerDown,\n\t\t\tonPointerUp,\n\t\t\tonPointerMove,\n\t\t\tonPointerOut,\n\t\t\tzoomable = false,\n\t\t\trescaleYOnLegendToggle = true,\n\t\t\tchildren,\n\t\t\tgridVisibility,\n\t\t\tgap = 'md',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst legendInteractive = legend.interactive ?? false;\n\t\tconst legendShape = legend.shape ?? 'rect';\n\t\tconst legendPosition = legend.position ?? 'bottom';\n\n\t\tconst providerTheme = useGlobalChartsTheme();\n\t\tconst theme = useXYChartTheme( data );\n\t\tconst chartId = useChartId( providedChartId );\n\t\tconst chartRef = useRef< HTMLDivElement >( null );\n\t\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\t\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\t\tconst internalChartRef = useRef< SingleChartRef >( null );\n\n\t\tconst zoom = useXZoom< Date >( {\n\t\t\tenabled: zoomable,\n\t\t\tchartRef: internalChartRef,\n\t\t\tuserHandlers: { onPointerDown, onPointerMove, onPointerUp },\n\t\t} );\n\n\t\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'AreaChart' );\n\t\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\t\tconst handleContentHeightChange = useCallback(\n\t\t\t( contentHeight: number ) => {\n\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t\t},\n\t\t\t[ height ]\n\t\t);\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ( {\n\t\t\t\tgetScales: () => internalChartRef.current?.getScales() || null,\n\t\t\t\tgetChartDimensions: () =>\n\t\t\t\t\tinternalChartRef.current?.getChartDimensions() || { width: 0, height: 0, margin: {} },\n\t\t\t} ),\n\t\t\t[ internalChartRef ]\n\t\t);\n\n\t\tconst dataSorted = useChartDataTransform( data );\n\t\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t\tconst seriesWithVisibility = useMemo( () => {\n\t\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\t\treturn dataSorted.map( ( series, index ) => ( { series, index, isVisible: true } ) );\n\t\t\t}\n\t\t\treturn dataSorted.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t\t} ) );\n\t\t}, [ dataSorted, chartId, isSeriesVisible, legendInteractive ] );\n\n\t\tconst allSeriesHidden = useMemo(\n\t\t\t() => seriesWithVisibility.every( ( { isVisible } ) => ! isVisible ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\n\t\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\t\tselectedIndex,\n\t\t\tsetSelectedIndex,\n\t\t\tisNavigating,\n\t\t\tsetIsNavigating,\n\t\t\tchartRef,\n\t\t\ttotalPoints: dataSorted[ 0 ]?.data.length || 0,\n\t\t} );\n\n\t\t// Computed from the full data set (ignoring legend visibility) so the y-axis stays\n\t\t// fixed when series are toggled off - otherwise visx auto-fits to the remaining\n\t\t// data and the chart's baseline appears to move. Opt-in via\n\t\t// `rescaleYOnLegendToggle={ false }`. Skipped for non-default stack offsets,\n\t\t// which reshape the y-extent (`expand` -> [0,1], `wiggle`/`silhouette` -> centred\n\t\t// around zero); letting visx derive the domain is correct there.\n\t\tconst fixedYDomain = useMemo< [ number, number ] | undefined >( () => {\n\t\t\tif (\n\t\t\t\trescaleYOnLegendToggle ||\n\t\t\t\t! legendInteractive ||\n\t\t\t\t! dataSorted.length ||\n\t\t\t\t! dataSorted[ 0 ].data.length ||\n\t\t\t\t( stacked && stackOffset !== 'none' )\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif ( stacked ) {\n\t\t\t\t// d3-stack with `offset: 'none'` stacks positives upward from 0 and\n\t\t\t\t// negatives downward from 0, so we need both extremes.\n\t\t\t\tconst numPoints = Math.max( ...dataSorted.map( s => s.data.length ) );\n\t\t\t\tlet posMax = 0;\n\t\t\t\tlet negMin = 0;\n\t\t\t\tfor ( let i = 0; i < numPoints; i++ ) {\n\t\t\t\t\tlet posSum = 0;\n\t\t\t\t\tlet negSum = 0;\n\t\t\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\t\t\tconst v = Number( series.data[ i ]?.value );\n\t\t\t\t\t\tif ( Number.isNaN( v ) ) continue;\n\t\t\t\t\t\tif ( v >= 0 ) posSum += v;\n\t\t\t\t\t\telse negSum += v;\n\t\t\t\t\t}\n\t\t\t\t\tif ( posSum > posMax ) posMax = posSum;\n\t\t\t\t\tif ( negSum < negMin ) negMin = negSum;\n\t\t\t\t}\n\t\t\t\treturn [ negMin, posMax ];\n\t\t\t}\n\n\t\t\tlet max = -Infinity;\n\t\t\tlet min = Infinity;\n\t\t\tfor ( const series of dataSorted ) {\n\t\t\t\tfor ( const point of series.data ) {\n\t\t\t\t\tconst v = Number( point?.value );\n\t\t\t\t\tif ( ! Number.isNaN( v ) ) {\n\t\t\t\t\t\tif ( v > max ) max = v;\n\t\t\t\t\t\tif ( v < min ) min = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( max === -Infinity ) return undefined;\n\t\t\treturn [ Math.min( 0, min ), max ];\n\t\t}, [ dataSorted, stacked, stackOffset, legendInteractive, rescaleYOnLegendToggle ] );\n\n\t\tconst chartOptions = useMemo( () => {\n\t\t\tconst formatter = options?.axis?.x?.tickFormat || getFormatter( dataSorted );\n\n\t\t\treturn {\n\t\t\t\taxis: {\n\t\t\t\t\tx: {\n\t\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\t\tnumTicks: guessOptimalNumTicks( dataSorted, width, formatter ),\n\t\t\t\t\t\ttickFormat: formatter,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.x,\n\t\t\t\t\t},\n\t\t\t\t\ty: {\n\t\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\t\ttickFormat: formatNumberCompact as TickFormatter< number >,\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t...options?.axis?.y,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: {\n\t\t\t\t\ttype: 'time' as const,\n\t\t\t\t\t...options?.xScale,\n\t\t\t\t\t...( zoom.domain ? { domain: zoom.domain } : {} ),\n\t\t\t\t},\n\t\t\t\tyScale: {\n\t\t\t\t\ttype: 'linear' as const,\n\t\t\t\t\tnice: true,\n\t\t\t\t\t// Stacked areas should always include zero so the baseline is meaningful.\n\t\t\t\t\tzero: stacked,\n\t\t\t\t\t...( fixedYDomain ? { domain: fixedYDomain } : {} ),\n\t\t\t\t\t...options?.yScale,\n\t\t\t\t},\n\t\t\t};\n\t\t}, [ options, dataSorted, width, stacked, fixedYDomain, zoom.domain ] );\n\n\t\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme );\n\n\t\tconst error = validateData( dataSorted );\n\t\tconst isDataValid = ! error;\n\n\t\tconst legendOptions = useMemo( () => ( { withGlyph: false, glyphSize: 0 } ), [] );\n\t\tconst legendItems = useChartLegendItems( dataSorted, legendOptions, legendShape );\n\n\t\tconst chartMetadata = useMemo(\n\t\t\t() => ( { stacked, stackOffset, smoothing, curveType } ),\n\t\t\t[ stacked, stackOffset, smoothing, curveType ]\n\t\t);\n\n\t\tuseChartRegistration( {\n\t\t\tchartId,\n\t\t\tlegendItems,\n\t\t\tchartType: 'area',\n\t\t\tisDataValid,\n\t\t\tmetadata: chartMetadata,\n\t\t} );\n\n\t\tconst prefersReducedMotion = usePrefersReducedMotion();\n\t\tconst animationEnabled = !! animation && ! prefersReducedMotion;\n\n\t\tconst accessors = {\n\t\t\txAccessor: ( d: DataPointDate ) => d?.date,\n\t\t\tyAccessor: ( d: DataPointDate ) => d?.value,\n\t\t};\n\t\tconst zeroYAccessor = useCallback( () => 0, [] );\n\n\t\t// Hidden series are still registered with visx (so paths can interpolate), but their\n\t\t// data points should not appear in the tooltip.\n\t\tconst visibleLabels = useMemo(\n\t\t\t() => new Set( seriesWithVisibility.filter( s => s.isVisible ).map( s => s.series.label ) ),\n\t\t\t[ seriesWithVisibility ]\n\t\t);\n\t\tconst filteredRenderTooltip = useCallback(\n\t\t\t( params: Parameters< typeof renderTooltip >[ 0 ] ) => {\n\t\t\t\tif ( ! legendInteractive ) return renderTooltip( params );\n\t\t\t\tconst datumByKey = params?.tooltipData?.datumByKey;\n\t\t\t\tif ( ! datumByKey ) return renderTooltip( params );\n\t\t\t\tconst filtered = Object.fromEntries(\n\t\t\t\t\tObject.entries( datumByKey ).filter( ( [ key ] ) => visibleLabels.has( key ) )\n\t\t\t\t);\n\t\t\t\tif ( Object.keys( filtered ).length === 0 ) return null;\n\t\t\t\t// `nearestDatum` may still point at a hidden series; re-point it at the first\n\t\t\t\t// visible entry so consumers that read it (e.g. for the tooltip heading) don't\n\t\t\t\t// surface hidden-series state.\n\t\t\t\tconst nearestDatum = params?.tooltipData?.nearestDatum;\n\t\t\t\tconst nextNearest =\n\t\t\t\t\tnearestDatum && visibleLabels.has( nearestDatum.key )\n\t\t\t\t\t\t? nearestDatum\n\t\t\t\t\t\t: { ...Object.values( filtered )[ 0 ], distance: nearestDatum?.distance ?? 0 };\n\t\t\t\treturn renderTooltip( {\n\t\t\t\t\t...params,\n\t\t\t\t\ttooltipData: {\n\t\t\t\t\t\t...params.tooltipData,\n\t\t\t\t\t\tdatumByKey: filtered,\n\t\t\t\t\t\tnearestDatum: nextNearest,\n\t\t\t\t\t} as typeof params.tooltipData,\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ renderTooltip, legendInteractive, visibleLabels ]\n\t\t);\n\n\t\t// Defaults that depend on stacked vs overlapping mode.\n\t\tconst resolvedFillOpacity = fillOpacity ?? ( stacked ? 0.85 : 0.4 );\n\t\tconst resolvedWithStroke = withStroke ?? ! stacked;\n\n\t\tif ( error ) {\n\t\t\treturn <div className={ clsx( 'area-chart', styles[ 'area-chart' ] ) }>{ error }</div>;\n\t\t}\n\n\t\tconst legendElement = showLegend && (\n\t\t\t<Legend\n\t\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\t\tposition={ legendPosition }\n\t\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\t\titemClassName={ legend.itemClassName }\n\t\t\t\titemStyles={ legend.itemStyles }\n\t\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\t\tclassName={ styles[ 'area-chart__legend' ] }\n\t\t\t\tshape={ legendShape }\n\t\t\t\tchartId={ chartId }\n\t\t\t\tinteractive={ legendInteractive }\n\t\t\t/>\n\t\t);\n\n\t\tconst visibleSeries = seriesWithVisibility.filter( ( { isVisible } ) => isVisible );\n\t\tconst curve = getCurveType( curveType, smoothing );\n\n\t\t// Visx's `<AreaStack>` keys each `<Area>` by `stackIndex-dataKey`, so filtering out\n\t\t// a hidden series would shift indexes and remount every path. Instead we keep every\n\t\t// series mounted and zero out hidden ones via `yAccessor` — react-spring then\n\t\t// interpolates the `d` attribute, giving a smooth \"going down\" effect for the\n\t\t// hidden area and a smooth re-flow for the rest.\n\t\tconst renderSeries = ( {\n\t\t\tseries: seriesData,\n\t\t\tindex,\n\t\t\tisVisible,\n\t\t}: ( typeof seriesWithVisibility )[ number ] ) => {\n\t\t\tconst { color, lineStyles } = getElementStyles( { data: seriesData, index } );\n\t\t\treturn (\n\t\t\t\t<AnimatedAreaSeries\n\t\t\t\t\tkey={ seriesData?.label || index }\n\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\txAccessor={ accessors.xAccessor }\n\t\t\t\t\tyAccessor={ isVisible || ! legendInteractive ? accessors.yAccessor : zeroYAccessor }\n\t\t\t\t\tfill={ color }\n\t\t\t\t\tfillOpacity={ resolvedFillOpacity }\n\t\t\t\t\t{ ...( stacked ? {} : { renderLine: resolvedWithStroke, curve } ) }\n\t\t\t\t\tlineProps={ { stroke: color, ...lineStyles } }\n\t\t\t\t\tdata-testid={ `area-chart-series-${ index }` }\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<SingleChartContext.Provider\n\t\t\t\tvalue={ {\n\t\t\t\t\tchartId,\n\t\t\t\t\tchartRef: internalChartRef,\n\t\t\t\t\tchartWidth: width,\n\t\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ legendElement }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'area-chart',\n\t\t\t\t\t\tstyles[ 'area-chart' ],\n\t\t\t\t\t\t{ [ styles[ 'area-chart--animated' ] ]: animationEnabled },\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"area-chart\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t\t>\n\t\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\t\taria-label={ __( 'Area chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t\t<div ref={ chartRef } style={ { position: 'relative' } }>\n\t\t\t\t\t\t\t\t\t\t{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }\n\t\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\tmargin={ { ...defaultMargin, ...margin } }\n\t\t\t\t\t\t\t\t\t\t\txScale={ chartOptions.xScale }\n\t\t\t\t\t\t\t\t\t\t\tyScale={ chartOptions.yScale }\n\t\t\t\t\t\t\t\t\t\t\tonPointerDown={ zoom.handlers.onPointerDown }\n\t\t\t\t\t\t\t\t\t\t\tonPointerUp={ zoom.handlers.onPointerUp }\n\t\t\t\t\t\t\t\t\t\t\tonPointerMove={ zoom.handlers.onPointerMove }\n\t\t\t\t\t\t\t\t\t\t\tonPointerOut={ onPointerOut }\n\t\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ gridVisibility !== 'none' && <Grid columns={ false } numTicks={ 4 } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.x.display && <Axis { ...chartOptions.axis.x } /> }\n\t\t\t\t\t\t\t\t\t\t\t{ chartOptions.axis.y.display && <Axis { ...chartOptions.axis.y } /> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Area is animated, so clip the whole time it is zoomable to keep the zoom-out animation in bounds. */ }\n\t\t\t\t\t\t\t\t\t\t\t<ZoomClip active={ zoomable } chartId={ chartId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden && stacked && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AnimatedAreaStack\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurve={ curve }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\toffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderLine={ resolvedWithStroke }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ seriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</AnimatedAreaStack>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{ ! allSeriesHidden &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t! stacked &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tseriesWithVisibility.map( renderSeries ) }\n\t\t\t\t\t\t\t\t\t\t\t</ZoomClip>\n\n\t\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Stacked mode: yAccessor returns raw value, not stacked y — snapping mispositions.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY={ ! stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ filteredRenderTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowVerticalCrosshair={ withTooltipCrosshairs?.showVertical }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowHorizontalCrosshair={ withTooltipCrosshairs?.showHorizontal }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'area-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tseries={ dataSorted }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HoverGlyphs\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvisibleSeries={ visibleSeries }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstacked={ stacked }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstackOffset={ stackOffset }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstrokeColor={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresolveCssVariable( providerTheme.backgroundColor ) ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tproviderTheme.backgroundColor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t\t<AreaChartScalesRef\n\t\t\t\t\t\t\t\t\t\t\t\tchartRef={ internalChartRef }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\t// `||` — responsive HOC may pass `height = 0` before measurement.\n\t\t\t\t\t\t\t\t\t\t\t\theight={ height || chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t\tmargin={ margin }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ zoomable && <ZoomSelectionRect drag={ zoom.drag } /> }\n\t\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n);\n\ntype AreaChartSubComponents = {\n\tLegend: typeof Legend;\n};\n\ntype AreaChartBaseProps = Optional< AreaChartProps, 'width' | 'height' | 'size' >;\n\ntype AreaChartComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & React.RefAttributes< SingleChartRef >\n> &\n\tAreaChartSubComponents;\n\ntype AreaChartResponsiveComponent = React.ForwardRefExoticComponent<\n\tAreaChartBaseProps & ResponsiveConfig & React.RefAttributes< SingleChartRef >\n> &\n\tAreaChartSubComponents;\n\nconst AreaChartWithProvider = forwardRef< SingleChartRef, AreaChartProps >( ( props, ref ) => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\tif ( existingContext ) {\n\t\treturn <AreaChartInternal { ...props } ref={ ref } />;\n\t}\n\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<AreaChartInternal { ...props } ref={ ref } />\n\t\t</GlobalChartsProvider>\n\t);\n} );\n\nAreaChartWithProvider.displayName = 'AreaChart';\n\nconst AreaChart = attachSubComponents( AreaChartWithProvider, {\n\tLegend: Legend,\n} ) as AreaChartComponent;\n\nconst AreaChartResponsive = attachSubComponents(\n\twithResponsive< AreaChartProps >( AreaChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as AreaChartResponsiveComponent;\n\nexport { AreaChartResponsive as default, AreaChart as AreaChartUnresponsive };\n","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { isSafari } from '../../../utils';\nimport type { AxisScale, TickRendererProps } from '@visx/axis';\nimport type { FC, CSSProperties } from 'react';\n\n/**\n * Get the bandwidth of a scale\n *\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\treturn scale && 'bandwidth' in scale ? scale.bandwidth() ?? 0 : 0;\n};\ninterface TruncatedTickComponentProps extends TickRendererProps {\n\t/** Which axis this tick belongs to */\n\taxis: 'x' | 'y';\n}\n\n/**\n * Minimum width in pixels for tick labels when scale bandwidth is very small.\n * Prevents labels from collapsing to unreadable widths on dense charts.\n *\n * Trade-off: When bandwidth is less than this minimum (e.g., many bars in a narrow chart),\n * adjacent labels may overlap since each label uses this minimum width regardless of\n * available space. This prioritizes label readability over preventing overlap.\n *\n * For very dense charts where overlap occurs, consider:\n * - Using `numTicks` option to reduce the number of displayed labels\n * - Using `tickFormat` to abbreviate label text\n * - Increasing chart width or reducing data points\n */\nconst MIN_TICK_LABEL_WIDTH = 20;\n\n/**\n * A tick component that renders labels with text truncation (ellipsis) when they exceed\n * the available bandwidth. Shows the full text on hover via native title attribute.\n *\n * Uses foreignObject to embed HTML within SVG, enabling CSS text-overflow: ellipsis.\n * Inherits text styles from tickLabelProps passed by visx Axis component.\n *\n * Note: A minimum label width (MIN_TICK_LABEL_WIDTH) is enforced to keep labels readable.\n * On very dense charts where bandwidth < 20px, this may cause label overlap.\n * See MIN_TICK_LABEL_WIDTH documentation for mitigation strategies.\n *\n * @param props - The props for the truncated tick component\n * @param props.x - The x position of the tick\n * @param props.y - The y position of the tick\n * @param props.formattedValue - The formatted value of the tick\n * @param props.axis - The axis this tick belongs to\n * @param props.textAnchor - The text anchor of the tick\n * @param props.fill - The fill color of the tick\n * @param props.dy - The dy offset of the tick\n *\n * @return The truncated tick component\n */\nexport const TruncatedTickComponent: FC< TruncatedTickComponentProps > = ( {\n\tx,\n\ty,\n\tformattedValue,\n\taxis,\n\ttextAnchor,\n\tfill,\n\tdy,\n\t...textProps\n} ) => {\n\t// Get max width of the tick label\n\tconst { xScale, yScale } = useContext( DataContext ) || {};\n\tconst scale = axis === 'x' ? xScale : yScale;\n\tconst bandwidth = getScaleBandwidth( scale );\n\tconst maxWidth = Math.max( bandwidth, MIN_TICK_LABEL_WIDTH );\n\n\t// Map SVG textAnchor to CSS textAlign\n\tlet textAlign: 'left' | 'right' | 'center' = 'center';\n\tif ( textAnchor === 'start' ) {\n\t\ttextAlign = 'left';\n\t} else if ( textAnchor === 'end' ) {\n\t\ttextAlign = 'right';\n\t} else if ( textAnchor === 'middle' ) {\n\t\ttextAlign = 'center';\n\t}\n\n\t// Calculate x offset based on text alignment\n\tlet xOffset = 0;\n\tif ( textAlign === 'center' ) {\n\t\txOffset = -maxWidth / 2;\n\t} else if ( textAlign === 'right' ) {\n\t\txOffset = -maxWidth;\n\t}\n\n\t// Extract compatible style properties from SVG text props\n\tconst { fontSize, fontFamily, fontWeight, fontStyle, letterSpacing, opacity } = textProps as {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\topacity?: CSSProperties[ 'opacity' ];\n\t};\n\n\tconst textStyles: CSSProperties = {\n\t\t/**\n\t\t * SVG <text> elements are vertically aligned to the baseline by default, but HTML <div> elements inside <foreignObject>\n\t\t * are positioned relative to the top-left corner. To visually align the tick label like SVG text,\n\t\t * we shift the div up by 100% of its height and adjust by twice the SVG dy value (from visx) to approximate original placement.\n\t\t */\n\t\ttransform: `translateY(calc(-100% + ${ dy ?? '0' } * 2))`,\n\t\t// Safari doesn't work well with foreignObject positioning. Use position: fixed as a workaround.\n\t\t...( isSafari() ? { position: 'fixed' as const } : {} ),\n\t\t// Apply compatible SVG text styles\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tletterSpacing,\n\t\topacity,\n\t\t// Convert svg text styles to CSS styles for the div\n\t\tcolor: fill ?? 'inherit',\n\t\ttextAlign,\n\t\t// Ensure text is truncated with ellipsis, remains on one line, and shows the full value in a tooltip on hover.\n\t\t// The surrounding div uses CSS to handle overflow, and the 'title' attribute is set for accessibility.\n\t\twidth: maxWidth,\n\t\toverflow: 'hidden',\n\t\ttextOverflow: 'ellipsis',\n\t\twhiteSpace: 'nowrap',\n\t\tcursor: 'default',\n\t\tpointerEvents: 'auto',\n\t};\n\n\treturn (\n\t\t<foreignObject x={ x + xOffset } y={ y } width={ maxWidth } height={ 0 } overflow=\"visible\">\n\t\t\t<div style={ textStyles } title={ formattedValue }>\n\t\t\t\t{ formattedValue }\n\t\t\t</div>\n\t\t</foreignObject>\n\t);\n};\n\n/**\n * Factory function to create a truncated tick component for a specific axis.\n * Returns a component that can be passed to visx's tickComponent prop.\n *\n * @param axis - The axis this tick component is for ('x' or 'y')\n * @return A tick component function compatible with visx's TickRendererProps\n */\nconst createTruncatedTickComponent = ( axis: 'x' | 'y' ) => ( props: TickRendererProps ) => {\n\treturn <TruncatedTickComponent { ...props } axis={ axis } />;\n};\n\n/**\n * Pre-created tick components for x and y axes.\n * These functions are created once at module initialization and reused,\n * avoiding repeated factory calls when configuring axes.\n */\nexport const TruncatedXTickComponent = createTruncatedTickComponent( 'x' );\nexport const TruncatedYTickComponent = createTruncatedTickComponent( 'y' );\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport { TruncatedXTickComponent, TruncatedYTickComponent } from './truncated-tick-component';\nimport type { EnhancedDataPoint } from '../../../hooks/use-zero-value-display';\nimport type { DataPointDate, BaseChartProps, SeriesData } from '../../../types';\nimport type { TickFormatter } from '@visx/axis';\n\n/** Outer padding of the category band scale (space at the chart edges). */\nexport const BASE_BAND_PADDING = 0.2;\n/** Inner padding of the category band scale (the base gap between ticks). */\nexport const BASE_BAND_PADDING_INNER = 0.1;\n\nconst formatDateTick = ( timestamp: number ) => {\n\tconst date = new Date( timestamp );\n\treturn date.toLocaleDateString( undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t} );\n};\n\n/**\n * Get the group padding of a scale.\n *\n * @param scale - The scale to get the group padding of.\n * @return The group padding of the scale.\n */\nconst getGroupPadding = ( scale: Record< string, unknown > ): number => {\n\treturn typeof scale.paddingInner === 'number' ? ( scale.paddingInner as number ) : 0;\n};\n\n/**\n * Returns the merged options for the bar chart, including axis and scale configuration based on the orientation.\n *\n * @param data - The data to be displayed in the chart.\n * @param horizontal - Whether the chart is horizontal or vertical.\n * @param options - The options for the chart.\n * @return The merged options for the chart.\n */\nexport function useBarChartOptions(\n\tdata: SeriesData[],\n\thorizontal: boolean,\n\toptions: BaseChartProps[ 'options' ] = {}\n) {\n\tconst defaultOptions = useMemo( () => {\n\t\tconst bandScale = {\n\t\t\ttype: 'band' as const,\n\t\t\tpadding: BASE_BAND_PADDING,\n\t\t\tpaddingInner: BASE_BAND_PADDING_INNER,\n\t\t};\n\t\tconst linearScale = {\n\t\t\ttype: 'linear' as const,\n\t\t\tnice: true,\n\t\t\tzero: false,\n\t\t};\n\n\t\tconst labelFormatter = data?.[ 0 ]?.data?.[ 0 ]?.label\n\t\t\t? ( label: string ) => label\n\t\t\t: formatDateTick;\n\t\tconst valueFormatter = formatNumberCompact as TickFormatter< unknown >;\n\n\t\tconst labelAccessor = ( d: DataPointDate ) => d?.label || d?.date;\n\t\tconst valueAccessor = ( d: DataPointDate | EnhancedDataPoint ) => {\n\t\t\t// Use visualValue for bar rendering if available (for zero values), otherwise use value\n\t\t\tconst enhancedPoint = d as EnhancedDataPoint;\n\t\t\treturn enhancedPoint?.visualValue !== undefined ? enhancedPoint.visualValue : d?.value;\n\t\t};\n\n\t\treturn {\n\t\t\tvertical: {\n\t\t\t\txTickFormat: labelFormatter,\n\t\t\t\tyTickFormat: valueFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: labelAccessor,\n\t\t\t\tyAccessor: valueAccessor,\n\t\t\t\tgridVisibility: 'x',\n\t\t\t\txScale: bandScale,\n\t\t\t\tyScale: linearScale,\n\t\t\t},\n\t\t\thorizontal: {\n\t\t\t\txTickFormat: valueFormatter,\n\t\t\t\tyTickFormat: labelFormatter,\n\t\t\t\ttooltipLabelFormatter: labelFormatter,\n\t\t\t\txAccessor: valueAccessor,\n\t\t\t\tyAccessor: labelAccessor,\n\t\t\t\tgridVisibility: 'y',\n\t\t\t\txScale: linearScale,\n\t\t\t\tyScale: bandScale,\n\t\t\t},\n\t\t};\n\t}, [ data ] );\n\n\treturn useMemo( () => {\n\t\tconst orientationKey = horizontal ? 'horizontal' : 'vertical';\n\t\tconst {\n\t\t\txTickFormat,\n\t\t\tyTickFormat,\n\t\t\ttooltipLabelFormatter: defaultTooltipLabelFormatter,\n\t\t\txAccessor,\n\t\t\tyAccessor,\n\t\t\tgridVisibility,\n\t\t\txScale: baseXScale,\n\t\t\tyScale: baseYScale,\n\t\t} = defaultOptions[ orientationKey ];\n\n\t\t// When comparison series are present, visx only sees primary BarSeries and computes\n\t\t// a too-narrow domain. Compute an explicit domain spanning all series so comparison\n\t\t// shadows aren't clipped. Skip when the user has already provided an explicit domain.\n\t\tlet valueScaleDomainOverride: { domain?: [ number, number ] } = {};\n\t\tconst hasComparisonSeries = data.some( s => s.options?.type === 'comparison' );\n\t\tif ( hasComparisonSeries ) {\n\t\t\tconst valueAxisIsY = ! horizontal;\n\t\t\tconst userDomain = valueAxisIsY ? options.yScale?.domain : options.xScale?.domain;\n\t\t\tif ( ! userDomain ) {\n\t\t\t\tconst allValues: number[] = [];\n\t\t\t\tdata.forEach( series => {\n\t\t\t\t\tseries.data.forEach( d => {\n\t\t\t\t\t\tconst enhanced = d as { visualValue?: number };\n\t\t\t\t\t\tconst v =\n\t\t\t\t\t\t\tenhanced.visualValue !== undefined ? enhanced.visualValue : ( d.value as number );\n\t\t\t\t\t\tif ( typeof v === 'number' && Number.isFinite( v ) ) {\n\t\t\t\t\t\t\tallValues.push( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\tif ( allValues.length > 0 ) {\n\t\t\t\t\t// Keep zero in the domain so bar length stays proportional to value — a\n\t\t\t\t\t// non-zero baseline would exaggerate differences between periods. Math.max\n\t\t\t\t\t// keeps zero on the far side too, so charts with negative values still span 0.\n\t\t\t\t\tvalueScaleDomainOverride = {\n\t\t\t\t\t\tdomain: [ Math.min( 0, ...allValues ), Math.max( 0, ...allValues ) ],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst xScale = {\n\t\t\t...baseXScale,\n\t\t\t...( options.xScale || {} ),\n\t\t\t...( horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst yScale = {\n\t\t\t...baseYScale,\n\t\t\t...( options.yScale || {} ),\n\t\t\t...( ! horizontal ? valueScaleDomainOverride : {} ),\n\t\t};\n\t\tconst providedToolTipLabelFormatter = horizontal\n\t\t\t? options.axis?.y?.tickFormat\n\t\t\t: options.axis?.x?.tickFormat;\n\n\t\tconst { labelOverflow: xLabelOverflow, ...xAxisOptions } = options.axis?.x || {};\n\t\tconst { labelOverflow: yLabelOverflow, ...yAxisOptions } = options.axis?.y || {};\n\n\t\treturn {\n\t\t\tgridVisibility,\n\t\t\txScale,\n\t\t\tyScale,\n\t\t\taccessors: {\n\t\t\t\txAccessor,\n\t\t\t\tyAccessor,\n\t\t\t},\n\t\t\taxis: {\n\t\t\t\tx: {\n\t\t\t\t\torientation: 'bottom' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: xTickFormat,\n\t\t\t\t\t...( xLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedXTickComponent } : {} ),\n\t\t\t\t\t...xAxisOptions,\n\t\t\t\t},\n\t\t\t\ty: {\n\t\t\t\t\torientation: 'left' as const,\n\t\t\t\t\tnumTicks: 4,\n\t\t\t\t\ttickFormat: yTickFormat,\n\t\t\t\t\t...( yLabelOverflow === 'ellipsis' ? { tickComponent: TruncatedYTickComponent } : {} ),\n\t\t\t\t\t...yAxisOptions,\n\t\t\t\t},\n\t\t\t},\n\t\t\tbarGroup: {\n\t\t\t\tpadding: getGroupPadding( horizontal ? yScale : xScale ),\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\tlabelFormatter: providedToolTipLabelFormatter || defaultTooltipLabelFormatter,\n\t\t\t},\n\t\t};\n\t}, [ defaultOptions, options, horizontal, data ] );\n}\n","export type ComparisonRect = { x: number; y: number; width: number; height: number };\n\ntype ValueScale = ( ( v: number ) => number ) & { range: () => unknown[] };\n\n/**\n * Output position of a value scale's baseline: zero if in-domain, else the\n * nearest range edge. Mirrors visx's getScaleBaseline so comparison shadows\n * sit on the same baseline as primary bars.\n *\n * @param {ValueScale} scale - The continuous value scale.\n * @return {number} The baseline output position in pixels.\n */\nexport function getValueScaleBaseline( scale: ValueScale ): number {\n\tconst [ a, b ] = scale.range().map( r => Number( r ) || 0 );\n\tconst isDescending = b < a;\n\tconst maybeZero = scale( 0 );\n\tconst [ minOutput, maxOutput ] = isDescending ? [ b, a ] : [ a, b ];\n\tif ( isDescending ) {\n\t\treturn Number.isFinite( maybeZero )\n\t\t\t? Math.min( Math.max( minOutput, maybeZero ), maxOutput )\n\t\t\t: maxOutput;\n\t}\n\treturn Number.isFinite( maybeZero )\n\t\t? Math.min( Math.max( maybeZero, minOutput ), maxOutput )\n\t\t: minOutput;\n}\n\n/**\n * Compute the rect for a comparison \"shadow\" bar, centered on the paired\n * primary bar slot and scaled by `widthFactor`.\n *\n * @param {object} params - Geometry inputs.\n * @param {boolean} params.horizontal - True for a horizontal bar chart, false for vertical.\n * @param {number} params.bandPosition - bandScale(category): start px of the category band.\n * @param {number} params.slotOffset - groupScale(primaryKey): offset of the primary slot within the band.\n * @param {number} params.slotThickness - groupScale.bandwidth(): primary bar thickness in px.\n * @param {number} params.valuePosition - valueScale(value): output px for the bar's data value.\n * @param {number} params.baseline - getValueScaleBaseline(valueScale): zero-line output px.\n * @param {number} params.widthFactor - Shadow thickness multiplier, e.g. 1.5 for 150% width.\n * @return {ComparisonRect} The {x, y, width, height} of the shadow rect.\n */\nexport function computeComparisonRect( params: {\n\thorizontal: boolean;\n\tbandPosition: number;\n\tslotOffset: number;\n\tslotThickness: number;\n\tvaluePosition: number;\n\tbaseline: number;\n\twidthFactor: number;\n} ): ComparisonRect {\n\tconst {\n\t\thorizontal,\n\t\tbandPosition,\n\t\tslotOffset,\n\t\tslotThickness,\n\t\tvaluePosition,\n\t\tbaseline,\n\t\twidthFactor,\n\t} = params;\n\tconst slotStart = bandPosition + slotOffset;\n\tconst shadowThickness = slotThickness * widthFactor;\n\tconst shadowStart = slotStart + slotThickness / 2 - shadowThickness / 2;\n\tconst valueStart = Math.min( valuePosition, baseline );\n\tconst valueLength = Math.abs( baseline - valuePosition );\n\n\tif ( horizontal ) {\n\t\treturn { x: valueStart, y: shadowStart, width: valueLength, height: shadowThickness };\n\t}\n\treturn { x: shadowStart, y: valueStart, width: shadowThickness, height: valueLength };\n}\n","// Shared comparison-mode tuning constants. These drive the geometry of the\n// translucent \"shadow\" bars and how the primary bars are narrowed to sit in front of them.\n\n/**\n * How much wider the comparison shadow is than the primary bar. Fallback used when the\n * theme value (`barChart.barStyles.comparison.widthFactor`) is absent. Also drives the\n * primary narrowing — the primary stays `1 / widthFactor` of the shadow.\n */\nexport const DEFAULT_COMPARISON_WIDTH_FACTOR = 1.5;\n\n/**\n * Opacity of the comparison shadow. Fallback used when the theme value\n * (`barChart.barStyles.comparison.opacity`) is absent.\n */\nexport const DEFAULT_COMPARISON_OPACITY = 0.5;\n\n/**\n * Fraction of each per-series step left as a gap between bars within a single tick.\n * Larger = more space between adjacent series; the shadow spans `1 - COMPARISON_INNER_GAP` of the step.\n */\nexport const COMPARISON_INNER_GAP = 0.1;\n\n/**\n * Upper clamp on the computed group padding, so bars can never collapse to zero width\n * even at very large `widthFactor` values.\n */\nexport const MAX_GROUP_PADDING = 0.9;\n\n/**\n * Factor applied to the category band's `paddingInner` in comparison mode to tighten the\n * gap between ticks. `0.75` = a 25% reduction of the tick-gap padding.\n */\nexport const COMPARISON_TICK_GAP_FACTOR = 0.75;\n","import { scaleBand } from '@visx/scale';\nimport { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { computeComparisonRect, getValueScaleBaseline } from './comparison-bars-geometry';\nimport {\n\tDEFAULT_COMPARISON_OPACITY,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n} from './comparison-constants';\nimport type { ElementStyles, GetElementStylesParams } from '../../../providers';\nimport type { DataPointDate, SeriesData } from '../../../types';\nimport type { FC, ReactNode } from 'react';\n\n/*\n * `process.env.NODE_ENV` is replaced by the bundler at build time. Declare a\n * minimal `process` locally so this file type-checks as source under `jetpack:src`.\n */\ndeclare const process: { env: Record< string, string | undefined > };\n\nexport type ComparisonSeriesEntry = {\n\tseries: SeriesData;\n\tindex: number;\n\tprimaryKey: string;\n\t/** dataSorted index of the paired primary series (used to share its pattern fill). */\n\tprimaryIndex: number;\n};\n\n// Minimal shape we need from visx scales — avoids spreading `any` while\n// remaining compatible with both band and continuous scale return types.\ntype AnyScale = ( ( input: unknown ) => number ) & {\n\tbandwidth?: () => number;\n\trange: () => unknown[];\n};\n\n// Renders translucent \"shadow\" bars for comparison series behind their paired primary bars.\n// IMPORTANT: each comparison datum's category key (label or date) must exactly match a key\n// used by the primary series — if it doesn't, bandScale() returns undefined and the shadow\n// is silently skipped. Ensure comparison data reuses the same label/date values as primary.\nexport const ComparisonBars: FC< {\n\tcomparisonEntries: ComparisonSeriesEntry[];\n\tprimaryKeys: string[];\n\tgroupPadding: number;\n\thorizontal: boolean;\n\txAccessor: ( d: DataPointDate ) => string | number | Date | undefined;\n\tyAccessor: ( d: DataPointDate ) => number | undefined;\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles;\n\t/** Resolves the shadow fill — the paired primary's pattern when patterns are on, else a color. */\n\tresolveFill: ( entry: ComparisonSeriesEntry ) => string;\n} > = ( {\n\tcomparisonEntries,\n\tprimaryKeys,\n\tgroupPadding,\n\thorizontal,\n\txAccessor,\n\tyAccessor,\n\tgetElementStyles,\n\tresolveFill,\n} ) => {\n\tconst context = useContext( DataContext );\n\tconst xScale = context?.xScale as AnyScale | undefined;\n\tconst yScale = context?.yScale as AnyScale | undefined;\n\n\tif ( ! xScale || ! yScale || primaryKeys.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// Vertical: band axis is x, value axis is y. Horizontal: reversed.\n\tconst bandScale = ( horizontal ? yScale : xScale ) as AnyScale;\n\tconst valueScale = ( horizontal ? xScale : yScale ) as AnyScale;\n\n\tconst bandwidth = bandScale.bandwidth ? bandScale.bandwidth() : 0;\n\tif ( ! bandwidth ) {\n\t\treturn null;\n\t}\n\n\t// Rebuild visx's inner group scale exactly as BarGroup does.\n\tconst groupScale = scaleBand( {\n\t\tdomain: primaryKeys,\n\t\trange: [ 0, bandwidth ],\n\t\tpadding: groupPadding,\n\t} );\n\tconst slotThickness = groupScale.bandwidth();\n\tconst baseline = getValueScaleBaseline( valueScale );\n\n\t// Vertical uses xAccessor for category label; horizontal uses yAccessor.\n\tconst bandAccessor = horizontal ? yAccessor : xAccessor;\n\tconst valueAccessor = horizontal ? xAccessor : yAccessor;\n\n\tconst rects: ReactNode[] = [];\n\n\tcomparisonEntries.forEach( entry => {\n\t\tconst { series, index, primaryKey } = entry;\n\t\tconst slotOffset = groupScale( primaryKey );\n\t\tif ( slotOffset == null || ! Number.isFinite( slotOffset ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { barStyles } = getElementStyles( { data: series, index } );\n\t\tconst opacity = barStyles?.opacity ?? DEFAULT_COMPARISON_OPACITY; // safety net; CompleteChartTheme guarantees this value\n\t\tconst widthFactor = barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR;\n\t\t// Fill is the paired primary's pattern (when patterns are on) or its resolved color.\n\t\tconst fill = resolveFill( entry );\n\t\t// The shadow is `widthFactor` × the (narrowed) primary slot. bar-chart.tsx narrows the\n\t\t// primary bars by widening the group padding so this ratio holds with real geometry.\n\n\t\t( series.data as DataPointDate[] ).forEach( ( datum, i ) => {\n\t\t\tconst bandPosition = Number( bandScale( bandAccessor( datum ) as never ) );\n\t\t\tconst valuePosition = Number( valueScale( Number( valueAccessor( datum ) ) as never ) );\n\n\t\t\tif ( ! Number.isFinite( bandPosition ) || ! Number.isFinite( valuePosition ) ) {\n\t\t\t\tif ( process.env.NODE_ENV !== 'production' && ! Number.isFinite( bandPosition ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[Charts] ComparisonBars: datum key \"${ String(\n\t\t\t\t\t\t\tbandAccessor( datum )\n\t\t\t\t\t\t) }\" did not match any primary category. Shadow will not be rendered. ` +\n\t\t\t\t\t\t\t'Ensure comparison series data uses the same label/date keys as the primary series.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rect = computeComparisonRect( {\n\t\t\t\thorizontal,\n\t\t\t\tbandPosition,\n\t\t\t\tslotOffset: slotOffset as number,\n\t\t\t\tslotThickness,\n\t\t\t\tvaluePosition,\n\t\t\t\tbaseline,\n\t\t\t\twidthFactor,\n\t\t\t} );\n\n\t\t\trects.push(\n\t\t\t\t<rect\n\t\t\t\t\tkey={ `${ index }-${ i }` }\n\t\t\t\t\tdata-testid={ `bar-chart-comparison-${ index }-${ i }` }\n\t\t\t\t\tx={ rect.x }\n\t\t\t\t\ty={ rect.y }\n\t\t\t\t\twidth={ rect.width }\n\t\t\t\t\theight={ rect.height }\n\t\t\t\t\tfill={ fill }\n\t\t\t\t\topacity={ opacity }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t} );\n\n\tif ( rects.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<g\n\t\t\tclassName=\"bar-chart__comparison-bars\"\n\t\t\tpointerEvents=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t\tdata-testid=\"bar-chart-comparison-bars\"\n\t\t>\n\t\t\t{ rects }\n\t\t</g>\n\t);\n};\n","import { formatNumber } from '@automattic/number-formatters';\nimport { PatternLines, PatternCircles, PatternWaves, PatternHexagons } from '@visx/pattern';\nimport { Axis, BarSeries, BarGroup, Grid, XYChart } from '@visx/xychart';\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useState, useRef, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport {\n\tuseXYChartTheme,\n\tuseChartDataTransform,\n\tuseZeroValueDisplay,\n\tuseChartMargin,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './bar-chart.module.scss';\nimport {\n\tuseBarChartOptions,\n\tComparisonBars,\n\tDEFAULT_COMPARISON_WIDTH_FACTOR,\n\tCOMPARISON_INNER_GAP,\n\tMAX_GROUP_PADDING,\n\tCOMPARISON_TICK_GAP_FACTOR,\n\tBASE_BAND_PADDING_INNER,\n} from './private';\nimport type { ComparisonSeriesEntry } from './private';\nimport type { BaseChartProps, DataPointDate, SeriesData, Optional } from '../../types';\nimport type { RenderTooltipParams } from '../../visx/types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { FC, ReactNode, ComponentType } from 'react';\n\nexport interface BarChartProps extends BaseChartProps< SeriesData[] > {\n\trenderTooltip?: ( params: RenderTooltipParams< DataPointDate > ) => ReactNode;\n\torientation?: 'horizontal' | 'vertical';\n\twithPatterns?: boolean;\n\tshowZeroValues?: boolean;\n\tchildren?: ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype BarChartBaseProps = Optional< BarChartProps, 'width' | 'height' | 'size' >;\n\n// Composition API types\ninterface BarChartSubComponents {\n\tLegend: ComponentType< React.ComponentProps< typeof Legend > >;\n}\n\ntype BarChartComponent = FC< BarChartBaseProps > & BarChartSubComponents;\ntype BarChartResponsiveComponent = FC< BarChartBaseProps & ResponsiveConfig > &\n\tBarChartSubComponents;\n\n// Validation function similar to LineChart\nconst validateData = ( data: SeriesData[] ) => {\n\tif ( ! data?.length ) return 'No data available';\n\n\tconst hasInvalidData = data.some( series =>\n\t\tseries.data.some(\n\t\t\tpoint =>\n\t\t\t\tisNaN( point.value as number ) ||\n\t\t\t\tpoint.value === null ||\n\t\t\t\tpoint.value === undefined ||\n\t\t\t\t( ! point.label &&\n\t\t\t\t\t( ! ( 'date' in point && point.date ) || isNaN( point.date.getTime() ) ) )\n\t\t)\n\t);\n\n\tif ( hasInvalidData ) return 'Invalid data';\n\treturn null;\n};\n\nconst getPatternId = ( chartId: string, index: number ) => `bar-pattern-${ chartId }-${ index }`;\n\n// A \"label: value\" tooltip row. The join is a translated format string so the\n// separator (a colon + space here) can be adapted per locale.\nconst renderTooltipRow = ( label: string | undefined, value: string ) => (\n\t<div className={ styles[ 'bar-chart__tooltip-row' ] }>\n\t\t{ sprintf(\n\t\t\t/* translators: 1: data series, period, or category label. 2: its formatted value. */\n\t\t\t__( '%1$s: %2$s', 'jetpack-charts' ),\n\t\t\tlabel,\n\t\t\tvalue\n\t\t) }\n\t</div>\n);\n\nconst BarChartInternal: FC< BarChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth,\n\theight,\n\tclassName,\n\tmargin,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tgridVisibility: gridVisibilityProp,\n\trenderTooltip,\n\toptions = {},\n\torientation = 'vertical',\n\twithPatterns = false,\n\tshowZeroValues = false,\n\tanimation,\n\tchildren,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst horizontal = orientation === 'horizontal';\n\tconst chartId = useChartId( providedChartId );\n\tconst theme = useXYChartTheme( data );\n\n\tconst dataSorted = useChartDataTransform( data );\n\n\t// Transform data to add a small value for zero bars to make them visible\n\t// For vertical bars, height determines bar pixel height; for horizontal bars, width does\n\tconst dataWithVisibleZeros = useZeroValueDisplay( dataSorted, {\n\t\tenabled: showZeroValues,\n\t\tvalueAxisLength: horizontal ? width : height,\n\t} );\n\n\t// Create legend items using the reusable hook\n\tconst legendItems = useChartLegendItems( dataSorted );\n\tconst chartOptions = useBarChartOptions( dataWithVisibleZeros, horizontal, options );\n\tconst defaultMargin = useChartMargin( height, chartOptions, dataSorted, theme, horizontal );\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\n\t// Process children for composition API (Legend, etc.)\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'BarChart' );\n\tconst [ measuredChartHeight, setMeasuredChartHeight ] = useState< number | undefined >();\n\n\tconst handleContentHeightChange = useCallback(\n\t\t( contentHeight: number ) => {\n\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\t\t\tsetMeasuredChartHeight( chartHeight );\n\t\t},\n\t\t[ height ]\n\t);\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >( undefined );\n\tconst [ isNavigating, setIsNavigating ] = useState( false );\n\n\t// Comparison series have no .visx-bar elements; count only primary series so\n\t// keyboard navigation doesn't cycle phantom indices into comparison-only slots.\n\tconst primarySeriesForNav = dataWithVisibleZeros.filter( s => s.options?.type !== 'comparison' );\n\tconst totalPoints =\n\t\tMath.max( 0, ...primarySeriesForNav.map( s => s.data?.length || 0 ) ) *\n\t\tprimarySeriesForNav.length;\n\n\t// Use the keyboard navigation hook\n\tconst { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {\n\t\tselectedIndex,\n\t\tsetSelectedIndex,\n\t\tisNavigating,\n\t\tsetIsNavigating,\n\t\tchartRef,\n\t\ttotalPoints,\n\t} );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Add visibility information to series when using interactive legends\n\tconst seriesWithVisibility = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive ) {\n\t\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\t\tseries,\n\t\t\t\tindex,\n\t\t\t\tisVisible: true,\n\t\t\t} ) );\n\t\t}\n\t\treturn dataWithVisibleZeros.map( ( series, index ) => ( {\n\t\t\tseries,\n\t\t\tindex,\n\t\t\tisVisible: isSeriesVisible( chartId, series.label ),\n\t\t} ) );\n\t}, [ dataWithVisibleZeros, chartId, isSeriesVisible, legendInteractive ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\treturn seriesWithVisibility.every( ( { isVisible } ) => ! isVisible );\n\t}, [ seriesWithVisibility ] );\n\n\t// Derive primary vs comparison entries for comparison mode support.\n\tconst primaryEntries = useMemo(\n\t\t() =>\n\t\t\tseriesWithVisibility.filter(\n\t\t\t\t( { isVisible, series } ) => isVisible && series.options?.type !== 'comparison'\n\t\t\t),\n\t\t[ seriesWithVisibility ]\n\t);\n\n\tconst primaryKeys = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series.label ),\n\t\t[ primaryEntries ]\n\t);\n\n\t// The keyboard-navigation index space and the highlight CSS both stride over primary\n\t// bars only; the accessible tooltip must use the same list, or its datum diverges from\n\t// the highlighted bar once a comparison series shifts the indices.\n\tconst primarySeries = useMemo(\n\t\t() => primaryEntries.map( ( { series } ) => series ),\n\t\t[ primaryEntries ]\n\t);\n\n\tconst comparisonEntries = useMemo( () => {\n\t\tconst primaryByGroup = new Map< string | undefined, { label: string; index: number } >(\n\t\t\tprimaryEntries.map( ( { series, index } ) => [\n\t\t\t\tseries.group,\n\t\t\t\t{ label: series.label, index },\n\t\t\t] )\n\t\t);\n\n\t\tconst entries: ComparisonSeriesEntry[] = [];\n\t\tseriesWithVisibility.forEach( ( { series, index, isVisible } ) => {\n\t\t\tif ( ! isVisible || series.options?.type !== 'comparison' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst primary =\n\t\t\t\tprimaryByGroup.get( series.group ) ??\n\t\t\t\t( primaryEntries.length === 1\n\t\t\t\t\t? { label: primaryEntries[ 0 ].series.label, index: primaryEntries[ 0 ].index }\n\t\t\t\t\t: undefined );\n\t\t\tif ( ! primary || ! primaryKeys.includes( primary.label ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tentries.push( { series, index, primaryKey: primary.label, primaryIndex: primary.index } );\n\t\t} );\n\t\treturn entries;\n\t}, [ seriesWithVisibility, primaryEntries, primaryKeys ] );\n\n\t// Comparison widthFactor (how much wider the shadow is than the primary) drives both the\n\t// shadow width (in ComparisonBars) and the primary narrowing.\n\tconst comparisonWidthFactor = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) return undefined;\n\t\treturn (\n\t\t\tgetElementStyles( {\n\t\t\t\tdata: comparisonEntries[ 0 ].series,\n\t\t\t\tindex: comparisonEntries[ 0 ].index,\n\t\t\t} ).barStyles?.widthFactor ?? DEFAULT_COMPARISON_WIDTH_FACTOR\n\t\t);\n\t}, [ comparisonEntries, getElementStyles ] );\n\n\t// Narrow the primary bars by widening the visx group padding — a real geometry change, so\n\t// pattern fills and borders are not distorted (unlike a CSS transform/scale). The padding is\n\t// set so the comparison shadow (drawn at slot × widthFactor) fills all but a small gap of each\n\t// per-series step, leaving a small gap between series within a tick (the larger gap between\n\t// ticks comes from the category band's own padding). Because shadow = step × (1 - p) ×\n\t// widthFactor, choosing p = 1 - (1 - innerGap)/widthFactor makes the shadow span (1 - innerGap)\n\t// of the step; the primary stays 1/widthFactor of the shadow.\n\tconst groupPadding = useMemo( () => {\n\t\tconst basePadding = chartOptions.barGroup.padding;\n\t\tif ( ! comparisonWidthFactor || comparisonWidthFactor <= 1 ) {\n\t\t\treturn basePadding;\n\t\t}\n\t\tconst p = 1 - ( 1 - COMPARISON_INNER_GAP ) / comparisonWidthFactor;\n\t\treturn Math.min( Math.max( p, basePadding ), MAX_GROUP_PADDING );\n\t}, [ chartOptions.barGroup.padding, comparisonWidthFactor ] );\n\n\t// In comparison mode, tighten the gap between ticks by reducing the category band's inner\n\t// padding (the value axis is left untouched). COMPARISON_TICK_GAP_FACTOR is the multiplier.\n\tconst { xScale, yScale } = useMemo( () => {\n\t\tif ( comparisonEntries.length === 0 ) {\n\t\t\treturn { xScale: chartOptions.xScale, yScale: chartOptions.yScale };\n\t\t}\n\t\tconst tighten = < T extends object >( scale: T ): T =>\n\t\t\t( {\n\t\t\t\t...scale,\n\t\t\t\tpaddingInner:\n\t\t\t\t\t( ( scale as { paddingInner?: number } ).paddingInner ?? BASE_BAND_PADDING_INNER ) *\n\t\t\t\t\tCOMPARISON_TICK_GAP_FACTOR,\n\t\t\t} ) as T;\n\t\treturn horizontal\n\t\t\t? { xScale: chartOptions.xScale, yScale: tighten( chartOptions.yScale ) }\n\t\t\t: { xScale: tighten( chartOptions.xScale ), yScale: chartOptions.yScale };\n\t}, [ comparisonEntries.length, chartOptions.xScale, chartOptions.yScale, horizontal ] );\n\n\tconst getBarBackground = useCallback(\n\t\t( index: number ) => () =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, index ) })`\n\t\t\t\t: getElementStyles( { data: dataSorted[ index ], index } ).color,\n\t\t[ withPatterns, getElementStyles, dataSorted, chartId ]\n\t);\n\n\t// Comparison shadow fill: when patterns are on, reuse the paired primary's pattern so the\n\t// shadow reads as the same series; otherwise use the comparison series' resolved color.\n\tconst resolveComparisonFill = useCallback(\n\t\t( entry: ComparisonSeriesEntry ) =>\n\t\t\twithPatterns\n\t\t\t\t? `url(#${ getPatternId( chartId, entry.primaryIndex ) })`\n\t\t\t\t: getElementStyles( { data: entry.series, index: entry.index } ).color,\n\t\t[ withPatterns, chartId, getElementStyles ]\n\t);\n\n\tconst renderDefaultTooltip = useCallback(\n\t\t( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {\n\t\t\tconst nearestDatum = tooltipData?.nearestDatum?.datum;\n\t\t\tif ( ! nearestDatum ) return null;\n\n\t\t\tconst primaryKey = tooltipData?.nearestDatum?.key;\n\t\t\tconst categoryLabel = chartOptions.tooltip.labelFormatter(\n\t\t\t\tnearestDatum.label || ( nearestDatum.date ? nearestDatum.date.getTime() : 0 ),\n\t\t\t\t0,\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\t// Find the comparison value paired with the hovered primary series (same group)\n\t\t\t// at the same category, so the tooltip can show both periods at once.\n\t\t\tconst comparisonEntry = comparisonEntries.find( entry => entry.primaryKey === primaryKey );\n\t\t\tconst comparisonDatum = comparisonEntry?.series.data.find( point => {\n\t\t\t\tconst p = point as DataPointDate;\n\t\t\t\treturn nearestDatum.label != null\n\t\t\t\t\t? p.label === nearestDatum.label\n\t\t\t\t\t: !! nearestDatum.date && !! p.date && p.date.getTime() === nearestDatum.date.getTime();\n\t\t\t} ) as DataPointDate | undefined;\n\n\t\t\t// With a paired comparison value, show the category as the header and one row\n\t\t\t// per period (primary + comparison).\n\t\t\tif ( comparisonEntry && comparisonDatum && comparisonDatum.value != null ) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ categoryLabel }</div>\n\t\t\t\t\t\t{ renderTooltipRow( primaryKey, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t\t\t{ renderTooltipRow(\n\t\t\t\t\t\t\tcomparisonEntry.series.label,\n\t\t\t\t\t\t\tformatNumber( comparisonDatum.value as number )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div className={ styles[ 'bar-chart__tooltip' ] }>\n\t\t\t\t\t<div className={ styles[ 'bar-chart__tooltip-header' ] }>{ primaryKey }</div>\n\t\t\t\t\t{ renderTooltipRow( categoryLabel, formatNumber( nearestDatum.value as number ) ) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[ chartOptions.tooltip, comparisonEntries ]\n\t);\n\n\tconst renderPattern = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternType = index % 4;\n\t\t\tconst id = getPatternId( chartId, index );\n\t\t\tconst commonProps = {\n\t\t\t\tid,\n\t\t\t\tstroke: 'white',\n\t\t\t\tstrokeWidth: 1,\n\t\t\t\tbackground: color,\n\t\t\t};\n\n\t\t\tswitch ( patternType ) {\n\t\t\t\tcase 0:\n\t\t\t\tdefault:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternLines\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\twidth={ 5 }\n\t\t\t\t\t\t\theight={ 5 }\n\t\t\t\t\t\t\torientation={ [ 'diagonal' ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\tcase 1:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PatternCircles key={ id } { ...commonProps } width={ 6 } height={ 6 } fill=\"white\" />\n\t\t\t\t\t);\n\t\t\t\tcase 2:\n\t\t\t\t\treturn <PatternWaves key={ id } { ...commonProps } width={ 4 } height={ 4 } />;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn <PatternHexagons key={ id } { ...commonProps } size={ 8 } height={ 3 } />;\n\t\t\t}\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createPatternBorderStyle = useCallback(\n\t\t( index: number, color: string ) => {\n\t\t\tconst patternId = getPatternId( chartId, index );\n\t\t\t// Border the primary bars and any comparison shadow reusing the same pattern,\n\t\t\t// so a patterned shadow gets the same outline as its primary bar.\n\t\t\treturn `\n\t\t\t.visx-bar[fill=\"url(#${ patternId })\"],\n\t\t\t.bar-chart__comparison-bars rect[fill=\"url(#${ patternId })\"] {\n\t\t\t\tstroke: ${ color };\n\t\t\t\tstroke-width: 1;\n\t\t\t\t}\n\t\t\t`;\n\t\t},\n\t\t[ chartId ]\n\t);\n\n\tconst createKeyboardHighlightStyle = useCallback( () => {\n\t\tif ( selectedIndex === undefined ) return '';\n\n\t\t// Use only primary entries — comparison series have no .visx-bar elements so\n\t\t// their indices must not appear in the nth-child selector.\n\t\t// Pattern: [series1[0], series2[0], series3[0], series1[1], series2[1], series3[1], ...]\n\t\tconst primaryCount = primaryEntries.length;\n\t\tconst maxDataPoints = Math.max( ...primaryEntries.map( e => e.series.data.length ) );\n\t\tconst dataPointIndex = Math.floor( selectedIndex / primaryCount );\n\t\tconst seriesIndex = selectedIndex % primaryCount;\n\n\t\t// Only highlight if we're within valid bounds\n\t\tif ( dataPointIndex >= maxDataPoints || seriesIndex >= primaryCount ) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst seriesData = primaryEntries[ seriesIndex ]?.series;\n\t\tif ( ! seriesData || dataPointIndex >= seriesData.data.length ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Based on the DOM structure analysis:\n\t\t// - All bars are in a single .visx-bar-group\n\t\t// - Bars are ordered as: [series1[0], series1[1], series2[0], series2[1], ...]\n\t\t// - So we need to calculate the actual bar index in the DOM\n\t\tconst actualBarIndex = seriesIndex * maxDataPoints + dataPointIndex;\n\n\t\t// Use a CSS class selector instead of ID since useId() generates invalid CSS ID characters\n\t\tconst generatedStyles = `\n\t\t\t.bar-chart[data-chart-id=\"bar-chart-${ chartId }\"] .visx-bar-group .visx-bar:nth-child(${\n\t\t\t\tactualBarIndex + 1\n\t\t\t}) {\n\t\t\t\tstroke: #005fcc;\n\t\t\t\tstroke-width: 2px;\n\t\t\t}\n\t\t`;\n\n\t\treturn generatedStyles;\n\t}, [ selectedIndex, primaryEntries, chartId ] );\n\n\t// Validate data first\n\tconst error = validateData( dataSorted );\n\tconst isDataValid = ! error;\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\torientation,\n\t\t\twithPatterns,\n\t\t} ),\n\t\t[ orientation, withPatterns ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'bar',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( error ) {\n\t\treturn <div className={ clsx( 'bar-chart', styles[ 'bar-chart' ] ) }>{ error }</div>;\n\t}\n\n\tconst gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;\n\tconst highlightedBarStyle = createKeyboardHighlightStyle();\n\n\tconst legendPosition = legend.position ?? 'bottom';\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tclassName={ styles[ 'bar-chart__legend' ] }\n\t\t\tshape={ legend.shape ?? 'rect' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tchartId,\n\t\t\t\tchartWidth: width,\n\t\t\t\tchartHeight: measuredChartHeight || 0,\n\t\t\t} }\n\t\t>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'bar-chart',\n\t\t\t\t\tstyles[ 'bar-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ `bar-chart--animated${ horizontal ? '-horizontal' : '' }` ] ]:\n\t\t\t\t\t\t\tanimation && ! prefersReducedMotion,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { width, height } }\n\t\t\t\tdata-testid=\"bar-chart\"\n\t\t\t\tdata-chart-id={ `bar-chart-${ chartId }` }\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\tonContentHeightChange={ handleContentHeightChange }\n\t\t\t>\n\t\t\t\t{ ( { contentHeight } ) => {\n\t\t\t\t\tconst chartHeight = contentHeight > 0 ? contentHeight : height;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\taria-label={ __( 'Bar chart', 'jetpack-charts' ) }\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\t\tonFocus={ onChartFocus }\n\t\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ chartHeight > 0 && (\n\t\t\t\t\t\t\t\t<div ref={ chartRef }>\n\t\t\t\t\t\t\t\t\t<XYChart\n\t\t\t\t\t\t\t\t\t\ttheme={ theme }\n\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\tmargin={ {\n\t\t\t\t\t\t\t\t\t\t\t...defaultMargin,\n\t\t\t\t\t\t\t\t\t\t\t...margin,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\txScale={ xScale }\n\t\t\t\t\t\t\t\t\t\tyScale={ yScale }\n\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\tpointerEventsDataKey=\"nearest\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\t\t\tcolumns={ gridVisibility.includes( 'y' ) }\n\t\t\t\t\t\t\t\t\t\t\trows={ gridVisibility.includes( 'x' ) }\n\t\t\t\t\t\t\t\t\t\t\tnumTicks={ 4 }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t{ withPatterns && (\n\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t<defs data-testid=\"bar-chart-patterns\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trenderPattern(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ dataSorted.map( ( seriesData, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreatePatternBorderStyle(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetElementStyles( { data: seriesData, index } ).color\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t\t{ highlightedBarStyle && <style>{ highlightedBarStyle }</style> }\n\n\t\t\t\t\t\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t\t\t\t\t\t<SvgEmptyState\n\t\t\t\t\t\t\t\t\t\t\t\tx={ width / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\ty={ chartHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ chartHeight }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'All series are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t\t) : null }\n\n\t\t\t\t\t\t\t\t\t\t<ComparisonBars\n\t\t\t\t\t\t\t\t\t\t\tcomparisonEntries={ comparisonEntries }\n\t\t\t\t\t\t\t\t\t\t\tprimaryKeys={ primaryKeys }\n\t\t\t\t\t\t\t\t\t\t\tgroupPadding={ groupPadding }\n\t\t\t\t\t\t\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\tyAccessor={\n\t\t\t\t\t\t\t\t\t\t\t\tchartOptions.accessors.yAccessor as (\n\t\t\t\t\t\t\t\t\t\t\t\t\td: DataPointDate\n\t\t\t\t\t\t\t\t\t\t\t\t) => number | undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tgetElementStyles={ getElementStyles }\n\t\t\t\t\t\t\t\t\t\t\tresolveFill={ resolveComparisonFill }\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t<BarGroup padding={ groupPadding }>\n\t\t\t\t\t\t\t\t\t\t\t{ primaryEntries.map( ( { series: seriesData, index } ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BarSeries\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdataKey={ seriesData?.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata={ seriesData.data as DataPointDate[] }\n\t\t\t\t\t\t\t\t\t\t\t\t\tyAccessor={ chartOptions.accessors.yAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\txAccessor={ chartOptions.accessors.xAccessor }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorAccessor={ getBarBackground( index ) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t\t</BarGroup>\n\n\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.x } />\n\t\t\t\t\t\t\t\t\t\t<Axis { ...chartOptions.axis.y } />\n\n\t\t\t\t\t\t\t\t\t\t{ withTooltips && (\n\t\t\t\t\t\t\t\t\t\t\t<AccessibleTooltip\n\t\t\t\t\t\t\t\t\t\t\t\tdetectBounds\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumX\n\t\t\t\t\t\t\t\t\t\t\t\tsnapTooltipToDatumY\n\t\t\t\t\t\t\t\t\t\t\t\trenderTooltip={ renderTooltip || renderDefaultTooltip }\n\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipRef={ tooltipRef }\n\t\t\t\t\t\t\t\t\t\t\t\tkeyboardFocusedClassName={\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyles[ 'bar-chart__tooltip--keyboard-focused' ]\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tseries={ primarySeries }\n\t\t\t\t\t\t\t\t\t\t\t\tmode=\"individual\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</XYChart>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst BarChartWithProvider: FC< BarChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <BarChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarChartWithProvider.displayName = 'BarChart';\n\n// Create BarChart with composition API\nconst BarChart = attachSubComponents( BarChartWithProvider, {\n\tLegend: Legend,\n} ) as BarChartComponent;\n\n// Create responsive BarChart with composition API\nconst BarChartResponsive = attachSubComponents(\n\twithResponsive< BarChartProps >( BarChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n) as BarChartResponsiveComponent;\n\nexport { BarChartResponsive as default, BarChart as BarChartUnresponsive };\n","import { formatNumberCompact } from '@automattic/number-formatters';\nimport { Group } from '@visx/group';\nimport { createScale, scaleBand } from '@visx/scale';\nimport { Text, type TextProps } from '@visx/text';\nimport { useContext, useMemo } from 'react';\nimport { GlobalChartsContext, GlobalChartsProvider } from '../../providers';\nimport { BarChartUnresponsive } from '../bar-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport type { SeriesData } from '../..';\nimport type { ScaleOptions } from '../../types';\nimport type { BarChartProps } from '../bar-chart/bar-chart';\nimport type { AxisRendererProps, AxisScale } from '@visx/axis';\nimport type { AnyD3Scale } from '@visx/scale';\nimport type { ComponentType, FC } from 'react';\n\nexport interface BarListChartProps\n\textends Exclude< BarChartProps, 'orientation' | 'size' | 'gridVisibility' > {\n\toptions?: {\n\t\t/**\n\t\t * Scale for the y axis. Exclude the type property.\n\t\t */\n\t\tyScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Scale for the x axis. Exclude the type property.\n\t\t */\n\t\txScale: Omit< ScaleOptions, 'type' >;\n\t\t/**\n\t\t * Formatter for the label.\n\t\t */\n\t\tlabelFormatter?: ( value: string ) => string;\n\t\t/**\n\t\t * Formatter for the value.\n\t\t */\n\t\tvalueFormatter?: ( value: number ) => string;\n\t\t/**\n\t\t * y offset of the label and value. Default is based on the number of series, automatically computed.\n\t\t */\n\t\tyOffset?: number;\n\t\t/**\n\t\t * x position of the label.\n\t\t */\n\t\tlabelPosition?: number;\n\t\t/**\n\t\t * x position of the value.\n\t\t */\n\t\tvaluePosition?: number;\n\t\t/**\n\t\t * Custom render function for the label.\n\t\t */\n\t\tlabelComponent?: ComponentType< RenderLabelProps >;\n\t\t/**\n\t\t * Custom render function for the value.\n\t\t */\n\t\tvalueComponent?: ComponentType< RenderValueProps >;\n\t};\n}\n\nexport interface RenderLabelProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tlabel: string;\n\tformatter: ( value: string ) => string;\n}\n\nexport interface RenderValueProps {\n\ttextProps: TextProps;\n\tx: number;\n\ty: number;\n\tvalue: number;\n\t/**\n\t * Original data\n\t */\n\tdata: SeriesData[];\n\t/**\n\t * Index of the data point\n\t */\n\tindex: number;\n\tformatter: ( value: number ) => string;\n}\n\n/**\n * Get the bandwidth of a scale\n * @param scale - The scale to get the bandwidth of\n * @return The bandwidth of the scale\n */\nconst getScaleBandwidth = < Scale extends AxisScale >( scale?: Scale ) => {\n\t// Broaden type before using 'xxx' in s as typeguard.\n\tconst s = scale as AxisScale;\n\treturn s && 'bandwidth' in s ? s?.bandwidth() ?? 0 : 0;\n};\n\nconst DefaultLabelComponent = ( { textProps, x, y, label, formatter } ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"start\" x={ x } y={ y }>\n\t\t\t{ formatter( label ) }\n\t\t</Text>\n\t);\n};\n\nconst DefaultValueComponent = ( { textProps, x, y, value, formatter }: RenderValueProps ) => {\n\treturn (\n\t\t<Text { ...textProps } textAnchor=\"end\" x={ x } y={ y } fontWeight={ 500 }>\n\t\t\t{ formatter( value ) }\n\t\t</Text>\n\t);\n};\n\nconst AxisRenderer = ( {\n\tticks,\n\ttickLabelProps,\n\tyOffset,\n\tlabelPosition,\n\tvaluePosition,\n\tdata,\n\tlabelFormatter,\n\tvalueFormatter,\n\tLabelComponent = DefaultLabelComponent,\n\tValueComponent = DefaultValueComponent,\n}: AxisRendererProps< AnyD3Scale > & {\n\tyOffset: number;\n\tlabelPosition: number;\n\tvaluePosition: number;\n\tdata: SeriesData[];\n\tlabelFormatter?: ( value: string ) => string;\n\tvalueFormatter?: ( value: number ) => string;\n\tLabelComponent?: ComponentType< RenderLabelProps >;\n\tValueComponent?: ComponentType< RenderValueProps >;\n} ) => {\n\tif ( ticks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\t// compute the max tick label size to compute label offset\n\tconst allTickLabelProps = ticks.map( ( { value, index } ) =>\n\t\ttypeof tickLabelProps === 'function' ? tickLabelProps( value, index, ticks ) : {}\n\t);\n\n\treturn ticks.map( ( { from, formattedValue }, index ) => {\n\t\tconst textProps = allTickLabelProps[ index ] ?? {};\n\t\t// No need to pass textAnchor and dx. It will be handled by the component.\n\t\tdelete textProps.textAnchor;\n\t\tdelete textProps.dx;\n\n\t\tconst sum = data.reduce(\n\t\t\t( acc, { data: seriesData } ) => acc + ( seriesData[ index ]?.value ?? 0 ),\n\t\t\t0\n\t\t);\n\t\tconst y = from.y + yOffset;\n\n\t\treturn (\n\t\t\t<Group key={ index }>\n\t\t\t\t<LabelComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ labelPosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tlabel={ formattedValue }\n\t\t\t\t\tformatter={ labelFormatter }\n\t\t\t\t/>\n\t\t\t\t<ValueComponent\n\t\t\t\t\ttextProps={ textProps }\n\t\t\t\t\tx={ valuePosition }\n\t\t\t\t\ty={ y }\n\t\t\t\t\tvalue={ sum }\n\t\t\t\t\tformatter={ valueFormatter }\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tindex={ index }\n\t\t\t\t/>\n\t\t\t</Group>\n\t\t);\n\t} );\n};\n\n/**\n * Calculate the default y offset for the bar list chart.\n * @param data - The data to calculate the default y offset for.\n * @param yScaleConfig - The y scale configuration.\n * @param height - The height of the chart.\n * @param isMultiSeries - Whether the chart is a multi series chart.\n * @return The default y offset.\n */\nconst getDefaultYOffset = (\n\tdata: SeriesData[],\n\tyScaleConfig: Omit< ScaleOptions, 'type' >,\n\theight: number,\n\tisMultiSeries: boolean\n) => {\n\tif ( ! isMultiSeries ) {\n\t\treturn 0;\n\t}\n\n\tconst dataKeys = data.map( ( { label } ) => label );\n\n\tconst yScale = createScale< string >( {\n\t\ttype: 'band' as const,\n\t\trange: [ 0, height ],\n\t\tdomain: dataKeys,\n\t\t...yScaleConfig,\n\t} );\n\n\tconst groupScale = scaleBand< string >( {\n\t\tdomain: dataKeys,\n\t\trange: [ 0, getScaleBandwidth( yScale ) ],\n\t\tpadding: yScaleConfig.paddingInner,\n\t} );\n\n\tconst GAP_BETWEEN_BARS = 6;\n\tconst barThickness = getScaleBandwidth( groupScale );\n\n\t// Use negative value to move the label up.\n\treturn -( barThickness + GAP_BETWEEN_BARS );\n};\n\nconst BarListChartInternal: FC< BarListChartProps > = ( {\n\tdata,\n\twidth,\n\theight,\n\toptions = {},\n\tmargin = {\n\t\tleft: 0,\n\t\tright: 20,\n\t\tbottom: 0,\n\t\ttop: 0,\n\t},\n\t...rest\n} ) => {\n\tconst chartOptions = useMemo( () => {\n\t\tconst isMultiSeries = data.length > 1;\n\n\t\tconst defaultYScale = {\n\t\t\t// For multi series, set default padding larger to look better.\n\t\t\tpaddingInner: isMultiSeries ? 0.3 : 0.1,\n\t\t\tpadding: isMultiSeries ? 0.3 : 0.1,\n\t\t};\n\t\tconst defaultXScale = {\n\t\t\t// Always begin at zero since the x axis is hidden.\n\t\t\tzero: true,\n\t\t};\n\t\tconst yScale = {\n\t\t\t...defaultYScale,\n\t\t\t...( options.yScale ?? {} ),\n\t\t};\n\t\tconst xScale = {\n\t\t\t...defaultXScale,\n\t\t\t...( options.xScale ?? {} ),\n\t\t};\n\n\t\treturn {\n\t\t\tyScale,\n\t\t\txScale,\n\t\t\tlabelPosition: options.labelPosition ?? ( isMultiSeries ? 0 : 10 ),\n\t\t\tvalueFormatter: options.valueFormatter ?? ( value => formatNumberCompact( value ) ),\n\t\t\tlabelFormatter: options.labelFormatter ?? ( value => String( value ) ),\n\t\t\tvaluePosition: options.valuePosition ?? width,\n\t\t\tyOffset: options.yOffset ?? getDefaultYOffset( data, yScale, height, isMultiSeries ),\n\t\t};\n\t}, [ options, width, data, height ] );\n\n\treturn (\n\t\t<BarChartUnresponsive\n\t\t\torientation=\"horizontal\"\n\t\t\tgridVisibility={ 'none' }\n\t\t\tdata={ data }\n\t\t\twidth={ width }\n\t\t\theight={ height }\n\t\t\tmargin={ margin }\n\t\t\toptions={ {\n\t\t\t\taxis: {\n\t\t\t\t\ty: {\n\t\t\t\t\t\tchildren: ( renderProps: AxisRendererProps< AnyD3Scale > ) => (\n\t\t\t\t\t\t\t<AxisRenderer\n\t\t\t\t\t\t\t\t{ ...renderProps }\n\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\tyOffset={ chartOptions.yOffset }\n\t\t\t\t\t\t\t\tlabelPosition={ chartOptions.labelPosition }\n\t\t\t\t\t\t\t\tvaluePosition={ chartOptions.valuePosition }\n\t\t\t\t\t\t\t\tlabelFormatter={ chartOptions.labelFormatter }\n\t\t\t\t\t\t\t\tvalueFormatter={ chartOptions.valueFormatter }\n\t\t\t\t\t\t\t\tLabelComponent={ options.labelComponent }\n\t\t\t\t\t\t\t\tValueComponent={ options.valueComponent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tx: {\n\t\t\t\t\t\tchildren: () => null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\txScale: chartOptions.xScale,\n\t\t\t\tyScale: chartOptions.yScale,\n\t\t\t} }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nconst BarListChart: FC< BarListChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, render the core component directly\n\tif ( existingContext ) {\n\t\treturn <BarListChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, wrap with our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<BarListChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nBarListChart.displayName = 'BarListChart';\n\nconst BarListChartResponsive = withResponsive< BarListChartProps >( BarListChart );\n\nexport { BarListChartResponsive as default, BarListChart as BarListChartUnresponsive };\n","import { useCallback, useState } from 'react';\n\n/**\n * Custom hook to manage funnel bar selection state and interactions\n * @param hideTooltip - Function to hide tooltip when selection is cleared\n * @return Object containing selection state and event handlers\n */\nexport const useFunnelSelection = ( hideTooltip?: () => void ) => {\n\tconst [ clickedStep, setClickedStep ] = useState< string | null >( null );\n\n\t// Handle bar click\n\tconst handleBarClick = useCallback(\n\t\t( stepId: string ) => {\n\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t// If clicking the same step, deselect it\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t} else {\n\t\t\t\t// Otherwise, select this step\n\t\t\t\tsetClickedStep( stepId );\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Handle bar keydown\n\tconst handleBarKeyDown = useCallback(\n\t\t( stepId: string, event: React.KeyboardEvent ) => {\n\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( clickedStep === stepId ) {\n\t\t\t\t\tsetClickedStep( null );\n\t\t\t\t\thideTooltip?.();\n\t\t\t\t} else {\n\t\t\t\t\tsetClickedStep( stepId );\n\t\t\t\t}\n\t\t\t} else if ( event.key === 'Escape' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetClickedStep( null );\n\t\t\t\thideTooltip?.();\n\t\t\t}\n\t\t},\n\t\t[ clickedStep, hideTooltip ]\n\t);\n\n\t// Clear selection (for chart-level click)\n\tconst clearSelection = useCallback( () => {\n\t\tsetClickedStep( null );\n\t\thideTooltip?.();\n\t}, [ hideTooltip ] );\n\n\t// Get step state helpers\n\tconst getStepState = useCallback(\n\t\t( stepId: string ) => ( {\n\t\t\tisClicked: clickedStep === stepId,\n\t\t\tisBlurred: clickedStep !== null && clickedStep !== stepId,\n\t\t} ),\n\t\t[ clickedStep ]\n\t);\n\n\treturn {\n\t\tclickedStep,\n\t\thandleBarClick,\n\t\thandleBarKeyDown,\n\t\tclearSelection,\n\t\tgetStepState,\n\t};\n};\n","import { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { type FC, useRef, useMemo, useEffect, useCallback, useContext } from 'react';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tGlobalChartsContext,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsTheme,\n\tuseGlobalChartsContext,\n} from '../../providers';\nimport { formatPercentage, hexToRgba } from '../../utils';\nimport styles from './conversion-funnel-chart.module.scss';\nimport { useFunnelSelection } from './private';\nimport type { FunnelStep, ConversionFunnelChartProps } from './types';\n\n/**\n * Internal ConversionFunnelChart component with chart registration\n *\n * @param props - Component props\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.mainRate - Main conversion rate to highlight\n * @param props.changeIndicator - Change indicator (e.g., +2%, -1.5%)\n * @param props.steps - Array of funnel steps\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether to show chart animation on initial render or not\n * @param props.className - Additional CSS class name\n * @param props.height - Height of the chart container. Falls back to style.height if set, otherwise defaults to \"100%\".\n * @param props.style - Custom styling\n * @param props.renderStepLabel - Custom render function for step labels\n * @param props.renderStepRate - Custom render function for step rates\n * @param props.renderMainMetric - Custom render function for the entire main metric section\n * @param props.renderTooltip - Custom render function for tooltip content\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartInternal: FC< ConversionFunnelChartProps > = ( {\n\tmainRate,\n\tchangeIndicator,\n\tsteps,\n\tloading = false,\n\tanimation,\n\tclassName,\n\tchartId: providedChartId,\n\theight,\n\tstyle,\n\trenderStepLabel,\n\trenderStepRate,\n\trenderMainMetric,\n\trenderTooltip,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { conversionFunnelChart: conversionFunnelChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles, isColorPaletteResolved } = useGlobalChartsContext();\n\tconst chartRef = useRef< HTMLDivElement >( null );\n\tconst selectedBarRef = useRef< HTMLDivElement | null >( null );\n\n\t// Use @visx/tooltip hooks for tooltip positioning\n\tconst { tooltipData, tooltipLeft, tooltipTop, tooltipOpen, showTooltip, hideTooltip } =\n\t\tuseTooltip();\n\n\t// Use custom hook for selection management\n\tconst { handleBarClick, handleBarKeyDown, clearSelection, getStepState } =\n\t\tuseFunnelSelection( hideTooltip );\n\tconst {\n\t\tcontainerRef: portalContainerRef,\n\t\tTooltipInPortal,\n\t\tcontainerBounds,\n\t} = useTooltipInPortal( {\n\t\t// use TooltipWithBounds for boundary detection\n\t\tdetectBounds: true,\n\t\t// when tooltip containers are scrolled, this will correctly update the Tooltip position\n\t\tscroll: true,\n\t} );\n\n\t// Wrapper to clear selectedBarRef after clearing selection\n\tconst clearSelectionAndRef = useCallback( () => {\n\t\tclearSelection();\n\t\tselectedBarRef.current = null;\n\t\thideTooltip();\n\t}, [ clearSelection, hideTooltip ] );\n\n\t// Helper function to show tooltip at specific coordinates\n\tconst showTooltipAt = useCallback(\n\t\t( step: FunnelStep, x: number, y: number ) => {\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: step,\n\t\t\t\ttooltipLeft: x,\n\t\t\t\ttooltipTop: y - 10,\n\t\t\t} );\n\t\t},\n\t\t[ showTooltip ]\n\t);\n\n\t// Helper function to get tooltip coordinates for mouse events\n\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t// By passing (clientX - containerBounds.left), we get correct page coordinates\n\t// regardless of whether bounds are stale (e.g., after dashboard customization).\n\tconst getMouseTooltipCoords = useCallback(\n\t\t( event: React.MouseEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tx: event.clientX - containerBounds.left,\n\t\t\t\ty: event.clientY - containerBounds.top,\n\t\t\t};\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to get tooltip coordinates for keyboard events\n\t// Use fresh getBoundingClientRect() and subtract containerBounds to cancel out stale offset.\n\tconst getKeyboardTooltipCoords = useCallback(\n\t\t( event: React.KeyboardEvent ) => {\n\t\t\t// Don't return coords until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst rect = event.currentTarget.getBoundingClientRect();\n\t\t\t// Calculate center of element in viewport coordinates, then subtract containerBounds\n\t\t\tconst x = rect.left + rect.width / 2 - containerBounds.left;\n\t\t\tconst y = rect.top - containerBounds.top;\n\t\t\treturn { x, y };\n\t\t},\n\t\t[ containerBounds.width, containerBounds.height, containerBounds.left, containerBounds.top ]\n\t);\n\n\t// Helper function to handle step interaction (both click and keyboard)\n\tconst handleStepInteraction = useCallback(\n\t\t(\n\t\t\tstep: FunnelStep,\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tinteractionType: 'click' | 'keyboard'\n\t\t) => {\n\t\t\t// Store reference to the interacted element\n\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\n\t\t\t// Check if deselecting the same step\n\t\t\tconst { isClicked } = getStepState( step.id );\n\t\t\tif ( isClicked ) {\n\t\t\t\t// Deselecting - clear selection (tooltip will be hidden by hook)\n\t\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\t\thandleBarClick( step.id );\n\t\t\t\t} else {\n\t\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Selecting - handle selection and show tooltip\n\t\t\tif ( interactionType === 'click' ) {\n\t\t\t\thandleBarClick( step.id );\n\t\t\t\tconst coords = getMouseTooltipCoords( event as React.MouseEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandleBarKeyDown( step.id, event as React.KeyboardEvent );\n\t\t\t\tconst coords = getKeyboardTooltipCoords( event as React.KeyboardEvent );\n\t\t\t\tif ( coords ) {\n\t\t\t\t\tshowTooltipAt( step, coords.x, coords.y );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetStepState,\n\t\t\thandleBarClick,\n\t\t\thandleBarKeyDown,\n\t\t\tshowTooltipAt,\n\t\t\tgetMouseTooltipCoords,\n\t\t\tgetKeyboardTooltipCoords,\n\t\t]\n\t);\n\n\t// Create handler factories to avoid arrow functions in JSX\n\tconst stepHandlers = useMemo( () => {\n\t\tconst handlers = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tonClick: ( event: React.MouseEvent ) => void;\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => void;\n\t\t\t}\n\t\t>();\n\n\t\tsteps.forEach( step => {\n\t\t\tconst onClick = ( event: React.MouseEvent ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\thandleStepInteraction( step, event, 'click' );\n\t\t\t};\n\n\t\t\tconst onKeyDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\thandleStepInteraction( step, event, 'keyboard' );\n\t\t\t\t} else {\n\t\t\t\t\t// For other keys (like Escape), just handle the selection\n\t\t\t\t\tselectedBarRef.current = event.currentTarget as HTMLDivElement;\n\t\t\t\t\thandleBarKeyDown( step.id, event );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\thandlers.set( step.id, { onClick, onKeyDown } );\n\t\t} );\n\n\t\treturn handlers;\n\t}, [ steps, handleStepInteraction, handleBarKeyDown ] );\n\n\t// Handle document-level click to clear selection when clicking outside selected bar\n\tuseEffect( () => {\n\t\tconst handleDocumentClick = ( event: MouseEvent ) => {\n\t\t\t// Only clear selection if there's an active selection and click is outside the selected bar\n\t\t\tif ( selectedBarRef.current && ! selectedBarRef.current.contains( event.target as Node ) ) {\n\t\t\t\tclearSelectionAndRef();\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener( 'mousedown', handleDocumentClick );\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', handleDocumentClick );\n\t\t};\n\t}, [ clearSelectionAndRef ] );\n\n\t// Resolve height: explicit height prop > style.height > default 100%\n\tconst resolvedHeight = height ?? style?.height ?? '100%';\n\n\t// Get component settings from theme with fallbacks\n\tconst { primaryColor, backgroundColor, positiveChangeColor, negativeChangeColor } =\n\t\tconversionFunnelChartSettings;\n\n\t// Resolve bar color using getElementStyles with primaryColor as override\n\tconst { color: barColor } = getElementStyles\n\t\t? getElementStyles( {\n\t\t\t\tindex: 0,\n\t\t\t\toverrideColor: primaryColor,\n\t\t } )\n\t\t: { color: primaryColor || '#000000' };\n\n\t// Determine change indicator color\n\tconst isPositiveChange = changeIndicator?.startsWith( '+' );\n\tconst changeColor = isPositiveChange ? positiveChangeColor : negativeChangeColor;\n\n\t// Create light background version of primary color if not set\n\tconst barBackgroundColor =\n\t\tbackgroundColor || hexToRgba( barColor, 0.08 ) || 'rgba(0, 0, 0, 0.08)';\n\n\t// Default main metric rendering function\n\tconst renderDefaultMainMetric = () => (\n\t\t<>\n\t\t\t<span className={ styles[ 'main-rate' ] }>{ formatPercentage( mainRate ) }</span>\n\t\t\t{ changeIndicator && (\n\t\t\t\t<span className={ styles[ 'change-indicator' ] } style={ { color: changeColor } }>\n\t\t\t\t\t{ changeIndicator }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Default tooltip rendering function\n\tconst renderDefaultTooltip = ( step: FunnelStep ) => (\n\t\t<Stack direction=\"column\" align=\"flex-start\" gap=\"xs\">\n\t\t\t<div className={ styles[ 'tooltip-title' ] }>{ step.label }</div>\n\t\t\t<div className={ styles[ 'tooltip-content' ] }>\n\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t{ ` • ${ step.count ?? 'no' } items` }\n\t\t\t</div>\n\t\t</Stack>\n\t);\n\n\t// Validate data\n\tconst isDataValid = Boolean( steps && steps.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tmainRate,\n\t\t\tchangeIndicator,\n\t\t\tstepsCount: steps?.length || 0,\n\t\t} ),\n\t\t[ mainRate, changeIndicator, steps?.length ]\n\t);\n\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems: [],\n\t\tchartType: 'conversion-funnel',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! isDataValid ) {\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t<div className={ styles[ 'empty-state' ] }>\n\t\t\t\t\t{ loading ? 'Loading...' : 'No data available' }\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t);\n\t}\n\n\t// Calculate bar heights relative to the maximum (first step)\n\tconst maxRate = Math.max( ...steps.map( step => step.rate ) );\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"xl\"\n\t\t\t\tdata-testid=\"conversion-funnel-chart\"\n\t\t\t\tref={ node => {\n\t\t\t\t\t// Set containerRef for @visx coordinate system\n\t\t\t\t\tportalContainerRef( node );\n\t\t\t\t\tchartRef.current = node;\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles[ 'conversion-funnel-chart' ],\n\t\t\t\t\tloading && styles[ 'conversion-funnel-chart--loading' ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ { ...style, height: resolvedHeight } }\n\t\t\t>\n\t\t\t\t{ /* Main Metric */ }\n\t\t\t\t{ renderMainMetric ? (\n\t\t\t\t\trenderMainMetric( {\n\t\t\t\t\t\tmainRate,\n\t\t\t\t\t\tchangeIndicator,\n\t\t\t\t\t\tclassName: styles[ 'main-metric' ],\n\t\t\t\t\t\tchangeColor,\n\t\t\t\t\t} )\n\t\t\t\t) : (\n\t\t\t\t\t<Stack direction=\"row\" align=\"baseline\" gap=\"sm\" className={ styles[ 'main-metric' ] }>\n\t\t\t\t\t\t{ renderDefaultMainMetric() }\n\t\t\t\t\t</Stack>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Funnel Steps */ }\n\t\t\t\t<Stack direction=\"row\" align=\"flex-end\" gap=\"lg\" className={ styles[ 'funnel-container' ] }>\n\t\t\t\t\t{ steps.map( ( step, index ) => {\n\t\t\t\t\t\tconst barHeight = ( step.rate / maxRate ) * 100;\n\t\t\t\t\t\tconst { isBlurred } = getStepState( step.id );\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\tkey={ step.id }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tdata-testid=\"funnel-step\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\tstyles[ 'funnel-step' ],\n\t\t\t\t\t\t\t\t\tisColorPaletteResolved && styles[ 'funnel-step--animated' ],\n\t\t\t\t\t\t\t\t\tisBlurred && styles[ 'funnel-step--blurred' ]\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tgap=\"xl\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ /* Step Label and Rate */ }\n\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t{ renderStepLabel ? (\n\t\t\t\t\t\t\t\t\t\trenderStepLabel( {\n\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-label' ],\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-label' ] }>{ step.label }</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ renderStepRate ? (\n\t\t\t\t\t\t\t\t\t\trenderStepRate( {\n\t\t\t\t\t\t\t\t\t\t\tstep,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclassName: styles[ 'step-rate' ],\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'step-rate' ] }>\n\t\t\t\t\t\t\t\t\t\t\t{ formatPercentage( step.rate ) }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t{ /* Funnel Bar */ }\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'bar-container' ] }\n\t\t\t\t\t\t\t\t\tonClick={ stepHandlers.get( step.id )?.onClick }\n\t\t\t\t\t\t\t\t\tonKeyDown={ stepHandlers.get( step.id )?.onKeyDown }\n\t\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\t\ttabIndex={ isBlurred ? -1 : 0 }\n\t\t\t\t\t\t\t\t\taria-label={ step.label }\n\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: barBackgroundColor } }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'funnel-bar' ], {\n\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'funnel-bar--animated' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\tanimation && ! loading && ! prefersReducedMotion,\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\theight: `${ barHeight }%`,\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: barColor,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t{ /* Tooltip Portal */ }\n\t\t\t{ tooltipOpen &&\n\t\t\t\ttooltipData &&\n\t\t\t\t( () => {\n\t\t\t\t\tconst tooltipContent = renderTooltip\n\t\t\t\t\t\t? renderTooltip( {\n\t\t\t\t\t\t\t\tstep: tooltipData as FunnelStep,\n\t\t\t\t\t\t\t\tindex: steps.findIndex( s => s.id === ( tooltipData as FunnelStep ).id ),\n\t\t\t\t\t\t\t\ttop: tooltipTop,\n\t\t\t\t\t\t\t\tleft: tooltipLeft,\n\t\t\t\t\t\t\t\tclassName: styles[ 'tooltip-wrapper' ],\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: renderDefaultTooltip( tooltipData as FunnelStep );\n\n\t\t\t\t\t// Don't render tooltip if renderTooltip returns falsy\n\t\t\t\t\tif ( ! tooltipContent ) return null;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TooltipInPortal\n\t\t\t\t\t\t\t// set this to random so it correctly updates with parent bounds\n\t\t\t\t\t\t\tkey={ Math.random() }\n\t\t\t\t\t\t\ttop={ tooltipTop }\n\t\t\t\t\t\t\tleft={ tooltipLeft }\n\t\t\t\t\t\t\tclassName={ styles[ 'tooltip-wrapper' ] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ tooltipContent }\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t);\n\t\t\t\t} )() }\n\t\t</>\n\t);\n};\n\n/**\n * ConversionFunnelChart component with provider wrapper\n *\n * @param props - Component props\n * @return JSX element representing the conversion funnel chart\n */\nconst ConversionFunnelChartWithProvider: FC< ConversionFunnelChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <ConversionFunnelChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<ConversionFunnelChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nConversionFunnelChartWithProvider.displayName = 'ConversionFunnelChart';\n\nexport { ConversionFunnelChartWithProvider as default };\n","/**\n * External dependencies\n */\nimport DOMPurify from 'dompurify';\n\n// Enforce rel=\"noopener noreferrer\" on links with target=\"_blank\" to prevent tab-napping.\n// Registered once at module level since DOMPurify hooks are global state.\nDOMPurify.addHook( 'afterSanitizeAttributes', ( node: Element ) => {\n\tif ( node.tagName === 'A' && node.getAttribute( 'target' ) === '_blank' ) {\n\t\tnode.setAttribute( 'rel', 'noopener noreferrer' );\n\t}\n} );\n\n/**\n * Sanitizes an HTML string using DOMPurify, allowing only safe formatting\n * markup suitable for chart tooltip content.\n *\n * @param html - The HTML string to sanitize\n * @return Sanitized HTML string safe for rendering\n */\nexport function sanitizeHtml( html: string ): string {\n\treturn DOMPurify.sanitize( html, {\n\t\tALLOWED_TAGS: [\n\t\t\t'a',\n\t\t\t'b',\n\t\t\t'br',\n\t\t\t'div',\n\t\t\t'em',\n\t\t\t'i',\n\t\t\t'li',\n\t\t\t'ol',\n\t\t\t'p',\n\t\t\t'small',\n\t\t\t'span',\n\t\t\t'strong',\n\t\t\t'sub',\n\t\t\t'sup',\n\t\t\t'table',\n\t\t\t'tbody',\n\t\t\t'td',\n\t\t\t'th',\n\t\t\t'thead',\n\t\t\t'tr',\n\t\t\t'u',\n\t\t\t'ul',\n\t\t],\n\t\tALLOWED_ATTR: [ 'class', 'href', 'target', 'rel' ],\n\t} );\n}\n","/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { FC, useContext, useMemo } from 'react';\nimport { Chart, type GoogleChartPackages } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport { GlobalChartsContext, GlobalChartsProvider, useGlobalChartsContext } from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { sanitizeHtml } from '../../utils/sanitize-html';\nimport { Center } from '../private/center';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport { GeoChartProps } from './types';\n\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n// `chartPackages` replaces (not extends) react-google-charts' default `[ 'corechart', 'controls' ]`,\n// so we restate the defaults and add `geochart`. Without it the loader backfills the geochart package\n// late, which can clash with another Google Charts version already loaded on the page.\nconst GEO_CHART_PACKAGES: GoogleChartPackages[] = [ 'corechart', 'controls', 'geochart' ];\n\ntype GoogleChartOptions = Record< string, unknown >;\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal: FC< GeoChartProps > = ( {\n\tclassName,\n\tdata,\n\twidth,\n\theight,\n\tregion = 'world',\n\tresolution = 'countries',\n\trenderPlaceholder,\n} ) => {\n\tconst {\n\t\tgetElementStyles,\n\t\ttheme: {\n\t\t\tgeoChart: { featureFillColor },\n\t\t\tbackgroundColor,\n\t\t},\n\t} = useGlobalChartsContext();\n\n\t// Render loading placeholder\n\tconst loadingPlaceholder = (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart-loading\"\n\t\t\tstyle={ { width, height } }\n\t\t>\n\t\t\t{ renderPlaceholder ? renderPlaceholder() : __( 'Loading map', 'jetpack-charts' ) }\n\t\t</Center>\n\t);\n\n\t// Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n\tconst fullColorHex = getElementStyles( { index: 0 } ).color;\n\tconst lightColorHex = lightenHexColor( fullColorHex, 0.8 );\n\t// Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex\n\tconst backgroundColorHex =\n\t\tnormalizeColorToHex( backgroundColor, null, resolveCssVariable ) || DEFAULT_BACKGROUND_COLOR;\n\tconst defaultFillColorHex =\n\t\tnormalizeColorToHex( featureFillColor, null, resolveCssVariable ) || DEFAULT_FEATURE_FILL_COLOR;\n\n\t// Identify HTML tooltip column indices and sanitize their content to prevent XSS.\n\tconst sanitizedData = useMemo( () => {\n\t\tif ( data.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\tconst htmlTooltipIndices: number[] = [];\n\t\tfor ( let i = 0; i < data[ 0 ].length; i++ ) {\n\t\t\tconst col = data[ 0 ][ i ];\n\t\t\tif (\n\t\t\t\ttypeof col === 'object' &&\n\t\t\t\tcol !== null &&\n\t\t\t\t'role' in col &&\n\t\t\t\tcol.role === 'tooltip' &&\n\t\t\t\t'p' in col &&\n\t\t\t\ttypeof col.p === 'object' &&\n\t\t\t\tcol.p !== null &&\n\t\t\t\t'html' in col.p &&\n\t\t\t\tcol.p.html === true\n\t\t\t) {\n\t\t\t\thtmlTooltipIndices.push( i );\n\t\t\t}\n\t\t}\n\n\t\tif ( htmlTooltipIndices.length === 0 ) {\n\t\t\treturn { data, hasHtmlTooltips: false };\n\t\t}\n\n\t\t// Sanitize HTML content in tooltip columns for data rows (skip header row)\n\t\tconst sanitizedRows = data.slice( 1 ).map( row => {\n\t\t\tconst newRow = [ ...row ];\n\t\t\tfor ( const colIndex of htmlTooltipIndices ) {\n\t\t\t\tif ( typeof newRow[ colIndex ] === 'string' ) {\n\t\t\t\t\tnewRow[ colIndex ] = sanitizeHtml( newRow[ colIndex ] as string );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newRow;\n\t\t} );\n\n\t\treturn {\n\t\t\tdata: [ data[ 0 ], ...sanitizedRows ] as typeof data,\n\t\t\thasHtmlTooltips: true,\n\t\t};\n\t}, [ data ] );\n\n\tconst options: GoogleChartOptions = useMemo(\n\t\t() => ( {\n\t\t\t...( region !== 'world' && { region } ),\n\t\t\t...( resolution !== 'countries' && { resolution } ),\n\t\t\tcolorAxis: { colors: [ lightColorHex, fullColorHex ] },\n\t\t\tbackgroundColor: backgroundColorHex,\n\t\t\tdatalessRegionColor: defaultFillColorHex,\n\t\t\tdefaultColor: defaultFillColorHex,\n\t\t\ttooltip: { trigger: 'focus', isHtml: sanitizedData.hasHtmlTooltips },\n\t\t\tlegend: 'none',\n\t\t\tkeepAspectRatio: true,\n\t\t} ),\n\t\t[\n\t\t\tregion,\n\t\t\tresolution,\n\t\t\tlightColorHex,\n\t\t\tfullColorHex,\n\t\t\tbackgroundColorHex,\n\t\t\tdefaultFillColorHex,\n\t\t\tsanitizedData.hasHtmlTooltips,\n\t\t]\n\t);\n\n\treturn (\n\t\t<Center\n\t\t\tclassName={ clsx( 'geo-chart', styles.container, className ) }\n\t\t\tdata-testid=\"geo-chart\"\n\t\t\tstyle={ { width, height, backgroundColor } }\n\t\t>\n\t\t\t<Chart\n\t\t\t\tchartType=\"GeoChart\"\n\t\t\t\tchartPackages={ GEO_CHART_PACKAGES }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tdata={ sanitizedData.data }\n\t\t\t\toptions={ options }\n\t\t\t\tloader={ loadingPlaceholder }\n\t\t\t/>\n\t\t</Center>\n\t);\n};\n\nconst GeoChartWithProvider: FC< GeoChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <GeoChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<GeoChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nGeoChartWithProvider.displayName = 'GeoChart';\n\nconst GeoChartResponsive = withResponsive< GeoChartProps >( GeoChartWithProvider );\n\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };\n","import type { HeatmapColumn } from '../types';\n\nexport const isPresent = ( value: number | null | undefined ): value is number =>\n\tvalue !== null && value !== undefined && ! isNaN( value );\n\n/**\n * Get the min and max values from heatmap data, ignoring null/NaN.\n * @param data - The heatmap columns\n * @return Tuple of [min, max] values\n */\nexport const getValueExtent = ( data: HeatmapColumn[] ): [ number, number ] => {\n\tlet min = Infinity;\n\tlet max = -Infinity;\n\tfor ( const column of data ) {\n\t\tfor ( const cell of column.data ) {\n\t\t\tif ( ! isPresent( cell.value ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( cell.value < min ) {\n\t\t\t\tmin = cell.value;\n\t\t\t}\n\t\t\tif ( cell.value > max ) {\n\t\t\t\tmax = cell.value;\n\t\t\t}\n\t\t}\n\t}\n\tif ( min === Infinity ) {\n\t\treturn [ 0, 0 ];\n\t}\n\treturn [ min, max ];\n};\n\n/**\n * Normalize a value to 0–1 within the extent. A flat extent (min === max) maps to 1.\n * @param value - The value to normalize\n * @param extent - Tuple of [min, max] values for the normalization range\n * @return Normalized value between 0 and 1\n */\nexport const getNormalizedValue = ( value: number, extent: [ number, number ] ): number => {\n\tconst [ min, max ] = extent;\n\tif ( min === max ) {\n\t\treturn 1;\n\t}\n\treturn Math.min( 1, Math.max( 0, ( value - min ) / ( max - min ) ) );\n};\n","import { addDays, differenceInCalendarWeeks, format, parseISO, startOfWeek } from 'date-fns';\nimport type { DataPointDate } from '../../../types';\nimport type { HeatmapCell, HeatmapColumn } from '../types';\n\nexport type CalendarHeatmapResult = {\n\tdata: HeatmapColumn[];\n\trowLabels: string[];\n};\n\n/** Rows that get a weekday label (Mon, Wed, Fri with a Monday week start). */\nconst LABELLED_ROWS = [ 0, 2, 4 ];\n\nconst toDate = ( point: DataPointDate ): Date | null => {\n\tif ( point.date instanceof Date && ! isNaN( point.date.getTime() ) ) {\n\t\treturn point.date;\n\t}\n\tif ( point.dateString ) {\n\t\tconst parsed = parseISO( point.dateString );\n\t\tif ( ! isNaN( parsed.getTime() ) ) {\n\t\t\treturn parsed;\n\t\t}\n\t}\n\treturn null;\n};\n\nexport const buildCalendarHeatmapData = (\n\tseries: DataPointDate[],\n\toptions: { weekStartsOn?: 0 | 1 } = {}\n): CalendarHeatmapResult => {\n\tconst weekStartsOn = options.weekStartsOn ?? 1;\n\n\tconst entries = series\n\t\t.map( point => ( { date: toDate( point ), value: point.value } ) )\n\t\t.filter( ( entry ): entry is { date: Date; value: number | null } => entry.date !== null );\n\n\tif ( ! entries.length ) {\n\t\treturn { data: [], rowLabels: [] };\n\t}\n\n\tconst valueByDay = new Map< string, number | null >();\n\tlet minDate = entries[ 0 ].date;\n\tlet maxDate = entries[ 0 ].date;\n\tfor ( const { date, value } of entries ) {\n\t\tvalueByDay.set( format( date, 'yyyy-MM-dd' ), value );\n\t\tif ( date < minDate ) {\n\t\t\tminDate = date;\n\t\t}\n\t\tif ( date > maxDate ) {\n\t\t\tmaxDate = date;\n\t\t}\n\t}\n\n\tconst gridStart = startOfWeek( minDate, { weekStartsOn } );\n\tconst weekCount = differenceInCalendarWeeks( maxDate, gridStart, { weekStartsOn } ) + 1;\n\n\tconst rowLabels = Array.from( { length: 7 }, ( _, row ) =>\n\t\tLABELLED_ROWS.includes( row ) ? format( addDays( gridStart, row ), 'EEE' ) : ''\n\t);\n\n\tconst data: HeatmapColumn[] = [];\n\tlet previousMonth = -1;\n\tfor ( let week = 0; week < weekCount; week++ ) {\n\t\tconst columnStart = addDays( gridStart, week * 7 );\n\t\tconst month = columnStart.getMonth();\n\t\tconst label = month !== previousMonth ? format( columnStart, 'MMM' ) : '';\n\t\tpreviousMonth = month;\n\n\t\tconst cells: HeatmapCell[] = [];\n\t\tfor ( let row = 0; row < 7; row++ ) {\n\t\t\tconst day = addDays( gridStart, week * 7 + row );\n\t\t\tconst key = format( day, 'yyyy-MM-dd' );\n\t\t\tcells.push( {\n\t\t\t\tlabel: format( day, 'EEE, MMM d, yyyy' ),\n\t\t\t\tvalue: valueByDay.has( key ) ? ( valueByDay.get( key ) as number | null ) : null,\n\t\t\t} );\n\t\t}\n\t\tdata.push( { label, data: cells } );\n\t}\n\n\treturn { data, rowLabels };\n};\n","import { __ } from '@wordpress/i18n';\nimport { Stack, Text } from '@wordpress/ui';\nimport { useContext } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { HeatmapContext } from '../heatmap-chart';\nimport styles from '../heatmap-chart.module.scss';\nimport type { CSSProperties, FC } from 'react';\n\nexport interface HeatmapLegendProps {\n\t/** Number of swatches in the scale. Default 5. */\n\tsteps?: number;\n\tlessLabel?: string;\n\tmoreLabel?: string;\n}\n\nexport const HeatmapLegend: FC< HeatmapLegendProps > = ( { steps = 5, lessLabel, moreLabel } ) => {\n\tconst context = useContext( HeatmapContext );\n\tconst { legend } = useGlobalChartsTheme();\n\tif ( ! context ) {\n\t\treturn null;\n\t}\n\tconst { primaryColorHex } = context;\n\tconst labelStyle = legend.labelStyles;\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"xs\" align=\"center\">\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ lessLabel ?? __( 'Less', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t\t<Stack direction=\"row\" gap=\"xs\">\n\t\t\t\t{ Array.from( { length: steps }, ( _, index ) => {\n\t\t\t\t\tconst intensity = steps <= 1 ? 1 : index / ( steps - 1 );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__legend-swatch' ] }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'--heatmap-primary': primaryColorHex,\n\t\t\t\t\t\t\t\t\t'--intensity': intensity,\n\t\t\t\t\t\t\t\t} as CSSProperties\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Stack>\n\t\t\t<Text variant=\"body-sm\" style={ labelStyle }>\n\t\t\t\t{ moreLabel ?? __( 'More', 'jetpack-charts' ) }\n\t\t\t</Text>\n\t\t</Stack>\n\t);\n};\n","import { formatNumber, formatNumberCompact } from '@automattic/number-formatters';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport {\n\tisValidHexColor,\n\tlightenHexColor,\n\tnormalizeColorToHex,\n\tprefersLightText,\n} from '../../utils/color-utils';\nimport { Center } from '../private/center';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './heatmap-chart.module.scss';\nimport { getValueExtent, getNormalizedValue, HeatmapLegend, isPresent } from './private';\nimport type { HeatmapChartProps, HeatmapTooltipData } from './types';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { CSSProperties, FC } from 'react';\n\nexport type HeatmapContextValue = {\n\textent: [ number, number ];\n\t/** The resolved primary color (full intensity); the legend mixes toward it in CSS. */\n\tprimaryColorHex: string;\n};\n\nexport const HeatmapContext = createContext< HeatmapContextValue | null >( null );\n\n// Mirrors the color-mix floor in heatmap-chart.module.scss (.heatmap-chart__cell--filled):\n// the rendered fill is the primary mixed over the chart background at 0.15 + 0.85 * intensity.\nconst CELL_MIX_FLOOR = 0.15;\n\nconst HeatmapChartInternal: FC< HeatmapChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth = 0,\n\theight = 0,\n\tclassName,\n\tcompact = false,\n\tshowValues,\n\trowLabels = [],\n\tprimaryColor,\n\tgap = 'md',\n\twithTooltips = false,\n\trenderTooltip,\n\tchildren,\n} ) => {\n\tconst chartId = useChartId( providedChartId );\n\tconst { getElementStyles, theme } = useGlobalChartsContext();\n\tconst { heatmapChart: heatmapChartSettings } = theme;\n\tconst { nonLegendChildren } = useChartChildren( children, 'HeatmapChart' );\n\n\tconst [ selectedIndex, setSelectedIndex ] = useState< number | undefined >();\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, showTooltip, hideTooltip } =\n\t\tuseTooltip< HeatmapTooltipData >();\n\tconst { containerRef, containerBounds, TooltipInPortal } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t} );\n\t// Read from a ref so the keyboard-tooltip effect doesn't depend on containerBounds, which\n\t// is a new object each render and would loop the effect via showTooltip.\n\tconst containerBoundsRef = useRef( containerBounds );\n\tcontainerBoundsRef.current = containerBounds;\n\n\tconst { color: primaryColorHex } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || heatmapChartSettings.primaryColor,\n\t} );\n\n\t// Pick the in-cell text color from the cell's actual blended fill luminance (not the data\n\t// value), so light text is only used where it out-contrasts dark text. Falls back to dark\n\t// text when the primary isn't a resolvable hex (e.g. a bare CSS token).\n\tconst primaryHex = normalizeColorToHex( primaryColorHex );\n\tconst cellHasLightText = ( intensity: number ): boolean =>\n\t\tisValidHexColor( primaryHex ) &&\n\t\tprefersLightText(\n\t\t\tlightenHexColor( primaryHex, 1 - ( CELL_MIX_FLOOR + ( 1 - CELL_MIX_FLOOR ) * intensity ) )\n\t\t);\n\n\tconst extent = useMemo( () => getValueExtent( data ), [ data ] );\n\tconst heatmapContext = useMemo< HeatmapContextValue >(\n\t\t() => ( { extent, primaryColorHex } ),\n\t\t[ extent, primaryColorHex ]\n\t);\n\n\tconst columns = data.length;\n\tconst rows = Math.max( 0, ...data.map( column => column.data.length ) );\n\n\tconst { compactCellGap, compactCellSize } = heatmapChartSettings;\n\tconst drawValues = showValues ?? ! compact;\n\n\tconst buildTooltipData = useCallback(\n\t\t( columnIndex: number, rowIndex: number ): HeatmapTooltipData => {\n\t\t\tconst cell = data[ columnIndex ]?.data[ rowIndex ];\n\t\t\treturn {\n\t\t\t\tvalue: cell?.value ?? null,\n\t\t\t\trowLabel: rowLabels[ rowIndex ],\n\t\t\t\tcolumnLabel: data[ columnIndex ]?.label,\n\t\t\t\tcellLabel: cell?.label,\n\t\t\t\trow: rowIndex,\n\t\t\t\tcolumn: columnIndex,\n\t\t\t};\n\t\t},\n\t\t[ data, rowLabels ]\n\t);\n\n\tconst onChartBlur = useCallback( () => {\n\t\tsetSelectedIndex( undefined );\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\tconst onChartKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif (\n\t\t\t\t! [ 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape', 'Tab' ].includes(\n\t\t\t\t\tevent.key\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.key === 'Tab' || event.key === 'Escape' ) {\n\t\t\t\tsetSelectedIndex( undefined );\n\t\t\t\thideTooltip();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( selectedIndex === undefined ) {\n\t\t\t\tsetSelectedIndex( 0 );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet col = Math.floor( selectedIndex / rows );\n\t\t\tlet row = selectedIndex % rows;\n\n\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\tcol = Math.min( col + 1, columns - 1 );\n\t\t\t} else if ( event.key === 'ArrowLeft' ) {\n\t\t\t\tcol = Math.max( col - 1, 0 );\n\t\t\t} else if ( event.key === 'ArrowDown' ) {\n\t\t\t\trow = Math.min( row + 1, rows - 1 );\n\t\t\t} else if ( event.key === 'ArrowUp' ) {\n\t\t\t\trow = Math.max( row - 1, 0 );\n\t\t\t}\n\n\t\t\tsetSelectedIndex( col * rows + row );\n\t\t},\n\t\t[ rows, columns, selectedIndex, hideTooltip ]\n\t);\n\n\tconst handleCellMouseMove = useCallback(\n\t\t( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\t\tif ( ! withTooltips ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst target = event.currentTarget;\n\t\t\tconst columnIndex = Number( target.dataset.column );\n\t\t\tconst rowIndex = Number( target.dataset.row );\n\t\t\t// Read bounds from the ref (like the keyboard-tooltip effect) so this\n\t\t\t// callback stays stable across renders.\n\t\t\tconst bounds = containerBoundsRef.current;\n\t\t\t// TooltipInPortal re-adds containerBounds, so subtract it to land at the cursor.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipLeft: event.clientX - bounds.left,\n\t\t\t\ttooltipTop: event.clientY - bounds.top,\n\t\t\t\ttooltipData: buildTooltipData( columnIndex, rowIndex ),\n\t\t\t} );\n\t\t},\n\t\t[ withTooltips, showTooltip, buildTooltipData ]\n\t);\n\n\tconst handleCellMouseLeave = useCallback( () => {\n\t\t// Keyboard selection owns the tooltip; don't let a mouse-out clear it.\n\t\tif ( withTooltips && selectedIndex === undefined ) {\n\t\t\thideTooltip();\n\t\t}\n\t}, [ withTooltips, selectedIndex, hideTooltip ] );\n\n\t// Anchor the tooltip at the selected cell's center on keyboard nav. Cleared on blur/Escape,\n\t// not here, so a mouse hover (no selection) isn't affected.\n\tuseEffect( () => {\n\t\tif ( ! withTooltips || selectedIndex === undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tconst col = Math.floor( selectedIndex / rows );\n\t\tconst row = selectedIndex % rows;\n\t\tconst cell =\n\t\t\ttypeof document !== 'undefined'\n\t\t\t\t? document.getElementById( `${ chartId }-cell-${ col }-${ row }` )\n\t\t\t\t: null;\n\t\tconst rect = cell?.getBoundingClientRect();\n\t\tconst bounds = containerBoundsRef.current;\n\t\tshowTooltip( {\n\t\t\ttooltipLeft: rect ? rect.left + rect.width / 2 - bounds.left : 0,\n\t\t\ttooltipTop: rect ? rect.top + rect.height / 2 - bounds.top : 0,\n\t\t\ttooltipData: buildTooltipData( col, row ),\n\t\t} );\n\t}, [ selectedIndex, withTooltips, rows, chartId, buildTooltipData, showTooltip ] );\n\n\tconst defaultRenderTooltip = useCallback(\n\t\t( info: HeatmapTooltipData ) => (\n\t\t\t<div>\n\t\t\t\t<strong>\n\t\t\t\t\t{ info.cellLabel || `${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim() }\n\t\t\t\t</strong>\n\t\t\t\t<div>\n\t\t\t\t\t{ info.value === null ? __( 'No data', 'jetpack-charts' ) : formatNumber( info.value ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t),\n\t\t[]\n\t);\n\n\tif ( ! columns || ! rows ) {\n\t\treturn (\n\t\t\t<Center\n\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className ) }\n\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t>\n\t\t\t\t<span className={ styles[ 'heatmap-chart__empty' ] }>\n\t\t\t\t\t{ __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t</span>\n\t\t\t</Center>\n\t\t);\n\t}\n\n\tconst trackSize = compact ? 'var(--heatmap-cell-size)' : 'minmax(0, 1fr)';\n\tconst gridStyle: Record< string, string | number > = {\n\t\t'--heatmap-primary': primaryColorHex,\n\t\tgridTemplateColumns: `auto repeat(${ columns }, ${ trackSize })`,\n\t\tgridTemplateRows: `auto repeat(${ rows }, ${ trackSize })`,\n\t};\n\tif ( compact ) {\n\t\tgridStyle[ '--heatmap-cell-gap' ] = `${ compactCellGap }px`;\n\t\tgridStyle[ '--heatmap-cell-size' ] = `${ compactCellSize }px`;\n\t}\n\n\tconst activeDescendant =\n\t\tselectedIndex !== undefined\n\t\t\t? `${ chartId }-cell-${ Math.floor( selectedIndex / rows ) }-${ selectedIndex % rows }`\n\t\t\t: undefined;\n\n\treturn (\n\t\t<HeatmapContext.Provider value={ heatmapContext }>\n\t\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition=\"bottom\"\n\t\t\t\t\t// Legend renders via trailingContent, not the legend slot.\n\t\t\t\t\tlegendChildren={ [] }\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tclassName={ clsx( 'heatmap-chart', styles[ 'heatmap-chart' ], className ) }\n\t\t\t\t\t// Explicit dimensions (the unresponsive export) pin the size; otherwise\n\t\t\t\t\t// width/height are unset and the grid fills its container via CSS. The\n\t\t\t\t\t// responsive export drops the measured pixels so reflow stays fluid.\n\t\t\t\t\tstyle={ { width: width || undefined, height: height || undefined } }\n\t\t\t\t\tdata-testid=\"heatmap-chart\"\n\t\t\t\t\tdata-chart-id={ `heatmap-chart-${ chartId }` }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ containerRef }\n\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\taria-label={ __( 'Heatmap chart', 'jetpack-charts' ) }\n\t\t\t\t\t\taria-rowcount={ rows }\n\t\t\t\t\t\taria-colcount={ columns }\n\t\t\t\t\t\taria-activedescendant={ activeDescendant }\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\tonBlur={ onChartBlur }\n\t\t\t\t\t\tonKeyDown={ onChartKeyDown }\n\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__grid' ], {\n\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__grid--compact' ] ]: compact,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tstyle={ gridStyle as CSSProperties }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Corner gutter + column labels; aria-hidden, since each cell's label carries the text. */ }\n\t\t\t\t\t\t<span aria-hidden=\"true\" />\n\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tkey={ `col-${ columnIndex }` }\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__col-label' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ column.label }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) ) }\n\n\t\t\t\t\t\t{ Array.from( { length: rows } ).map( ( _row, rowIndex ) => {\n\t\t\t\t\t\t\tconst labelVisible = ! compact || rowIndex % 2 === 0;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ `row-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t\t\t\t\taria-rowindex={ rowIndex + 1 }\n\t\t\t\t\t\t\t\t\tclassName={ styles[ 'heatmap-chart__row' ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={ styles[ 'heatmap-chart__row-label' ] }>\n\t\t\t\t\t\t\t\t\t\t{ labelVisible ? rowLabels[ rowIndex ] ?? '' : '' }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ data.map( ( column, columnIndex ) => {\n\t\t\t\t\t\t\t\t\t\tconst cell = column.data[ rowIndex ];\n\t\t\t\t\t\t\t\t\t\tconst value = cell?.value ?? null;\n\t\t\t\t\t\t\t\t\t\tconst present = isPresent( value );\n\t\t\t\t\t\t\t\t\t\tconst normalized = present ? getNormalizedValue( value, extent ) : 0;\n\t\t\t\t\t\t\t\t\t\tconst flatIndex = columnIndex * rows + rowIndex;\n\t\t\t\t\t\t\t\t\t\tconst info = buildTooltipData( columnIndex, rowIndex );\n\t\t\t\t\t\t\t\t\t\tconst accessibleName =\n\t\t\t\t\t\t\t\t\t\t\tinfo.cellLabel ||\n\t\t\t\t\t\t\t\t\t\t\t`${ info.columnLabel ?? '' } ${ info.rowLabel ?? '' }`.trim();\n\t\t\t\t\t\t\t\t\t\tconst accessibleLabel = `${ accessibleName }: ${\n\t\t\t\t\t\t\t\t\t\t\tinfo.value === null\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'No data', 'jetpack-charts' )\n\t\t\t\t\t\t\t\t\t\t\t\t: formatNumber( info.value )\n\t\t\t\t\t\t\t\t\t\t}`;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ `cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tid={ `${ chartId }-cell-${ columnIndex }-${ rowIndex }` }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"heatmap-cell\"\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\t// Focus stays on the grid (aria-activedescendant); cells are\n\t\t\t\t\t\t\t\t\t\t\t\t// focusable but out of the tab order.\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-colindex={ columnIndex + 1 }\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ accessibleLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-column={ columnIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tdata-row={ rowIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles[ 'heatmap-chart__cell' ], {\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--filled' ] ]: present,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--strong' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpresent && cellHasLightText( normalized ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t[ styles[ 'heatmap-chart__cell--selected' ] ]:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedIndex === flatIndex,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\t\t\tpresent ? ( { '--intensity': normalized } as CSSProperties ) : undefined\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ handleCellMouseMove }\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ handleCellMouseLeave }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ drawValues && present && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span className={ styles[ 'heatmap-chart__cell-value' ] }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ /* Compact so large values fit the cell; tooltip + aria-label keep full precision. */ }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ formatNumberCompact( value ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop } left={ tooltipLeft }>\n\t\t\t\t\t\t\t<div role=\"tooltip\" tabIndex={ -1 }>\n\t\t\t\t\t\t\t\t{ ( renderTooltip ?? defaultRenderTooltip )( tooltipData ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t) }\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t</HeatmapContext.Provider>\n\t);\n};\n\nconst HeatmapChartWithProvider: FC< HeatmapChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\tif ( existingContext ) {\n\t\treturn <HeatmapChartInternal { ...props } />;\n\t}\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<HeatmapChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nHeatmapChartWithProvider.displayName = 'HeatmapChart';\n\ninterface HeatmapChartSubComponents {\n\tLegend: typeof HeatmapLegend;\n}\n\nconst HeatmapChart = attachSubComponents( HeatmapChartWithProvider, {\n\tLegend: HeatmapLegend,\n} ) as FC< HeatmapChartProps > & HeatmapChartSubComponents;\n\n// The responsive wrapper already sizes the container; drop its measured pixel\n// width/height so the grid fills that container via CSS and reflows fluidly,\n// instead of pinning to a debounced measurement.\nconst HeatmapChartResponsiveInner: FC< HeatmapChartProps > = props => (\n\t<HeatmapChartWithProvider { ...props } width={ undefined } height={ undefined } />\n);\nHeatmapChartResponsiveInner.displayName = 'HeatmapChart';\n\nconst HeatmapChartResponsive = attachSubComponents(\n\twithResponsive< HeatmapChartProps >( HeatmapChartResponsiveInner ),\n\t{ Legend: HeatmapLegend }\n) as FC< HeatmapChartProps & ResponsiveConfig > & HeatmapChartSubComponents;\n\nexport { HeatmapChartResponsive as default, HeatmapChart as HeatmapChartUnresponsive };\n","// packages/warning/src/utils.ts\nvar logged = /* @__PURE__ */ new Set();\nexport {\n logged\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/warning/src/index.ts\nimport { logged } from \"./utils.mjs\";\nfunction isDev() {\n return globalThis.SCRIPT_DEBUG === true;\n}\nfunction warning(message) {\n if (!isDev()) {\n return;\n }\n if (logged.has(message)) {\n return;\n }\n console.warn(message);\n try {\n throw Error(message);\n } catch {\n }\n logged.add(message);\n}\nexport {\n warning as default\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/components/src/context/constants.js\nvar COMPONENT_NAMESPACE = \"data-wp-component\";\nvar CONNECTED_NAMESPACE = \"data-wp-c16t\";\nvar CONNECT_STATIC_NAMESPACE = \"__contextSystemKey__\";\nexport {\n COMPONENT_NAMESPACE,\n CONNECTED_NAMESPACE,\n CONNECT_STATIC_NAMESPACE\n};\n//# sourceMappingURL=constants.mjs.map\n","/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nexport function localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\n/**\n * Lower case as a function.\n */\nexport function lowerCase(str) {\n return str.toLowerCase();\n}\n//# sourceMappingURL=index.js.map","import { lowerCase } from \"lower-case\";\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nexport function noCase(input, options) {\n if (options === void 0) { options = {}; }\n var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? \" \" : _d;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { noCase } from \"no-case\";\nexport function dotCase(input, options) {\n if (options === void 0) { options = {}; }\n return noCase(input, __assign({ delimiter: \".\" }, options));\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nimport { dotCase } from \"dot-case\";\nexport function paramCase(input, options) {\n if (options === void 0) { options = {}; }\n return dotCase(input, __assign({ delimiter: \"-\" }, options));\n}\n//# sourceMappingURL=index.js.map","/**\n * Memize options object.\n *\n * @typedef MemizeOptions\n *\n * @property {number} [maxSize] Maximum size of the cache.\n */\n\n/**\n * Internal cache entry.\n *\n * @typedef MemizeCacheNode\n *\n * @property {?MemizeCacheNode|undefined} [prev] Previous node.\n * @property {?MemizeCacheNode|undefined} [next] Next node.\n * @property {Array<*>} args Function arguments for cache\n * entry.\n * @property {*} val Function result.\n */\n\n/**\n * Properties of the enhanced function for controlling cache.\n *\n * @typedef MemizeMemoizedFunction\n *\n * @property {()=>void} clear Clear the cache.\n */\n\n/**\n * Accepts a function to be memoized, and returns a new memoized function, with\n * optional options.\n *\n * @template {(...args: any[]) => any} F\n *\n * @param {F} fn Function to memoize.\n * @param {MemizeOptions} [options] Options object.\n *\n * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.\n */\nfunction memize(fn, options) {\n\tvar size = 0;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar head;\n\n\t/** @type {?MemizeCacheNode|undefined} */\n\tvar tail;\n\n\toptions = options || {};\n\n\tfunction memoized(/* ...args */) {\n\t\tvar node = head,\n\t\t\tlen = arguments.length,\n\t\t\targs,\n\t\t\ti;\n\n\t\tsearchCache: while (node) {\n\t\t\t// Perform a shallow equality test to confirm that whether the node\n\t\t\t// under test is a candidate for the arguments passed. Two arrays\n\t\t\t// are shallowly equal if their length matches and each entry is\n\t\t\t// strictly equal between the two sets. Avoid abstracting to a\n\t\t\t// function which could incur an arguments leaking deoptimization.\n\n\t\t\t// Check whether node arguments match arguments length\n\t\t\tif (node.args.length !== arguments.length) {\n\t\t\t\tnode = node.next;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check whether node arguments match arguments values\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (node.args[i] !== arguments[i]) {\n\t\t\t\t\tnode = node.next;\n\t\t\t\t\tcontinue searchCache;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// At this point we can assume we've found a match\n\n\t\t\t// Surface matched node to head if not already\n\t\t\tif (node !== head) {\n\t\t\t\t// As tail, shift to previous. Must only shift if not also\n\t\t\t\t// head, since if both head and tail, there is no previous.\n\t\t\t\tif (node === tail) {\n\t\t\t\t\ttail = node.prev;\n\t\t\t\t}\n\n\t\t\t\t// Adjust siblings to point to each other. If node was tail,\n\t\t\t\t// this also handles new tail's empty `next` assignment.\n\t\t\t\t/** @type {MemizeCacheNode} */ (node.prev).next = node.next;\n\t\t\t\tif (node.next) {\n\t\t\t\t\tnode.next.prev = node.prev;\n\t\t\t\t}\n\n\t\t\t\tnode.next = head;\n\t\t\t\tnode.prev = null;\n\t\t\t\t/** @type {MemizeCacheNode} */ (head).prev = node;\n\t\t\t\thead = node;\n\t\t\t}\n\n\t\t\t// Return immediately\n\t\t\treturn node.val;\n\t\t}\n\n\t\t// No cached value found. Continue to insertion phase:\n\n\t\t// Create a copy of arguments (avoid leaking deoptimization)\n\t\targs = new Array(len);\n\t\tfor (i = 0; i < len; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\n\t\tnode = {\n\t\t\targs: args,\n\n\t\t\t// Generate the result from original function\n\t\t\tval: fn.apply(null, args),\n\t\t};\n\n\t\t// Don't need to check whether node is already head, since it would\n\t\t// have been returned above already if it was\n\n\t\t// Shift existing head down list\n\t\tif (head) {\n\t\t\thead.prev = node;\n\t\t\tnode.next = head;\n\t\t} else {\n\t\t\t// If no head, follows that there's no tail (at initial or reset)\n\t\t\ttail = node;\n\t\t}\n\n\t\t// Trim tail if we're reached max size and are pending cache insertion\n\t\tif (size === /** @type {MemizeOptions} */ (options).maxSize) {\n\t\t\ttail = /** @type {MemizeCacheNode} */ (tail).prev;\n\t\t\t/** @type {MemizeCacheNode} */ (tail).next = null;\n\t\t} else {\n\t\t\tsize++;\n\t\t}\n\n\t\thead = node;\n\n\t\treturn node.val;\n\t}\n\n\tmemoized.clear = function () {\n\t\thead = null;\n\t\ttail = null;\n\t\tsize = 0;\n\t};\n\n\t// Ignore reason: There's not a clear solution to create an intersection of\n\t// the function with additional properties, where the goal is to retain the\n\t// function signature of the incoming argument and add control properties\n\t// on the return value.\n\n\t// @ts-ignore\n\treturn memoized;\n}\n\nexport { memize as default };\n","// packages/components/src/context/get-styled-class-name-from-key.ts\nimport { paramCase as kebabCase } from \"change-case\";\nimport memoize from \"memize\";\nfunction getStyledClassName(namespace) {\n const kebab = kebabCase(namespace);\n return `components-${kebab}`;\n}\nvar getStyledClassNameFromKey = memoize(getStyledClassName);\nexport {\n getStyledClassNameFromKey\n};\n//# sourceMappingURL=get-styled-class-name-from-key.mjs.map\n","// packages/components/src/context/context-connect.ts\nimport { forwardRef } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { CONNECT_STATIC_NAMESPACE } from \"./constants.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nfunction contextConnect(Component, namespace) {\n return _contextConnect(Component, namespace, {\n forwardsRef: true\n });\n}\nfunction contextConnectWithoutRef(Component, namespace) {\n return _contextConnect(Component, namespace);\n}\nfunction _contextConnect(Component, namespace, options) {\n const WrappedComponent = options?.forwardsRef ? forwardRef(Component) : Component;\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"contextConnect: Please provide a namespace\") : void 0;\n }\n let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];\n if (Array.isArray(namespace)) {\n mergedNamespace = [...mergedNamespace, ...namespace];\n }\n if (typeof namespace === \"string\") {\n mergedNamespace = [...mergedNamespace, namespace];\n }\n return Object.assign(WrappedComponent, {\n [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],\n displayName: namespace,\n selector: `.${getStyledClassNameFromKey(namespace)}`\n });\n}\nfunction getConnectNamespace(Component) {\n if (!Component) {\n return [];\n }\n let namespaces = [];\n if (Component[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component[CONNECT_STATIC_NAMESPACE];\n }\n if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {\n namespaces = Component.type[CONNECT_STATIC_NAMESPACE];\n }\n return namespaces;\n}\nfunction hasConnectNamespace(Component, match) {\n if (!Component) {\n return false;\n }\n if (typeof match === \"string\") {\n return getConnectNamespace(Component).includes(match);\n }\n if (Array.isArray(match)) {\n return match.some((result) => getConnectNamespace(Component).includes(result));\n }\n return false;\n}\nexport {\n contextConnect,\n contextConnectWithoutRef,\n getConnectNamespace,\n hasConnectNamespace\n};\n//# sourceMappingURL=context-connect.mjs.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n if ((a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n for (i of a.entries())\n if (!equal(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if ((a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/*!\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","// packages/components/src/utils/hooks/use-update-effect.js\nimport { useRef, useEffect } from \"@wordpress/element\";\nfunction useUpdateEffect(effect, deps) {\n const mountedRef = useRef(false);\n useEffect(() => {\n if (mountedRef.current) {\n return effect();\n }\n mountedRef.current = true;\n return void 0;\n }, deps);\n useEffect(() => () => {\n mountedRef.current = false;\n }, []);\n}\nvar use_update_effect_default = useUpdateEffect;\nexport {\n use_update_effect_default as default\n};\n//# sourceMappingURL=use-update-effect.mjs.map\n","// packages/components/src/context/context-system-provider.js\nimport deepmerge from \"deepmerge\";\nimport fastDeepEqual from \"fast-deep-equal/es6/index.js\";\nimport { isPlainObject } from \"is-plain-object\";\nimport { createContext, useContext, useRef, useMemo, memo } from \"@wordpress/element\";\nimport warn from \"@wordpress/warning\";\nimport { useUpdateEffect } from \"../utils/index.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar ComponentsContext = createContext(\n /** @type {Record<string, any>} */\n {}\n);\nComponentsContext.displayName = \"ComponentsContext\";\nvar useComponentsContext = () => useContext(ComponentsContext);\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) && // But not the same reference.\n valueRef.current !== value\n ) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n const config = useMemo(() => {\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\nvar BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /* @__PURE__ */ _jsx(ComponentsContext.Provider, {\n value: contextValue,\n children\n });\n};\nvar ContextSystemProvider = memo(BaseContextSystemProvider);\nexport {\n ComponentsContext,\n ContextSystemProvider,\n useComponentsContext\n};\n//# sourceMappingURL=context-system-provider.mjs.map\n","// packages/components/src/context/utils.js\nimport { CONNECTED_NAMESPACE, COMPONENT_NAMESPACE } from \"./constants.mjs\";\nfunction getNamespace(componentName) {\n return {\n [COMPONENT_NAMESPACE]: componentName\n };\n}\nfunction getConnectedNamespace() {\n return {\n [CONNECTED_NAMESPACE]: true\n };\n}\nexport {\n getConnectedNamespace,\n getNamespace\n};\n//# sourceMappingURL=utils.mjs.map\n","var isDevelopment = false;\n\n/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n\nfunction sheetForTag(tag) {\n if (tag.sheet) {\n return tag.sheet;\n } // this weirdness brought to you by firefox\n\n /* istanbul ignore next */\n\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n return document.styleSheets[i];\n }\n } // this function should always return with a value\n // TS can't understand it though so we make it stop complaining here\n\n\n return undefined;\n}\n\nfunction createStyleElement(options) {\n var tag = document.createElement('style');\n tag.setAttribute('data-emotion', options.key);\n\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce);\n }\n\n tag.appendChild(document.createTextNode(''));\n tag.setAttribute('data-s', '');\n return tag;\n}\n\nvar StyleSheet = /*#__PURE__*/function () {\n // Using Node instead of HTMLElement since container may be a ShadowRoot\n function StyleSheet(options) {\n var _this = this;\n\n this._insertTag = function (tag) {\n var before;\n\n if (_this.tags.length === 0) {\n if (_this.insertionPoint) {\n before = _this.insertionPoint.nextSibling;\n } else if (_this.prepend) {\n before = _this.container.firstChild;\n } else {\n before = _this.before;\n }\n } else {\n before = _this.tags[_this.tags.length - 1].nextSibling;\n }\n\n _this.container.insertBefore(tag, before);\n\n _this.tags.push(tag);\n };\n\n this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;\n this.tags = [];\n this.ctr = 0;\n this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets\n\n this.key = options.key;\n this.container = options.container;\n this.prepend = options.prepend;\n this.insertionPoint = options.insertionPoint;\n this.before = null;\n }\n\n var _proto = StyleSheet.prototype;\n\n _proto.hydrate = function hydrate(nodes) {\n nodes.forEach(this._insertTag);\n };\n\n _proto.insert = function insert(rule) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {\n this._insertTag(createStyleElement(this));\n }\n\n var tag = this.tags[this.tags.length - 1];\n\n if (this.isSpeedy) {\n var sheet = sheetForTag(tag);\n\n try {\n // this is the ultrafast version, works across browsers\n // the big drawback is that the css won't be editable in devtools\n sheet.insertRule(rule, sheet.cssRules.length);\n } catch (e) {\n }\n } else {\n tag.appendChild(document.createTextNode(rule));\n }\n\n this.ctr++;\n };\n\n _proto.flush = function flush() {\n this.tags.forEach(function (tag) {\n var _tag$parentNode;\n\n return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);\n });\n this.tags = [];\n this.ctr = 0;\n };\n\n return StyleSheet;\n}();\n\nexport { StyleSheet };\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'\nimport {copy, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn serialize([copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn serialize([\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport { memoize as default };\n","import { StyleSheet } from '@emotion/sheet';\nimport { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';\nimport '@emotion/weak-memoize';\nimport '@emotion/memoize';\n\nvar identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {\n var previous = 0;\n var character = 0;\n\n while (true) {\n previous = character;\n character = peek(); // &\\f\n\n if (previous === 38 && character === 12) {\n points[index] = 1;\n }\n\n if (token(character)) {\n break;\n }\n\n next();\n }\n\n return slice(begin, position);\n};\n\nvar toRules = function toRules(parsed, points) {\n // pretend we've started with a comma\n var index = -1;\n var character = 44;\n\n do {\n switch (token(character)) {\n case 0:\n // &\\f\n if (character === 38 && peek() === 12) {\n // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings\n // stylis inserts \\f after & to know when & where it should replace this sequence with the context selector\n // and when it should just concatenate the outer and inner selectors\n // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here\n points[index] = 1;\n }\n\n parsed[index] += identifierWithPointTracking(position - 1, points, index);\n break;\n\n case 2:\n parsed[index] += delimit(character);\n break;\n\n case 4:\n // comma\n if (character === 44) {\n // colon\n parsed[++index] = peek() === 58 ? '&\\f' : '';\n points[index] = parsed[index].length;\n break;\n }\n\n // fallthrough\n\n default:\n parsed[index] += from(character);\n }\n } while (character = next());\n\n return parsed;\n};\n\nvar getRules = function getRules(value, points) {\n return dealloc(toRules(alloc(value), points));\n}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11\n\n\nvar fixedElements = /* #__PURE__ */new WeakMap();\nvar compat = function compat(element) {\n if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo\n // negative .length indicates that this rule has been already prefixed\n element.length < 1) {\n return;\n }\n\n var value = element.value;\n var parent = element.parent;\n var isImplicitRule = element.column === parent.column && element.line === parent.line;\n\n while (parent.type !== 'rule') {\n parent = parent.parent;\n if (!parent) return;\n } // short-circuit for the simplest case\n\n\n if (element.props.length === 1 && value.charCodeAt(0) !== 58\n /* colon */\n && !fixedElements.get(parent)) {\n return;\n } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)\n // then the props has already been manipulated beforehand as they that array is shared between it and its \"rule parent\"\n\n\n if (isImplicitRule) {\n return;\n }\n\n fixedElements.set(element, true);\n var points = [];\n var rules = getRules(value, points);\n var parentRules = parent.props;\n\n for (var i = 0, k = 0; i < rules.length; i++) {\n for (var j = 0; j < parentRules.length; j++, k++) {\n element.props[k] = points[i] ? rules[i].replace(/&\\f/g, parentRules[j]) : parentRules[j] + \" \" + rules[i];\n }\n }\n};\nvar removeLabel = function removeLabel(element) {\n if (element.type === 'decl') {\n var value = element.value;\n\n if ( // charcode for l\n value.charCodeAt(0) === 108 && // charcode for b\n value.charCodeAt(2) === 98) {\n // this ignores label\n element[\"return\"] = '';\n element.value = '';\n }\n }\n};\n\n/* eslint-disable no-fallthrough */\n\nfunction prefix(value, length) {\n switch (hash(value, length)) {\n // color-adjust\n case 5103:\n return WEBKIT + 'print-' + value + value;\n // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\n case 5737:\n case 4201:\n case 3177:\n case 3433:\n case 1641:\n case 4457:\n case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\n case 5572:\n case 6356:\n case 5844:\n case 3191:\n case 6645:\n case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\n case 6391:\n case 5879:\n case 5623:\n case 6135:\n case 4599:\n case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\n case 4215:\n case 6389:\n case 5109:\n case 5365:\n case 5621:\n case 3829:\n return WEBKIT + value + value;\n // appearance, user-select, transform, hyphens, text-size-adjust\n\n case 5349:\n case 4246:\n case 4810:\n case 6968:\n case 2756:\n return WEBKIT + value + MOZ + value + MS + value + value;\n // flex, flex-direction\n\n case 6828:\n case 4268:\n return WEBKIT + value + MS + value + value;\n // order\n\n case 6165:\n return WEBKIT + value + MS + 'flex-' + value + value;\n // align-items\n\n case 5187:\n return WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;\n // align-self\n\n case 5443:\n return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;\n // align-content\n\n case 4675:\n return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;\n // flex-shrink\n\n case 5548:\n return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;\n // flex-basis\n\n case 5292:\n return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;\n // flex-grow\n\n case 6060:\n return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;\n // transition\n\n case 4554:\n return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;\n // cursor\n\n case 6187:\n return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;\n // background, background-image\n\n case 5495:\n case 3959:\n return replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1');\n // justify-content\n\n case 4968:\n return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;\n // (margin|padding)-inline-(start|end)\n\n case 4095:\n case 3583:\n case 4068:\n case 2532:\n return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;\n // (min|max)?(width|height|inline-size|block-size)\n\n case 8116:\n case 7059:\n case 5753:\n case 5535:\n case 5445:\n case 5701:\n case 4933:\n case 4677:\n case 5533:\n case 5789:\n case 5021:\n case 4765:\n // stretch, max-content, min-content, fill-available\n if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {\n // (m)ax-content, (m)in-content\n case 109:\n // -\n if (charat(value, length + 4) !== 45) break;\n // (f)ill-available, (f)it-content\n\n case 102:\n return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;\n // (s)tretch\n\n case 115:\n return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;\n }\n break;\n // position: sticky\n\n case 4949:\n // (s)ticky?\n if (charat(value, length + 1) !== 115) break;\n // display: (flex|inline-flex)\n\n case 6444:\n switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {\n // stic(k)y\n case 107:\n return replace(value, ':', ':' + WEBKIT) + value;\n // (inline-)?fl(e)x\n\n case 101:\n return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;\n }\n\n break;\n // writing-mode\n\n case 5936:\n switch (charat(value, length + 11)) {\n // vertical-l(r)\n case 114:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value;\n // vertical-r(l)\n\n case 108:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value;\n // horizontal(-)tb\n\n case 45:\n return WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value;\n }\n\n return WEBKIT + value + MS + value + value;\n }\n\n return value;\n}\n\nvar prefixer = function prefixer(element, index, children, callback) {\n if (element.length > -1) if (!element[\"return\"]) switch (element.type) {\n case DECLARATION:\n element[\"return\"] = prefix(element.value, element.length);\n break;\n\n case KEYFRAMES:\n return serialize([copy(element, {\n value: replace(element.value, '@', '@' + WEBKIT)\n })], callback);\n\n case RULESET:\n if (element.length) return combine(element.props, function (value) {\n switch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n // :read-(only|write)\n case ':read-only':\n case ':read-write':\n return serialize([copy(element, {\n props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]\n })], callback);\n // :placeholder\n\n case '::placeholder':\n return serialize([copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]\n }), copy(element, {\n props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]\n })], callback);\n }\n\n return '';\n });\n }\n};\n\nvar defaultStylisPlugins = [prefixer];\n\nvar createCache = function createCache(options) {\n var key = options.key;\n\n if (key === 'css') {\n var ssrStyles = document.querySelectorAll(\"style[data-emotion]:not([data-s])\"); // get SSRed styles out of the way of React's hydration\n // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)\n // note this very very intentionally targets all style elements regardless of the key to ensure\n // that creating a cache works inside of render of a React component\n\n Array.prototype.forEach.call(ssrStyles, function (node) {\n // we want to only move elements which have a space in the data-emotion attribute value\n // because that indicates that it is an Emotion 11 server-side rendered style elements\n // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector\n // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)\n // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles\n // will not result in the Emotion 10 styles being destroyed\n var dataEmotionAttribute = node.getAttribute('data-emotion');\n\n if (dataEmotionAttribute.indexOf(' ') === -1) {\n return;\n }\n\n document.head.appendChild(node);\n node.setAttribute('data-s', '');\n });\n }\n\n var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;\n\n var inserted = {};\n var container;\n var nodesToHydrate = [];\n\n {\n container = options.container || document.head;\n Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which\n // means that the style elements we're looking at are only Emotion 11 server-rendered style elements\n document.querySelectorAll(\"style[data-emotion^=\\\"\" + key + \" \\\"]\"), function (node) {\n var attrib = node.getAttribute(\"data-emotion\").split(' ');\n\n for (var i = 1; i < attrib.length; i++) {\n inserted[attrib[i]] = true;\n }\n\n nodesToHydrate.push(node);\n });\n }\n\n var _insert;\n\n var omnipresentPlugins = [compat, removeLabel];\n\n {\n var currentSheet;\n var finalizingPlugins = [stringify, rulesheet(function (rule) {\n currentSheet.insert(rule);\n })];\n var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));\n\n var stylis = function stylis(styles) {\n return serialize(compile(styles), serializer);\n };\n\n _insert = function insert(selector, serialized, sheet, shouldCache) {\n currentSheet = sheet;\n\n stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n\n if (shouldCache) {\n cache.inserted[serialized.name] = true;\n }\n };\n }\n\n var cache = {\n key: key,\n sheet: new StyleSheet({\n key: key,\n container: container,\n nonce: options.nonce,\n speedy: options.speedy,\n prepend: options.prepend,\n insertionPoint: options.insertionPoint\n }),\n nonce: options.nonce,\n inserted: inserted,\n registered: {},\n insert: _insert\n };\n cache.sheet.hydrate(nodesToHydrate);\n return cache;\n};\n\nexport { createCache as default };\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","var isBrowser = true;\n\nfunction getRegisteredStyles(registered, registeredStyles, classNames) {\n var rawClassName = '';\n classNames.split(' ').forEach(function (className) {\n if (registered[className] !== undefined) {\n registeredStyles.push(registered[className] + \";\");\n } else if (className) {\n rawClassName += className + \" \";\n }\n });\n return rawClassName;\n}\nvar registerStyles = function registerStyles(cache, serialized, isStringTag) {\n var className = cache.key + \"-\" + serialized.name;\n\n if ( // we only need to add the styles to the registered cache if the\n // class name could be used further down\n // the tree but if it's a string tag, we know it won't\n // so we don't have to add it to registered cache.\n // this improves memory usage since we can avoid storing the whole style string\n (isStringTag === false || // we need to always store it if we're in compat mode and\n // in node since emotion-server relies on whether a style is in\n // the registered cache to know whether a style is global or not\n // also, note that this check will be dead code eliminated in the browser\n isBrowser === false ) && cache.registered[className] === undefined) {\n cache.registered[className] = serialized.styles;\n }\n};\nvar insertStyles = function insertStyles(cache, serialized, isStringTag) {\n registerStyles(cache, serialized, isStringTag);\n var className = cache.key + \"-\" + serialized.name;\n\n if (cache.inserted[serialized.name] === undefined) {\n var current = serialized;\n\n do {\n cache.insert(serialized === current ? \".\" + className : '', current, cache.sheet, true);\n\n current = current.next;\n } while (current !== undefined);\n }\n};\n\nexport { getRegisteredStyles, insertStyles, registerStyles };\n","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport { murmur2 as default };\n","var unitlessKeys = {\n animationIterationCount: 1,\n aspectRatio: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n scale: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport { unitlessKeys as default };\n","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\n\nvar isDevelopment = false;\n\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = /* #__PURE__ */memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nvar noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';\n\nfunction handleInterpolation(mergedProps, registered, interpolation) {\n if (interpolation == null) {\n return '';\n }\n\n var componentSelector = interpolation;\n\n if (componentSelector.__emotion_styles !== undefined) {\n\n return componentSelector;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n var keyframes = interpolation;\n\n if (keyframes.anim === 1) {\n cursor = {\n name: keyframes.name,\n styles: keyframes.styles,\n next: cursor\n };\n return keyframes.name;\n }\n\n var serializedStyles = interpolation;\n\n if (serializedStyles.styles !== undefined) {\n var next = serializedStyles.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = serializedStyles.styles + \";\";\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result);\n }\n\n break;\n }\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n var asString = interpolation;\n\n if (registered == null) {\n return asString;\n }\n\n var cached = registered[asString];\n return cached !== undefined ? cached : asString;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i]) + \";\";\n }\n } else {\n for (var key in obj) {\n var value = obj[key];\n\n if (typeof value !== 'object') {\n var asString = value;\n\n if (registered != null && registered[asString] !== undefined) {\n string += key + \"{\" + registered[asString] + \"}\";\n } else if (isProcessableValue(asString)) {\n string += processStyleName(key) + \":\" + processStyleValue(key, asString) + \";\";\n }\n } else {\n if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {\n throw new Error(noComponentSelectorMessage);\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(key) + \":\" + processStyleValue(key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value);\n\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n\n string += key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;{]+)\\s*(;|$)/g; // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\nvar cursor;\nfunction serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings);\n } else {\n var asTemplateStringsArr = strings;\n\n styles += asTemplateStringsArr[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i]);\n\n if (stringMode) {\n var templateStringsArr = strings;\n\n styles += templateStringsArr[i];\n }\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n}\n\nexport { serializeStyles };\n","import * as React from 'react';\n\nvar syncFallback = function syncFallback(create) {\n return create();\n};\n\nvar useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;\nvar useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;\nvar useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;\n\nexport { useInsertionEffectAlwaysWithSyncFallback, useInsertionEffectWithLayoutFallback };\n","import * as React from 'react';\nimport { useContext, forwardRef } from 'react';\nimport createCache from '@emotion/cache';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport weakMemoize from '@emotion/weak-memoize';\nimport hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\n\nvar isDevelopment = false;\n\nvar EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case\n// because this module is primarily intended for the browser and node\n// but it's also required in react native and similar environments sometimes\n// and we could have a special build just for that\n// but this is much easier and the native packages\n// might use a different theme context in the future anyway\ntypeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({\n key: 'css'\n}) : null);\n\nvar CacheProvider = EmotionCacheContext.Provider;\nvar __unsafe_useEmotionCache = function useEmotionCache() {\n return useContext(EmotionCacheContext);\n};\n\nvar withEmotionCache = function withEmotionCache(func) {\n return /*#__PURE__*/forwardRef(function (props, ref) {\n // the cache will never be null in the browser\n var cache = useContext(EmotionCacheContext);\n return func(props, cache, ref);\n });\n};\n\nvar ThemeContext = /* #__PURE__ */React.createContext({});\n\nvar useTheme = function useTheme() {\n return React.useContext(ThemeContext);\n};\n\nvar getTheme = function getTheme(outerTheme, theme) {\n if (typeof theme === 'function') {\n var mergedTheme = theme(outerTheme);\n\n return mergedTheme;\n }\n\n return _extends({}, outerTheme, theme);\n};\n\nvar createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {\n return weakMemoize(function (theme) {\n return getTheme(outerTheme, theme);\n });\n});\nvar ThemeProvider = function ThemeProvider(props) {\n var theme = React.useContext(ThemeContext);\n\n if (props.theme !== theme) {\n theme = createCacheWithTheme(theme)(props.theme);\n }\n\n return /*#__PURE__*/React.createElement(ThemeContext.Provider, {\n value: theme\n }, props.children);\n};\nfunction withTheme(Component) {\n var componentName = Component.displayName || Component.name || 'Component';\n var WithTheme = /*#__PURE__*/React.forwardRef(function render(props, ref) {\n var theme = React.useContext(ThemeContext);\n return /*#__PURE__*/React.createElement(Component, _extends({\n theme: theme,\n ref: ref\n }, props));\n });\n WithTheme.displayName = \"WithTheme(\" + componentName + \")\";\n return hoistNonReactStatics(WithTheme, Component);\n}\n\nvar hasOwn = {}.hasOwnProperty;\n\nvar typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';\nvar createEmotionProps = function createEmotionProps(type, props) {\n\n var newProps = {};\n\n for (var _key in props) {\n if (hasOwn.call(props, _key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:\n\n return newProps;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n return null;\n};\n\nvar Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {\n var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works\n // not passing the registered cache to serializeStyles because it would\n // make certain babel optimisations not possible\n\n if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {\n cssProp = cache.registered[cssProp];\n }\n\n var WrappedComponent = props[typePropName];\n var registeredStyles = [cssProp];\n var className = '';\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, registeredStyles, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));\n\n className += cache.key + \"-\" + serialized.name;\n var newProps = {};\n\n for (var _key2 in props) {\n if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (!isDevelopment )) {\n newProps[_key2] = props[_key2];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof WrappedComponent === 'string'\n }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));\n});\n\nvar Emotion$1 = Emotion;\n\nexport { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, ThemeProvider as a, withTheme as b, createEmotionProps as c, hasOwn as h, isDevelopment as i, useTheme as u, withEmotionCache as w };\n","import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isDevelopment } from './emotion-element-f0de968e.browser.esm.js';\nexport { C as CacheProvider, T as ThemeContext, a as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, b as withTheme } from './emotion-element-f0de968e.browser.esm.js';\nimport * as React from 'react';\nimport { insertStyles, registerStyles, getRegisteredStyles } from '@emotion/utils';\nimport { useInsertionEffectWithLayoutFallback, useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { serializeStyles } from '@emotion/serialize';\nimport '@emotion/cache';\nimport '@babel/runtime/helpers/extends';\nimport '@emotion/weak-memoize';\nimport '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport 'hoist-non-react-statics';\n\nvar jsx = function jsx(type, props) {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n\n if (props == null || !hasOwn.call(props, 'css')) {\n return React.createElement.apply(undefined, args);\n }\n\n var argsLength = args.length;\n var createElementArgArray = new Array(argsLength);\n createElementArgArray[0] = Emotion;\n createElementArgArray[1] = createEmotionProps(type, props);\n\n for (var i = 2; i < argsLength; i++) {\n createElementArgArray[i] = args[i];\n }\n\n return React.createElement.apply(null, createElementArgArray);\n};\n\n(function (_jsx) {\n var JSX;\n\n (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));\n})(jsx || (jsx = {}));\n\n// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild\n// initial client-side render from SSR, use place of hydrating tag\n\nvar Global = /* #__PURE__ */withEmotionCache(function (props, cache) {\n\n var styles = props.styles;\n var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));\n // but it is based on a constant that will never change at runtime\n // it's effectively like having two implementations and switching them out\n // so it's not actually breaking anything\n\n\n var sheetRef = React.useRef();\n useInsertionEffectWithLayoutFallback(function () {\n var key = cache.key + \"-global\"; // use case of https://github.com/emotion-js/emotion/issues/2675\n\n var sheet = new cache.sheet.constructor({\n key: key,\n nonce: cache.sheet.nonce,\n container: cache.sheet.container,\n speedy: cache.sheet.isSpeedy\n });\n var rehydrating = false;\n var node = document.querySelector(\"style[data-emotion=\\\"\" + key + \" \" + serialized.name + \"\\\"]\");\n\n if (cache.sheet.tags.length) {\n sheet.before = cache.sheet.tags[0];\n }\n\n if (node !== null) {\n rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s\n\n node.setAttribute('data-emotion', key);\n sheet.hydrate([node]);\n }\n\n sheetRef.current = [sheet, rehydrating];\n return function () {\n sheet.flush();\n };\n }, [cache]);\n useInsertionEffectWithLayoutFallback(function () {\n var sheetRefCurrent = sheetRef.current;\n var sheet = sheetRefCurrent[0],\n rehydrating = sheetRefCurrent[1];\n\n if (rehydrating) {\n sheetRefCurrent[1] = false;\n return;\n }\n\n if (serialized.next !== undefined) {\n // insert keyframes\n insertStyles(cache, serialized.next, true);\n }\n\n if (sheet.tags.length) {\n // if this doesn't exist then it will be null so the style element will be appended\n var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;\n sheet.before = element;\n sheet.flush();\n }\n\n cache.insert(\"\", serialized, sheet, false);\n }, [cache, serialized.name]);\n return null;\n});\n\nfunction css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return serializeStyles(args);\n}\n\nfunction keyframes() {\n var insertable = css.apply(void 0, arguments);\n var name = \"animation-\" + insertable.name;\n return {\n name: name,\n styles: \"@keyframes \" + name + \"{\" + insertable.styles + \"}\",\n anim: 1,\n toString: function toString() {\n return \"_EMO_\" + this.name + \"_\" + this.styles + \"_EMO_\";\n }\n };\n}\n\nvar classnames = function classnames(args) {\n var len = args.length;\n var i = 0;\n var cls = '';\n\n for (; i < len; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serializedArr = _ref.serializedArr;\n useInsertionEffectAlwaysWithSyncFallback(function () {\n\n for (var i = 0; i < serializedArr.length; i++) {\n insertStyles(cache, serializedArr[i], false);\n }\n });\n\n return null;\n};\n\nvar ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {\n var hasRendered = false;\n var serializedArr = [];\n\n var css = function css() {\n if (hasRendered && isDevelopment) {\n throw new Error('css can only be used during render');\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`\n\n registerStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var cx = function cx() {\n if (hasRendered && isDevelopment) {\n throw new Error('cx can only be used during render');\n }\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n var content = {\n css: css,\n cx: cx,\n theme: React.useContext(ThemeContext)\n };\n var ele = props.children(content);\n hasRendered = true;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serializedArr: serializedArr\n }), ele);\n});\n\nexport { ClassNames, Global, jsx as createElement, css, jsx, keyframes };\n","import createCache from '@emotion/cache';\nimport { serializeStyles } from '@emotion/serialize';\nimport { getRegisteredStyles, insertStyles } from '@emotion/utils';\n\nfunction insertWithoutScoping(cache, serialized) {\n if (cache.inserted[serialized.name] === undefined) {\n return cache.insert('', serialized, cache.sheet, true);\n }\n}\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar createEmotion = function createEmotion(options) {\n var cache = createCache(options);\n\n cache.sheet.speedy = function (value) {\n\n this.isSpeedy = value;\n };\n\n cache.compat = true;\n\n var css = function css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered, undefined);\n insertStyles(cache, serialized, false);\n return cache.key + \"-\" + serialized.name;\n };\n\n var keyframes = function keyframes() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n var animation = \"animation-\" + serialized.name;\n insertWithoutScoping(cache, {\n name: serialized.name,\n styles: \"@keyframes \" + animation + \"{\" + serialized.styles + \"}\"\n });\n return animation;\n };\n\n var injectGlobal = function injectGlobal() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n insertWithoutScoping(cache, serialized);\n };\n\n var cx = function cx() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n return {\n css: css,\n cx: cx,\n injectGlobal: injectGlobal,\n keyframes: keyframes,\n hydrate: function hydrate(ids) {\n ids.forEach(function (key) {\n cache.inserted[key] = true;\n });\n },\n flush: function flush() {\n cache.registered = {};\n cache.inserted = {};\n cache.sheet.flush();\n },\n sheet: cache.sheet,\n cache: cache,\n getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),\n merge: merge.bind(null, cache.registered, css)\n };\n};\n\nvar classnames = function classnames(args) {\n var cls = '';\n\n for (var i = 0; i < args.length; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nexport { createEmotion as default };\n","import createEmotion from '../create-instance/dist/emotion-css-create-instance.esm.js';\nimport '@emotion/cache';\nimport '@emotion/serialize';\nimport '@emotion/utils';\n\nvar _createEmotion = createEmotion({\n key: 'css'\n}),\n flush = _createEmotion.flush,\n hydrate = _createEmotion.hydrate,\n cx = _createEmotion.cx,\n merge = _createEmotion.merge,\n getRegisteredStyles = _createEmotion.getRegisteredStyles,\n injectGlobal = _createEmotion.injectGlobal,\n keyframes = _createEmotion.keyframes,\n css = _createEmotion.css,\n sheet = _createEmotion.sheet,\n cache = _createEmotion.cache;\n\nexport { cache, css, cx, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet };\n","// packages/components/src/utils/hooks/use-cx.ts\nimport { __unsafe_useEmotionCache as useEmotionCache } from \"@emotion/react\";\nimport { insertStyles } from \"@emotion/utils\";\nimport { cx as innerCx } from \"@emotion/css\";\nimport { useCallback } from \"@wordpress/element\";\nvar isSerializedStyles = (o) => typeof o !== \"undefined\" && o !== null && [\"name\", \"styles\"].every((p) => typeof o[p] !== \"undefined\");\nvar useCx = () => {\n const cache = useEmotionCache();\n const cx = useCallback((...classNames) => {\n if (cache === null) {\n throw new Error(\"The `useCx` hook should be only used within a valid Emotion Cache Context\");\n }\n return innerCx(...classNames.map((arg) => {\n if (isSerializedStyles(arg)) {\n insertStyles(cache, arg, false);\n return `${cache.key}-${arg.name}`;\n }\n return arg;\n }));\n }, [cache]);\n return cx;\n};\nexport {\n useCx\n};\n//# sourceMappingURL=use-cx.mjs.map\n","// packages/components/src/context/use-context-system.js\nimport warn from \"@wordpress/warning\";\nimport { useComponentsContext } from \"./context-system-provider.mjs\";\nimport { getNamespace, getConnectedNamespace } from \"./utils.mjs\";\nimport { getStyledClassNameFromKey } from \"./get-styled-class-name-from-key.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === \"undefined\") {\n globalThis.SCRIPT_DEBUG === true ? warn(\"useContextSystem: Please provide a namespace\") : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides: overrideProps,\n ...otherContextProps\n } = contextProps;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n const rendered = typeof initialMergedProps.renderChildren === \"function\" ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;\n for (const key in initialMergedProps) {\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n finalComponentProps[key] = overrideProps[key];\n }\n if (rendered !== void 0) {\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}\nexport {\n useContextSystem\n};\n//# sourceMappingURL=use-context-system.mjs.map\n","import memoize from '@emotion/memoize';\n\n// eslint-disable-next-line no-undef\nvar reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\nvar isPropValid = /* #__PURE__ */memoize(function (prop) {\n return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111\n /* o */\n && prop.charCodeAt(1) === 110\n /* n */\n && prop.charCodeAt(2) < 91;\n}\n/* Z+1 */\n);\n\nexport { isPropValid as default };\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport { withEmotionCache, ThemeContext } from '@emotion/react';\nimport { serializeStyles } from '@emotion/serialize';\nimport { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';\nimport { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';\nimport * as React from 'react';\nimport isPropValid from '@emotion/is-prop-valid';\n\nvar isDevelopment = false;\n\nvar testOmitPropsOnStringTag = isPropValid;\n\nvar testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {\n return key !== 'theme';\n};\n\nvar getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {\n return typeof tag === 'string' && // 96 is one less than the char code\n // for \"a\" so this is checking that\n // it's a lowercase character\n tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;\n};\nvar composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {\n var shouldForwardProp;\n\n if (options) {\n var optionsShouldForwardProp = options.shouldForwardProp;\n shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {\n return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);\n } : optionsShouldForwardProp;\n }\n\n if (typeof shouldForwardProp !== 'function' && isReal) {\n shouldForwardProp = tag.__emotion_forwardProp;\n }\n\n return shouldForwardProp;\n};\n\nvar Insertion = function Insertion(_ref) {\n var cache = _ref.cache,\n serialized = _ref.serialized,\n isStringTag = _ref.isStringTag;\n registerStyles(cache, serialized, isStringTag);\n useInsertionEffectAlwaysWithSyncFallback(function () {\n return insertStyles(cache, serialized, isStringTag);\n });\n\n return null;\n};\n\nvar createStyled = function createStyled(tag, options) {\n\n var isReal = tag.__emotion_real === tag;\n var baseTag = isReal && tag.__emotion_base || tag;\n var identifierName;\n var targetClassName;\n\n if (options !== undefined) {\n identifierName = options.label;\n targetClassName = options.target;\n }\n\n var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);\n var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);\n var shouldUseAs = !defaultShouldForwardProp('as');\n return function () {\n // eslint-disable-next-line prefer-rest-params\n var args = arguments;\n var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];\n\n if (identifierName !== undefined) {\n styles.push(\"label:\" + identifierName + \";\");\n }\n\n if (args[0] == null || args[0].raw === undefined) {\n // eslint-disable-next-line prefer-spread\n styles.push.apply(styles, args);\n } else {\n var templateStringsArr = args[0];\n\n styles.push(templateStringsArr[0]);\n var len = args.length;\n var i = 1;\n\n for (; i < len; i++) {\n\n styles.push(args[i], templateStringsArr[i]);\n }\n }\n\n var Styled = withEmotionCache(function (props, cache, ref) {\n var FinalTag = shouldUseAs && props.as || baseTag;\n var className = '';\n var classInterpolations = [];\n var mergedProps = props;\n\n if (props.theme == null) {\n mergedProps = {};\n\n for (var key in props) {\n mergedProps[key] = props[key];\n }\n\n mergedProps.theme = React.useContext(ThemeContext);\n }\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, classInterpolations, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);\n className += cache.key + \"-\" + serialized.name;\n\n if (targetClassName !== undefined) {\n className += \" \" + targetClassName;\n }\n\n var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;\n var newProps = {};\n\n for (var _key in props) {\n if (shouldUseAs && _key === 'as') continue;\n\n if (finalShouldForwardProp(_key)) {\n newProps[_key] = props[_key];\n }\n }\n\n newProps.className = className;\n\n if (ref) {\n newProps.ref = ref;\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {\n cache: cache,\n serialized: serialized,\n isStringTag: typeof FinalTag === 'string'\n }), /*#__PURE__*/React.createElement(FinalTag, newProps));\n });\n Styled.displayName = identifierName !== undefined ? identifierName : \"Styled(\" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + \")\";\n Styled.defaultProps = tag.defaultProps;\n Styled.__emotion_real = Styled;\n Styled.__emotion_base = baseTag;\n Styled.__emotion_styles = styles;\n Styled.__emotion_forwardProp = shouldForwardProp;\n Object.defineProperty(Styled, 'toString', {\n value: function value() {\n if (targetClassName === undefined && isDevelopment) {\n return 'NO_COMPONENT_SELECTOR';\n }\n\n return \".\" + targetClassName;\n }\n });\n\n Styled.withComponent = function (nextTag, nextOptions) {\n var newStyled = createStyled(nextTag, _extends({}, options, nextOptions, {\n shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)\n }));\n return newStyled.apply(void 0, styles);\n };\n\n return Styled;\n };\n};\n\nexport { createStyled as default };\n","// packages/components/src/view/component.tsx\nimport _styled from \"@emotion/styled/base\";\nimport { forwardRef } from \"@wordpress/element\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar PolymorphicDiv = /* @__PURE__ */ _styled(\"div\", process.env.NODE_ENV === \"production\" ? {\n target: \"e19lxcc00\"\n} : {\n target: \"e19lxcc00\",\n label: \"PolymorphicDiv\"\n})(process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZWlDIiwiZmlsZSI6ImNvbXBvbmVudC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbi8qKlxuICogV29yZFByZXNzIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBmb3J3YXJkUmVmIH0gZnJvbSAnQHdvcmRwcmVzcy9lbGVtZW50JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL2NvbnRleHQnO1xuXG5jb25zdCBQb2x5bW9ycGhpY0RpdiA9IHN0eWxlZC5kaXZgYDtcblxuZnVuY3Rpb24gVW5mb3J3YXJkZWRWaWV3PCBUIGV4dGVuZHMgUmVhY3QuRWxlbWVudFR5cGUgPSAnZGl2JyA+KFxuXHR7IGFzLCAuLi5yZXN0UHJvcHMgfTogV29yZFByZXNzQ29tcG9uZW50UHJvcHM8IHt9LCBUID4sXG5cdHJlZjogUmVhY3QuRm9yd2FyZGVkUmVmPCBhbnkgPlxuKSB7XG5cdHJldHVybiA8UG9seW1vcnBoaWNEaXYgYXM9eyBhcyB9IHJlZj17IHJlZiB9IHsgLi4ucmVzdFByb3BzIH0gLz47XG59XG5cbi8qKlxuICogYFZpZXdgIGlzIGEgY29yZSBjb21wb25lbnQgdGhhdCByZW5kZXJzIGV2ZXJ5dGhpbmcgaW4gdGhlIGxpYnJhcnkuXG4gKiBJdCBpcyB0aGUgcHJpbmNpcGxlIGNvbXBvbmVudCBpbiB0aGUgZW50aXJlIGxpYnJhcnkuXG4gKlxuICogYGBganN4XG4gKiBpbXBvcnQgeyBWaWV3IH0gZnJvbSBgQHdvcmRwcmVzcy9jb21wb25lbnRzYDtcbiAqXG4gKiBmdW5jdGlvbiBFeGFtcGxlKCkge1xuICogXHRyZXR1cm4gKFxuICogXHRcdDxWaWV3PlxuICogXHRcdFx0IENvZGUgaXMgUG9ldHJ5XG4gKiBcdFx0PC9WaWV3PlxuICogXHQpO1xuICogfVxuICogYGBgXG4gKi9cbmV4cG9ydCBjb25zdCBWaWV3ID0gT2JqZWN0LmFzc2lnbiggZm9yd2FyZFJlZiggVW5mb3J3YXJkZWRWaWV3ICksIHtcblx0c2VsZWN0b3I6ICcuY29tcG9uZW50cy12aWV3Jyxcbn0gKTtcblxuZXhwb3J0IGRlZmF1bHQgVmlldztcbiJdfQ== */\");\nfunction UnforwardedView({\n as,\n ...restProps\n}, ref) {\n return /* @__PURE__ */ _jsx(PolymorphicDiv, {\n as,\n ref,\n ...restProps\n });\n}\nvar View = Object.assign(forwardRef(UnforwardedView), {\n selector: \".components-view\"\n});\nvar component_default = View;\nexport {\n View,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","// packages/components/src/grid/utils.ts\nvar ALIGNMENTS = {\n bottom: {\n alignItems: \"flex-end\",\n justifyContent: \"center\"\n },\n bottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n },\n bottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\"\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n spaced: {\n alignItems: \"center\",\n justifyContent: \"space-between\"\n },\n left: {\n alignItems: \"center\",\n justifyContent: \"flex-start\"\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\"\n },\n stretch: {\n alignItems: \"stretch\"\n },\n top: {\n alignItems: \"flex-start\",\n justifyContent: \"center\"\n },\n topLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\"\n },\n topRight: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\"\n }\n};\nfunction getAlignmentProps(alignment) {\n const alignmentProps = alignment ? ALIGNMENTS[alignment] : {};\n return alignmentProps;\n}\nexport {\n getAlignmentProps\n};\n//# sourceMappingURL=utils.mjs.map\n","// packages/components/src/utils/use-responsive-value.ts\nimport { useEffect, useState } from \"@wordpress/element\";\nvar breakpoints = [\"40em\", \"52em\", \"64em\"];\nvar useBreakpointIndex = (options = {}) => {\n const {\n defaultIndex = 0\n } = options;\n if (typeof defaultIndex !== \"number\") {\n throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);\n } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {\n throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);\n }\n const [value, setValue] = useState(defaultIndex);\n useEffect(() => {\n const getIndex = () => breakpoints.filter((bp) => {\n return typeof window !== \"undefined\" ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;\n }).length;\n const onResize = () => {\n const newValue = getIndex();\n if (value !== newValue) {\n setValue(newValue);\n }\n };\n onResize();\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"resize\", onResize);\n }\n return () => {\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"resize\", onResize);\n }\n };\n }, [value]);\n return value;\n};\nfunction useResponsiveValue(values, options = {}) {\n const index = useBreakpointIndex(options);\n if (!Array.isArray(values) && typeof values !== \"function\") {\n return values;\n }\n const array = values || [];\n return array[index >= array.length ? array.length - 1 : index];\n}\nexport {\n useBreakpointIndex,\n useResponsiveValue\n};\n//# sourceMappingURL=use-responsive-value.mjs.map\n","// packages/components/src/utils/colors-values.js\nvar white = \"#fff\";\nvar GRAY = {\n 900: \"#1e1e1e\",\n 800: \"#2f2f2f\",\n /** Meets 4.6:1 text contrast against white. */\n 700: \"#757575\",\n /** Meets 3:1 UI or large text contrast against white. */\n 600: \"#949494\",\n 400: \"#ccc\",\n /** Used for most borders. */\n 300: \"#ddd\",\n /** Used sparingly for light borders. */\n 200: \"#e0e0e0\",\n /** Used for light gray backgrounds. */\n 100: \"#f0f0f0\"\n};\nvar ALERT = {\n yellow: \"#f0b849\",\n red: \"#d94f4f\",\n green: \"#4ab866\"\n};\nvar THEME = {\n accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,\n accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,\n accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,\n /** Used when placing text on the accent color. */\n accentInverted: `var(--wp-components-color-accent-inverted, var(--wpds-color-foreground-interactive-brand-strong, #fff))`,\n background: `var(--wp-components-color-background, var(--wpds-color-background-surface-neutral-strong, #fff))`,\n foreground: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n /** Used when placing text on the foreground color. */\n foregroundInverted: `var(--wp-components-color-foreground-inverted, var(--wpds-color-background-surface-neutral, #fcfcfc))`,\n gray: {\n /** @deprecated Use `COLORS.theme.foreground` instead. */\n 900: `var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 800: `var(--wp-components-color-gray-800, var(--wpds-color-foreground-content-neutral, #1e1e1e))`,\n 700: `var(--wp-components-color-gray-700, var(--wpds-color-foreground-content-neutral-weak, #707070))`,\n 600: `var(--wp-components-color-gray-600, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 400: `var(--wp-components-color-gray-400, var(--wpds-color-stroke-interactive-neutral, #8d8d8d))`,\n 300: `var(--wp-components-color-gray-300, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 200: `var(--wp-components-color-gray-200, var(--wpds-color-stroke-surface-neutral, #dbdbdb))`,\n 100: `var(--wp-components-color-gray-100, var(--wpds-color-background-surface-neutral, #fcfcfc))`\n }\n};\nvar UI = {\n background: THEME.background,\n backgroundDisabled: THEME.gray[100],\n border: THEME.gray[600],\n borderHover: THEME.gray[700],\n borderFocus: THEME.accent,\n borderDisabled: THEME.gray[400],\n textDisabled: THEME.gray[600],\n // Matches @wordpress/base-styles\n darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,\n lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`\n};\nvar COLORS = Object.freeze({\n /**\n * The main gray color object.\n *\n * @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.\n */\n gray: GRAY,\n // TODO: Stop exporting this when everything is migrated to `theme` or `ui`\n /**\n * @deprecated Prefer theme-ready variables in `COLORS.theme`.\n */\n white,\n alert: ALERT,\n /**\n * Theme-ready variables with fallbacks.\n *\n * Prefer semantic aliases in `COLORS.ui` when applicable.\n */\n theme: THEME,\n /**\n * Semantic aliases (prefer these over raw variables when applicable).\n */\n ui: UI\n});\nvar colors_values_default = COLORS;\nexport {\n COLORS,\n colors_values_default as default\n};\n//# sourceMappingURL=colors-values.mjs.map\n","// packages/components/src/utils/config-values.js\nimport { COLORS } from \"./colors-values.mjs\";\nvar CONTROL_HEIGHT = \"36px\";\nvar CONTROL_PROPS = {\n // These values should be shared with TextControl.\n controlPaddingX: 12,\n controlPaddingXSmall: 8,\n controlPaddingXLarge: 12 * 1.3334,\n // TODO: Deprecate\n controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`,\n controlHeight: CONTROL_HEIGHT,\n controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,\n controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,\n controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,\n controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`\n};\nvar config_values_default = Object.assign({}, CONTROL_PROPS, {\n colorDivider: \"rgba(0, 0, 0, 0.1)\",\n colorScrollbarThumb: \"rgba(0, 0, 0, 0.2)\",\n colorScrollbarThumbHover: \"rgba(0, 0, 0, 0.5)\",\n colorScrollbarTrack: \"rgba(0, 0, 0, 0.04)\",\n elevationIntensity: 1,\n radiusXSmall: \"1px\",\n radiusSmall: \"2px\",\n radiusMedium: \"4px\",\n radiusLarge: \"8px\",\n radiusFull: \"9999px\",\n radiusRound: \"50%\",\n borderWidth: \"1px\",\n borderWidthFocus: \"1.5px\",\n borderWidthTab: \"4px\",\n spinnerSize: 16,\n fontSize: \"13px\",\n fontSizeH1: \"calc(2.44 * 13px)\",\n fontSizeH2: \"calc(1.95 * 13px)\",\n fontSizeH3: \"calc(1.56 * 13px)\",\n fontSizeH4: \"calc(1.25 * 13px)\",\n fontSizeH5: \"13px\",\n fontSizeH6: \"calc(0.8 * 13px)\",\n fontSizeInputMobile: \"16px\",\n fontSizeMobile: \"15px\",\n fontSizeSmall: \"calc(0.92 * 13px)\",\n fontSizeXSmall: \"calc(0.75 * 13px)\",\n fontLineHeightBase: \"1.4\",\n fontWeight: \"normal\",\n fontWeightMedium: \"499\",\n // ensures fallback to 400 (instead of 600)\n fontWeightHeading: \"600\",\n gridBase: \"4px\",\n elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,\n elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,\n elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,\n elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,\n surfaceBackgroundColor: COLORS.white,\n surfaceBackgroundSubtleColor: \"#F3F3F3\",\n surfaceBackgroundTintColor: \"#F5F5F5\",\n surfaceBorderColor: \"rgba(0, 0, 0, 0.1)\",\n surfaceBorderBoldColor: \"rgba(0, 0, 0, 0.15)\",\n surfaceBorderSubtleColor: \"rgba(0, 0, 0, 0.05)\",\n surfaceBackgroundTertiaryColor: COLORS.white,\n surfaceColor: COLORS.white,\n // Modal exit animation: `use-modal-exit-animation` parses this for the\n // `animationend` timeout race; keep the numeric duration equal to the WPDS\n // `motion-duration-md` token on `.components-modal__frame` in modal/style.scss.\n transitionDuration: \"200ms\",\n transitionDurationFast: \"160ms\",\n transitionDurationFaster: \"120ms\",\n transitionDurationFastest: \"100ms\",\n transitionTimingFunction: \"cubic-bezier(0.08, 0.52, 0.52, 1)\",\n transitionTimingFunctionControl: \"cubic-bezier(0.12, 0.8, 0.32, 1)\"\n});\nexport {\n config_values_default as default\n};\n//# sourceMappingURL=config-values.mjs.map\n","// packages/components/src/grid/hook.ts\nimport { css } from \"@emotion/react\";\nimport { useMemo } from \"@wordpress/element\";\nimport { useContextSystem } from \"../context/index.mjs\";\nimport { getAlignmentProps } from \"./utils.mjs\";\nimport { useResponsiveValue } from \"../utils/use-responsive-value.mjs\";\nimport CONFIG from \"../utils/config-values.mjs\";\nimport { useCx } from \"../utils/hooks/use-cx.mjs\";\nfunction useGrid(props) {\n const {\n align,\n alignment,\n className,\n columnGap,\n columns = 2,\n gap = 3,\n isInline = false,\n justify,\n rowGap,\n rows,\n templateColumns,\n templateRows,\n ...otherProps\n } = useContextSystem(props, \"Grid\");\n const columnsAsArray = Array.isArray(columns) ? columns : [columns];\n const column = useResponsiveValue(columnsAsArray);\n const rowsAsArray = Array.isArray(rows) ? rows : [rows];\n const row = useResponsiveValue(rowsAsArray);\n const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;\n const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;\n const cx = useCx();\n const classes = useMemo(() => {\n const alignmentProps = getAlignmentProps(alignment);\n const gridClasses = /* @__PURE__ */ css({\n alignItems: align,\n display: isInline ? \"inline-grid\" : \"grid\",\n gap: `calc( ${CONFIG.gridBase} * ${gap} )`,\n gridTemplateColumns: gridTemplateColumns || void 0,\n gridTemplateRows: gridTemplateRows || void 0,\n gridRowGap: rowGap,\n gridColumnGap: columnGap,\n justifyContent: justify,\n verticalAlign: isInline ? \"middle\" : void 0,\n ...alignmentProps\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:gridClasses;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBdURzQiIsImZpbGUiOiJob29rLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlTWVtbyB9IGZyb20gJ0B3b3JkcHJlc3MvZWxlbWVudCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB0eXBlIHsgV29yZFByZXNzQ29tcG9uZW50UHJvcHMgfSBmcm9tICcuLi9jb250ZXh0JztcbmltcG9ydCB7IHVzZUNvbnRleHRTeXN0Z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PyAnbWlkZGxlJyA6IHVuZGVmaW5lZCxcblx0XHRcdC4uLmFsaWdubWVudFByb3BzLFxuXHRcdH0gKTtcblxuXHRcdHJldHVybiBjeCggZ3JpZENsYXNzZXMsIGNsYXNzTmFtZSApO1xuXHR9LCBbXG5cdFx0YWxpZ24sXG5cdFx0YWxpZ25tZW50LFxuXHRcdGNsYXNzTmFtZSxcblx0XHRjb2x1bW5HYXAsXG5cdFx0Y3gsXG5cdFx0Z2FwLFxuXHRcdGdyaWRUZW1wbGF0ZUNvbHVtbnMsXG5cdFx0Z3JpZFRlbXBsYXRlUm93cyxcblx0XHRpc0lubGluZSxcblx0XHRqdXN0aWZ5LFxuXHRcdHJvd0dhcCxcblx0XSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcyB9O1xufVxuIl19 */\");\n return cx(gridClasses, className);\n }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);\n return {\n ...otherProps,\n className: classes\n };\n}\nexport {\n useGrid as default\n};\n//# sourceMappingURL=hook.mjs.map\n","// packages/components/src/grid/component.tsx\nimport { contextConnect } from \"../context/index.mjs\";\nimport { View } from \"../view/index.mjs\";\nimport useGrid from \"./hook.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnconnectedGrid(props, forwardedRef) {\n const gridProps = useGrid(props);\n return /* @__PURE__ */ _jsx(View, {\n ...gridProps,\n ref: forwardedRef\n });\n}\nvar Grid = contextConnect(UnconnectedGrid, \"Grid\");\nvar component_default = Grid;\nexport {\n Grid,\n component_default as default\n};\n//# sourceMappingURL=component.mjs.map\n","import { __ } from '@wordpress/i18n';\nimport { useMemo } from 'react';\nimport { useGlobalChartsTheme, useGlobalChartsContext } from '../../../providers';\nimport type { BaseLegendItem } from '../../../components/legend';\nimport type { LeaderboardEntry } from '../../../types';\n\n/**\n * Hook to create legend items from leaderboard data\n * @param root0 - Configuration object\n * @param root0.data - Array of leaderboard entries\n * @param root0.primaryColor - Primary color override\n * @param root0.secondaryColor - Secondary color override\n * @param root0.withComparison - Whether comparison data is shown\n * @param root0.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param root0.legendLabels - Custom labels for legend items\n * @param root0.legendLabels.primary - Label for primary period data\n * @param root0.legendLabels.comparison - Label for comparison period data\n * @return Array of legend items for the leaderboard chart\n */\nexport function useLeaderboardLegendItems( {\n\tdata,\n\tprimaryColor,\n\tsecondaryColor,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tlegendLabels,\n}: {\n\tdata: LeaderboardEntry[];\n\tprimaryColor?: string;\n\tsecondaryColor?: string;\n\twithComparison: boolean;\n\twithOverlayLabel: boolean;\n\tlegendLabels?: {\n\t\tprimary?: string;\n\t\tcomparison?: string;\n\t};\n} ): BaseLegendItem[] {\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst items: BaseLegendItem[] = [];\n\n\t\t// Add current period legend item\n\t\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\t\tindex: 0,\n\t\t\toverrideColor: primaryColor || leaderboardChartSettings.primaryColor,\n\t\t} );\n\n\t\titems.push( {\n\t\t\tlabel: legendLabels?.primary || __( 'Current period', 'jetpack-charts' ),\n\t\t\tcolor: resolvedPrimaryColor,\n\t\t} );\n\n\t\t// Add comparison period legend item if comparison is enabled and overlay label is not enabled\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\t\t\tindex: 1,\n\t\t\t\toverrideColor: secondaryColor || leaderboardChartSettings.secondaryColor,\n\t\t\t} );\n\n\t\t\titems.push( {\n\t\t\t\tlabel: legendLabels?.comparison || __( 'Previous period', 'jetpack-charts' ),\n\t\t\t\tcolor: resolvedSecondaryColor,\n\t\t\t} );\n\t\t}\n\n\t\treturn items;\n\t}, [\n\t\tdata,\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\tlegendLabels,\n\t\tleaderboardChartSettings,\n\t\tgetElementStyles,\n\t\twithOverlayLabel,\n\t] );\n}\n","/* eslint-disable @wordpress/no-unsafe-wp-apis */\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { Fragment } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { Stack, Text } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { useContext, useMemo, type FC } from 'react';\nimport { Legend } from '../../components/legend';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport {\n\tGlobalChartsContext,\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n} from '../../providers';\nimport { formatMetricValue, attachSubComponents } from '../../utils';\nimport { useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport { useLeaderboardLegendItems } from './hooks';\nimport styles from './leaderboard-chart.module.scss';\nimport type { LeaderboardChartProps } from './types';\nimport type { LeaderboardEntry } from '../../types';\n\n/**\n * Default value formatter using formatMetricValue\n *\n * @param value - The numeric value to format\n * @return Formatted string representation of the value\n */\nconst defaultValueFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value, 'number', {\n\t\tuseMultipliers: true,\n\t\tdecimals: 1,\n\t} );\n};\n\n/**\n * Default delta formatter using formatMetricValue\n *\n * @param value - The delta value to format\n * @return Formatted percentage string\n */\nconst defaultDeltaFormatter = ( value: number ): string => {\n\treturn formatMetricValue( value / 100, 'average', {\n\t\tdecimals: 0,\n\t\tsignDisplay: 'exceptZero',\n\t} );\n};\n\n/**\n * Build a bar's width. A hover-inset CSS variable (0 by default) is subtracted\n * on hover, scaled by the bar's share so the pull-back is proportional to its\n * length: the full-length (100%) bar — the one that reaches the value — pulls\n * back the whole inset to keep its gap with the value, while shorter bars pull\n * back proportionally less, down to ~0 for a very short bar.\n *\n * @param share - The bar's share of the row width, as a percentage.\n * @return A CSS width value.\n */\nconst getBarWidth = ( share: number ): string =>\n\t`calc(${ share }% - var(--a8c--charts--leaderboard--bar--hover-inset, 0px) * ${ share } / 100)`;\n\nconst BarLabel = ( { label }: { label: LeaderboardEntry[ 'label' ] } ) => (\n\t<>{ typeof label === 'string' ? <Text className={ styles.label }>{ label }</Text> : label }</>\n);\n\nconst BarWithLabel = ( {\n\tentry,\n\twithComparison,\n\twithOverlayLabel,\n\tprimaryColor,\n\tsecondaryColor,\n\tanimation,\n\tisPrimaryVisible = true,\n\tisComparisonVisible = true,\n}: {\n\tentry: LeaderboardEntry;\n\twithComparison?: boolean;\n\twithOverlayLabel?: boolean;\n\tprimaryColor: string;\n\tsecondaryColor: string;\n\tisPrimaryVisible?: boolean;\n\tisComparisonVisible?: boolean;\n\tanimation?: boolean;\n} ) => (\n\t<div\n\t\tclassName={ clsx( styles.barWithLabelContainer, {\n\t\t\t[ styles[ 'is-overlay' ] ]: withOverlayLabel,\n\t\t} ) }\n\t>\n\t\t<BarLabel label={ entry.label } />\n\n\t\t{ isPrimaryVisible && (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: getBarWidth( entry.currentShare ),\n\t\t\t\t\tbackgroundColor: primaryColor,\n\t\t\t\t} }\n\t\t\t></div>\n\t\t) }\n\n\t\t{ withComparison && ! withOverlayLabel && isComparisonVisible && (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( styles.bar, {\n\t\t\t\t\t[ styles[ 'bar--animated' ] ]: animation,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: getBarWidth( entry.previousShare ),\n\t\t\t\t\tbackgroundColor: secondaryColor,\n\t\t\t\t} }\n\t\t\t></div>\n\t\t) }\n\t</div>\n);\n\n/**\n * LeaderboardChart component displays a ranked list of data with progress bars\n * and optional comparison values.\n *\n * @param props - Component props\n * @param props.data - Array of leaderboard entries to display\n * @param props.chartId - Optional unique identifier for the chart\n * @param props.width - Optional width of the chart container in pixels\n * @param props.height - Optional height of the chart container in pixels\n * @param props.withComparison - Whether to show comparison data\n * @param props.withOverlayLabel - Whether to overlay the label on top of the bar\n * @param props.primaryColor - Primary color for current period bars\n * @param props.secondaryColor - Secondary color for comparison period bars\n * @param props.valueFormatter - Custom formatter for values\n * @param props.deltaFormatter - Custom formatter for delta values\n * @param props.loading - Whether the chart is in loading state\n * @param props.animation - Whether the chart should animate on load\n * @param props.showLegend - Whether to show legend\n * @param props.legend - Legend configuration (orientation, position, alignment, shape, shapeStyles, interactive)\n * @param props.legendLabels - Custom labels for legend items\n * @param props.gap - Spacing between legend and chart content\n * @param props.children - Child components for composition API\n * @param props.className - Additional CSS class name\n * @param props.style - Custom styling for the chart container\n * @return JSX element representing the leaderboard chart\n */\nconst LeaderboardChartInternal: FC< LeaderboardChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\twithComparison = false,\n\twithOverlayLabel = false,\n\tprimaryColor,\n\tsecondaryColor,\n\tvalueFormatter = defaultValueFormatter,\n\tdeltaFormatter = defaultDeltaFormatter,\n\tanimation,\n\tloading = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendLabels,\n\tgap = 'md',\n\tclassName,\n\tstyle,\n\tchildren,\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { leaderboardChart: leaderboardChartSettings } = useGlobalChartsTheme();\n\tconst legendShapeStyles = { width: 8, height: 8, ...legend.shapeStyles };\n\n\t// Process children to extract compound components\n\tconst { legendChildren, nonLegendChildren } = useChartChildren( children, 'LeaderboardChart' );\n\tconst {\n\t\tlabelSpacing,\n\t\trowGap,\n\t\tcolumnGap,\n\t\tprimaryColor: settingsPrimaryColor,\n\t\tsecondaryColor: settingsSecondaryColor,\n\t\tdeltaColors,\n\t} = leaderboardChartSettings;\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\tconst { color: resolvedPrimaryColor } = getElementStyles( {\n\t\tindex: 0,\n\t\toverrideColor: primaryColor || settingsPrimaryColor,\n\t} );\n\tconst { color: resolvedSecondaryColor } = getElementStyles( {\n\t\tindex: 1,\n\t\toverrideColor: secondaryColor || settingsSecondaryColor,\n\t} );\n\n\t// Create legend items using the custom hook\n\tconst legendItems = useLeaderboardLegendItems( {\n\t\tdata: data || [],\n\t\tprimaryColor,\n\t\tsecondaryColor,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t\tlegendLabels,\n\t} );\n\n\t// Track visibility of primary and comparison series for interactive legends\n\tconst isPrimaryVisible = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive || legendItems.length === 0 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 0 ].label );\n\t}, [ chartId, legendInteractive, legendItems, isSeriesVisible ] );\n\n\tconst isComparisonVisible = useMemo( () => {\n\t\tif ( ! chartId || ! legendInteractive || legendItems.length < 2 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isSeriesVisible( chartId, legendItems[ 1 ].label );\n\t}, [ chartId, legendInteractive, legendItems, isSeriesVisible ] );\n\n\t// Check if all series are hidden\n\tconst allSeriesHidden = useMemo( () => {\n\t\tif ( ! legendInteractive ) return false;\n\t\tif ( withComparison && ! withOverlayLabel ) {\n\t\t\treturn ! isPrimaryVisible && ! isComparisonVisible;\n\t\t}\n\t\treturn ! isPrimaryVisible;\n\t}, [\n\t\tlegendInteractive,\n\t\tisPrimaryVisible,\n\t\tisComparisonVisible,\n\t\twithComparison,\n\t\twithOverlayLabel,\n\t] );\n\n\t// Validate data\n\tconst isDataValid = Boolean( data && data.length > 0 );\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\twithComparison,\n\t\t\twithOverlayLabel,\n\t\t} ),\n\t\t[ withComparison, withOverlayLabel ]\n\t);\n\n\t// Register chart with context\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'leaderboard',\n\t\tisDataValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\t// Handle empty or undefined data\n\tif ( ! data || data.length === 0 ) {\n\t\treturn (\n\t\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t\t<ChartLayout\n\t\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\t\tlegendElement={ false }\n\t\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tgap={ gap }\n\t\t\t\t\tstyle={ { ...style, width: propWidth || undefined, height: propHeight || undefined } }\n\t\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t\t>\n\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t{ loading\n\t\t\t\t\t\t\t? __( 'Loading…', 'jetpack-charts' )\n\t\t\t\t\t\t\t: __( 'No data available', 'jetpack-charts' ) }\n\t\t\t\t\t</div>\n\t\t\t\t</ChartLayout>\n\t\t\t</SingleChartContext.Provider>\n\t\t);\n\t}\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tshapeStyles={ legendShapeStyles }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.leaderboardChart,\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t\t[ styles[ 'leaderboardChart--loading' ] ]: loading,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tgap={ gap }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...style,\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"leaderboard-chart-container\"\n\t\t\t\ttrailingContent={ nonLegendChildren }\n\t\t\t>\n\t\t\t\t<div className={ styles.leaderboardChart__content }>\n\t\t\t\t\t{ allSeriesHidden ? (\n\t\t\t\t\t\t<div className={ styles.emptyState }>\n\t\t\t\t\t\t\t{ __( 'All series are hidden. Click legend items to show data.', 'jetpack-charts' ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Grid templateColumns=\"minmax(0, 1fr) auto\" rowGap={ rowGap } columnGap={ columnGap }>\n\t\t\t\t\t\t\t{ data.map( entry => {\n\t\t\t\t\t\t\t\tconst colorIndex = Math.sign( entry.delta ) + 1;\n\t\t\t\t\t\t\t\tconst deltaColor = deltaColors[ colorIndex ];\n\n\t\t\t\t\t\t\t\tconst rowCells = (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={ labelSpacing }>\n\t\t\t\t\t\t\t\t\t\t\t<BarWithLabel\n\t\t\t\t\t\t\t\t\t\t\t\tentry={ entry }\n\t\t\t\t\t\t\t\t\t\t\t\twithComparison={ withComparison }\n\t\t\t\t\t\t\t\t\t\t\t\twithOverlayLabel={ withOverlayLabel }\n\t\t\t\t\t\t\t\t\t\t\t\tprimaryColor={ resolvedPrimaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tsecondaryColor={ resolvedSecondaryColor }\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimaryVisible={ isPrimaryVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tisComparisonVisible={ isComparisonVisible }\n\t\t\t\t\t\t\t\t\t\t\t\tanimation={ animation && ! loading && ! prefersReducedMotion }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\t\tgap=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx( styles.valueContainer, {\n\t\t\t\t\t\t\t\t\t\t\t\t[ styles.overlayLabel ]: withOverlayLabel,\n\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ isPrimaryVisible && <Text>{ valueFormatter( entry.currentValue ) }</Text> }\n\n\t\t\t\t\t\t\t\t\t\t\t{ withComparison && isComparisonVisible && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text style={ { color: deltaColor } }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ deltaFormatter( entry.delta ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( entry.onClick ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tkey={ entry.id }\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.interactiveRow }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ entry.onClick }\n\t\t\t\t\t\t\t\t\t\t\taria-label={ entry.ariaLabel }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ rowCells }\n\t\t\t\t\t\t\t\t\t\t\t<Icon className={ styles.chevron } icon={ chevronRight } size={ 24 } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn <Fragment key={ entry.id }>{ rowCells }</Fragment>;\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst LeaderboardChartWithProvider: FC< LeaderboardChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <LeaderboardChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<LeaderboardChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nLeaderboardChartWithProvider.displayName = 'LeaderboardChart';\n\n// Create LeaderboardChart with composition API\nconst LeaderboardChart = attachSubComponents( LeaderboardChartWithProvider, {\n\tLegend: Legend,\n} );\n\n// Create responsive LeaderboardChart with composition API\nconst LeaderboardChartResponsive = attachSubComponents(\n\twithResponsive< LeaderboardChartProps >( LeaderboardChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t}\n);\n\nexport { LeaderboardChartResponsive as default, LeaderboardChart as LeaderboardChartUnresponsive };\n","/**\n * This animation uses the SVG self-drawing technique (source: https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/),\n * leveraging stroke-dasharray and stroke-dashoffset properties to create the effect.\n *\n * Here, we reverse the animation to \"un-draw\" the circle for the revealing / radial wipe effect:\n * - Initially, the entire circle is drawn with a white mask.\n * - The circle's border (stroke) is drawn with a black stroke, wide enough to cover the circle.\n * - The stroke is then \"un-drawn,\" creating the wipe animation.\n * - A white mask makes the area visible, while a black mask makes the area invisible.\n */\n\ntype Angle = `${ number }deg` | `${ number }rad` | `${ number }grad` | `${ number }turn` | 0 | '0';\n\n/**\n * RadialWipeAnimationProps - SVG mask props that requires a radial wipe animation effect.\n *\n * @param {object} props - The properties object.\n * @param {string} props.id - The unique ID for the mask.\n * @param {number} props.radius - The outer radius of the radial wipe.\n * @param {number} [props.innerRadius=0] - The inner radius of the radial wipe.\n * @param {number} [props.durationMs=1000] - The duration of the animation in milliseconds.\n * @param {number} [props.wipePercentage=100] - The percentage of the wipe animation to complete.\n * @param {'clockwise' | 'counter-clockwise'} [props.direction='clockwise'] - The direction of the wipe animation.\n * @param {Angle} [props.startAngle='-90deg'] - The starting angle of the wipe animation.\n *\n * @return {JSX.Element} The radial wipe mask element.\n */\nexport type RadialWipeAnimationProps = {\n\tid: string;\n\tradius: number;\n\tinnerRadius?: number;\n\tdurationMs?: number;\n\tstartAngle?: Angle;\n\tdirection?: 'clockwise' | 'counter-clockwise';\n\twipePercentage?: number;\n};\n\n/**\n * Renders a SVG mask that creates a radial wipe animation effect.\n *\n * @param {RadialWipeAnimationProps} props - Component props\n * @return {JSX.Element} The rendered mask component\n */\nfunction RadialWipeAnimation( {\n\tid,\n\tradius,\n\tinnerRadius = 0,\n\tdurationMs = 1000,\n\twipePercentage = 100,\n\tdirection = 'clockwise',\n\tstartAngle = '-90deg',\n}: RadialWipeAnimationProps ) {\n\tconst strokeWidth =\n\t\t( radius - innerRadius ) * 2 + // The stroke is centered on the circumference, so we need to double the width.\n\t\t1; // Added 1 to prevent sub-pixel rendering issues.\n\n\tconst scaleY = direction === 'clockwise' ? -1 : 1;\n\n\tconst isValidWipePercentage = 0 < wipePercentage && wipePercentage <= 100;\n\tconst animationDuration = `${\n\t\t// If wipePercentage is invalid, set animation duration to 0 to disable animation.\n\t\tisValidWipePercentage ? durationMs * ( 100 / wipePercentage ) : 0\n\t}ms`;\n\n\treturn (\n\t\t<mask id={ id }>\n\t\t\t<circle\n\t\t\t\tcx={ 0 }\n\t\t\t\tcy={ 0 }\n\t\t\t\tr={ radius }\n\t\t\t\tpathLength=\"100\"\n\t\t\t\tfill=\"white\"\n\t\t\t\tstroke=\"black\" // The stroke will be un-drawn, hence 'black' mask.\n\t\t\t\tstrokeWidth={ strokeWidth }\n\t\t\t\tstrokeDasharray=\"100, 1000\"\n\t\t\t\tstrokeDashoffset=\"0\"\n\t\t\t\tstyle={ { transform: `rotate(${ startAngle }) scaleY(${ scaleY })` } }\n\t\t\t>\n\t\t\t\t<animate\n\t\t\t\t\tattributeName=\"stroke-dashoffset\"\n\t\t\t\t\tfrom=\"0\"\n\t\t\t\t\tto=\"100.1\"\n\t\t\t\t\tdur={ animationDuration }\n\t\t\t\t\tfill=\"freeze\" // Same as CSS 'forwards' to retain the final state after animation.\n\t\t\t\t\tcalcMode=\"spline\" // custom easing\n\t\t\t\t\tkeySplines=\"0.42 0 0.58 1;0 0 1 1\" // ease-in-out ; linear (unimportant)\n\t\t\t\t\tkeyTimes={ `0;${ wipePercentage / 100 };1` }\n\t\t\t\t/>\n\t\t\t</circle>\n\t\t</mask>\n\t);\n}\n\nexport default RadialWipeAnimation;\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseInteractiveLegendData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tuseGlobalChartsTheme,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents, resolveFontSize } from '../../utils';\nimport { getStringWidth } from '../../visx/text';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation/';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive, ResponsiveConfig } from '../private/with-responsive';\nimport styles from './pie-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { SVGProps, MouseEvent, ReactNode, FC } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for pie charts.\n */\nexport type PieChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieTooltip = ( { tooltipData }: PieChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nexport interface PieChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Inner radius in pixels. If > 0, creates a donut chart. Defaults to 0.\n\t */\n\tinnerRadius?: number;\n\n\t/**\n\t * Add padding to the chart\n\t */\n\tpadding?: number;\n\n\t/**\n\t * Thickness of the pie chart.\n\t * A value between 0 and 1, where 0 means no thickness\n\t * and 1 means the maximum thickness.\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Scale of the gap between groups in the pie chart\n\t * A value between 0 and 1, where 0 means no gap.\n\t */\n\tgapScale?: number;\n\n\t/**\n\t * Scale of the corner radius for the pie chart segments.\n\t * A value between 0 and 1, where 0 means no corner radius.\n\t */\n\tcornerScale?: number;\n\n\t/**\n\t * Whether to show labels on pie segments. Defaults to true.\n\t */\n\tshowLabels?: boolean;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieChartBaseProps = Optional< PieChartProps, 'size' >;\n\n// Composition API types\ntype PieChartComponent = ChartComponentWithComposition< PieChartBaseProps >;\ntype PieChartResponsiveComponent = ChartComponentWithComposition<\n\tPieChartBaseProps & ResponsiveConfig\n>;\n\n/**\n * Validates the pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\n/**\n * Renders a pie or donut chart using the provided data.\n *\n * @param {PieChartProps} props - Component props\n * @return {JSX.Element} The rendered chart component\n */\nconst PieChartInternal = ( {\n\tdata,\n\tchartId: providedChartId,\n\twithTooltips = false,\n\tclassName,\n\tshowLegend = false,\n\tlegend = {},\n\twidth: propWidth,\n\theight: propHeight,\n\tsize,\n\tanimation,\n\tthickness = 1,\n\tpadding = 0,\n\tgapScale = 0,\n\tcornerScale = 0,\n\tshowLabels = true,\n\tlegendValueDisplay = 'percentage',\n\tchildren = null,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieTooltip,\n\tgap = 'md',\n}: PieChartProps ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst providerTheme = useGlobalChartsTheme();\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst onMouseLeave = useCallback( () => {\n\t\tif ( ! withTooltips ) {\n\t\t\treturn;\n\t\t}\n\t\thideTooltip();\n\t}, [ withTooltips, hideTooltip ] );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data for interactive legends\n\tconst { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tlegendInteractive,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\tconst { isValid, message } = validateData( data );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tgapScale,\n\t\t\tcornerScale,\n\t\t} ),\n\t\t[ thickness, gapScale, cornerScale ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tif ( ! isValid ) {\n\t\treturn (\n\t\t\t<div className={ clsx( 'pie-chart', styles[ 'pie-chart' ], className ) }>\n\t\t\t\t<div className={ styles[ 'error-message' ] }>{ message }</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Calculate the angle between each (use original data length for consistent spacing)\n\tconst padAngle = gapScale * ( ( 2 * Math.PI ) / data.length );\n\n\t// Map the data to include index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\tconst accessors = {\n\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) => {\n\t\t\treturn getElementStyles( { data: d, index: d.index } ).color;\n\t\t},\n\t};\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-chart',\n\t\t\t\t\tstyles[ 'pie-chart' ],\n\t\t\t\t\t// Fill parent when no explicit dimensions provided\n\t\t\t\t\t{ [ styles[ 'pie-chart--responsive' ] ]: ! propWidth && ! propHeight },\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div role=\"tooltip\">{ renderTooltip( { tooltipData } ) }</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : 300;\n\t\t\t\t\tconst availableHeight = contentHeight > 0 ? contentHeight : 300;\n\t\t\t\t\tconst availableSize = Math.min( availableWidth, availableHeight );\n\t\t\t\t\tconst actualSize = size ? Math.min( size, availableSize ) : availableSize;\n\n\t\t\t\t\tconst width = actualSize;\n\t\t\t\t\tconst height = actualSize;\n\n\t\t\t\t\tconst radius = Math.min( width, height ) / 2;\n\t\t\t\t\tconst centerX = width / 2;\n\t\t\t\t\tconst centerY = height / 2;\n\n\t\t\t\t\tconst outerRadius = radius - padding;\n\t\t\t\t\tconst innerRadius = thickness === 0 ? 0 : outerRadius * ( 1 - thickness );\n\n\t\t\t\t\tconst maxCornerRadius = ( outerRadius - innerRadius ) / 2;\n\t\t\t\t\tconst cornerRadius = cornerScale\n\t\t\t\t\t\t? Math.min( cornerScale * outerRadius, maxCornerRadius )\n\t\t\t\t\t\t: 0;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ centerY }\n\t\t\t\t\t\t\t\t\tleft={ centerX }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ 0 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\touterRadius={ outerRadius }\n\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\tpadAngle={ padAngle }\n\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ cornerRadius }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( ( arc, index ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst [ centroidX, centroidY ] = pie.path.centroid( arc );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst hasSpaceForLabel = arc.endAngle - arc.startAngle >= 0.25;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst handleMouseMove = ( event: MouseEvent< SVGElement > ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowTooltip( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipData: arc.data,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst pathProps: SVGProps< SVGPathElement > & {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid'?: string;\n\t\t\t\t\t\t\t\t\t\t\t\t\t} = {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\td: pie.path( arc ) || '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill: accessors.fill( arc.data ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-testid': 'pie-segment',\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst groupProps: SVGProps< SVGGElement > = {};\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( withTooltips ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseMove = handleMouseMove;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroupProps.onMouseLeave = onMouseLeave;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst svgLabelSmall = providerTheme.svgLabelSmall;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst fontSize = resolveFontSize( svgLabelSmall?.fontSize ) ?? 12;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst estimatedTextWidth = getStringWidth( arc.data.label, {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontFamily: svgLabelSmall?.fontFamily,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontWeight: svgLabelSmall?.fontWeight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelPadding = 6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundWidth = estimatedTextWidth + labelPadding * 2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tconst backgroundHeight = fontSize + labelPadding * 2;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g key={ `arc-${ index }` } { ...groupProps }>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path { ...pathProps } />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ showLabels && hasSpaceForLabel && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ providerTheme.labelBackgroundColor && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX - backgroundWidth / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY - backgroundHeight / 2 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth={ backgroundWidth }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theight={ backgroundHeight }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelBackgroundColor }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trx={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\try={ 4 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tx={ centroidX }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ty={ centroidY }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdy=\".33em\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ providerTheme.labelTextColor || '#333' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t</Pie>\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t{ /* Render SVG children (like Group, Text) inside the SVG */ }\n\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst PieChartWithProvider: FC< PieChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieChartWithProvider.displayName = 'PieChart';\n\n// Create PieChart with composition API\nconst PieChart = attachSubComponents( PieChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieChartComponent;\n\n// Create responsive PieChart with composition API\nconst PieChartResponsive = attachSubComponents(\n\twithResponsive< PieChartProps >( PieChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieChartResponsiveComponent;\n\nexport { PieChartResponsive as default, PieChart as PieChartUnresponsive };\n","import { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Text } from '@visx/text';\nimport { useTooltip, useTooltipInPortal } from '@visx/tooltip';\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { BaseTooltip } from '../../components/tooltip';\nimport {\n\tuseDataWithPercentages,\n\tuseInteractiveLegendData,\n\tusePrefersReducedMotion,\n} from '../../hooks';\nimport {\n\tGlobalChartsProvider,\n\tuseChartId,\n\tuseChartRegistration,\n\tuseGlobalChartsContext,\n\tGlobalChartsContext,\n} from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { Center } from '../private/center';\nimport { ChartSVG, ChartHTML, useChartChildren } from '../private/chart-composition';\nimport { ChartLayout } from '../private/chart-layout';\nimport { RadialWipeAnimation } from '../private/radial-wipe-animation';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { SvgEmptyState } from '../private/svg-empty-state';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './pie-semi-circle-chart.module.scss';\nimport type { LegendValueDisplay } from '../../components/legend';\nimport type {\n\tBaseChartProps,\n\tDataPointPercentage,\n\tDataPointPercentageCalculated,\n\tOptional,\n} from '../../types';\nimport type { ChartComponentWithComposition } from '../private/chart-composition';\nimport type { ResponsiveConfig } from '../private/with-responsive';\nimport type { PieProvidedProps } from '@visx/shape';\nimport type { FC, MouseEvent, ReactNode } from 'react';\n\n/**\n * Parameters passed to the renderTooltip function for semi-circle charts.\n */\nexport type PieSemiCircleChartRenderTooltipParams = {\n\t/**\n\t * The data point being hovered, including label, value, and calculated percentage.\n\t */\n\ttooltipData: DataPointPercentageCalculated;\n};\n\n/**\n * Default tooltip renderer for semi-circle pie charts.\n * Renders a BaseTooltip with the hovered segment's data.\n *\n * @param {PieSemiCircleChartRenderTooltipParams} params - The tooltip parameters containing the hovered data point\n * @return {ReactNode} The rendered tooltip content\n */\nconst renderDefaultPieSemiCircleTooltip = ( {\n\ttooltipData,\n}: PieSemiCircleChartRenderTooltipParams ): ReactNode => {\n\treturn <BaseTooltip data={ tooltipData } top={ 0 } left={ 0 } renderContainer={ false } />;\n};\n\nconst PAD_ANGLE = 0.03; // Padding between segments\nconst DEFAULT_WIDTH = 400;\n\nexport interface PieSemiCircleChartProps extends BaseChartProps< DataPointPercentage[] > {\n\t/**\n\t * Explicit width of the chart container in pixels.\n\t * When omitted, the chart fills its parent container's width.\n\t * The chart always maintains a 2:1 width-to-height ratio, constrained by available space.\n\t */\n\twidth?: number;\n\n\t/**\n\t * Thickness of the pie chart. A value between 0 and 1\n\t */\n\tthickness?: number;\n\n\t/**\n\t * Direction of chart rendering\n\t * true for clockwise, false for counter-clockwise\n\t */\n\tclockwise?: boolean;\n\n\t/**\n\t * Label text to display above the chart\n\t */\n\tlabel?: string;\n\n\t/**\n\t * Note text to display below the label\n\t */\n\tnote?: string;\n\n\t/**\n\t * Use the children prop to render additional elements on the chart.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * What type of value to display in the legend when showValues is true.\n\t * - 'percentage': Shows percentage values (e.g., \"23%\") [default]\n\t * - 'value': Shows raw numeric values (e.g., \"30000\")\n\t * - 'valueDisplay': Shows formatted values (e.g., \"30K\")\n\t * - 'none': Shows no values, only labels\n\t */\n\tlegendValueDisplay?: LegendValueDisplay;\n\n\t/**\n\t * Horizontal offset for tooltip positioning in pixels (default: 0)\n\t */\n\ttooltipOffsetX?: number;\n\n\t/**\n\t * Vertical offset for tooltip positioning in pixels (default: -15)\n\t */\n\ttooltipOffsetY?: number;\n\n\t/**\n\t * Custom render function for tooltip content.\n\t * When provided, replaces the default BaseTooltip with custom content.\n\t */\n\trenderTooltip?: ( params: PieSemiCircleChartRenderTooltipParams ) => ReactNode;\n}\n\n// Base props type with optional responsive properties\ntype PieSemiCircleChartBaseProps = Optional< PieSemiCircleChartProps, 'width' >;\n\n// Composition API types\ntype PieSemiCircleChartComponent = ChartComponentWithComposition< PieSemiCircleChartBaseProps >;\ntype PieSemiCircleChartResponsiveComponent = ChartComponentWithComposition<\n\tPieSemiCircleChartBaseProps & ResponsiveConfig\n>;\n\nexport type ArcData = PieProvidedProps< DataPointPercentageCalculated >[ 'arcs' ][ number ];\n\n/**\n * Validates the semi-circle pie chart data\n * @param data - The data to validate\n * @return Object containing validation result and error message\n */\nconst validateData = ( data: DataPointPercentage[] ) => {\n\tif ( ! data.length ) {\n\t\treturn { isValid: false, message: 'No data available' };\n\t}\n\n\t// Check for negative values\n\tconst hasNegativeValues = data.some( item => item.value < 0 );\n\tif ( hasNegativeValues ) {\n\t\treturn { isValid: false, message: 'Invalid data: Negative values are not allowed' };\n\t}\n\n\t// Validate total value is greater than 0\n\tconst totalValue = data.reduce( ( sum, item ) => sum + item.value, 0 );\n\tif ( totalValue <= 0 ) {\n\t\treturn { isValid: false, message: 'Invalid data: Total value must be greater than 0' };\n\t}\n\n\treturn { isValid: true, message: '' };\n};\n\nconst PieSemiCircleChartInternal: FC< PieSemiCircleChartProps > = ( {\n\tdata,\n\tchartId: providedChartId,\n\twidth: propWidth,\n\theight: propHeight,\n\tthickness = 0.4,\n\tclockwise = true,\n\twithTooltips = false,\n\tshowLegend = false,\n\tlegend = {},\n\tlegendValueDisplay = 'percentage',\n\tlabel,\n\tanimation,\n\tnote,\n\tclassName,\n\tchildren,\n\ttooltipOffsetX = 0,\n\ttooltipOffsetY = -15,\n\trenderTooltip = renderDefaultPieSemiCircleTooltip,\n\tgap = 'md',\n} ) => {\n\tconst legendInteractive = legend.interactive ?? false;\n\tconst legendPosition = legend.position ?? 'bottom';\n\n\tconst chartId = useChartId( providedChartId );\n\tconst { tooltipOpen, tooltipLeft, tooltipTop, tooltipData, hideTooltip, showTooltip } =\n\t\tuseTooltip< DataPointPercentageCalculated >();\n\n\t// Set up portal tooltip for better z-index handling\n\t// We get containerBounds to cancel out stale offsets in the position calculation\n\tconst { containerRef, TooltipInPortal, containerBounds } = useTooltipInPortal( {\n\t\tdetectBounds: true,\n\t\tscroll: true,\n\t\tdebounce: 0,\n\t} );\n\n\tconst handleMouseMove = useCallback(\n\t\t( event: MouseEvent< SVGElement >, arc: ArcData ) => {\n\t\t\t// Don't show tooltip until container bounds are measured\n\t\t\tif ( containerBounds.width === 0 || containerBounds.height === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Use clientX/Y and subtract containerBounds to cancel out any stale offset.\n\t\t\t// TooltipInPortal calculates: tooltipLeft + containerBounds.left + scrollX\n\t\t\t// By passing (clientX - containerBounds.left), we get:\n\t\t\t// (clientX - containerBounds.left) + containerBounds.left + scrollX = clientX + scrollX\n\t\t\t// This gives correct page coordinates regardless of stale bounds.\n\t\t\tshowTooltip( {\n\t\t\t\ttooltipData: arc.data,\n\t\t\t\ttooltipLeft: event.clientX - containerBounds.left + tooltipOffsetX,\n\t\t\t\ttooltipTop: event.clientY - containerBounds.top + tooltipOffsetY,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tcontainerBounds.width,\n\t\t\tcontainerBounds.height,\n\t\t\tcontainerBounds.left,\n\t\t\tcontainerBounds.top,\n\t\t\tshowTooltip,\n\t\t\ttooltipOffsetX,\n\t\t\ttooltipOffsetY,\n\t\t]\n\t);\n\n\tconst handleMouseLeave = useCallback( () => {\n\t\thideTooltip();\n\t}, [ hideTooltip ] );\n\n\tconst handleArcMouseMove = useCallback(\n\t\t( arc: ArcData ) => ( event: MouseEvent< SVGElement > ) => {\n\t\t\thandleMouseMove( event, arc );\n\t\t},\n\t\t[ handleMouseMove ]\n\t);\n\n\t// Validate data first to get validation result\n\tconst { isValid, message } = validateData( data );\n\n\tconst { getElementStyles, isSeriesVisible } = useGlobalChartsContext();\n\n\t// Calculate percentages from values (single source of truth)\n\tconst dataWithPercentages = useDataWithPercentages( data );\n\n\t// Filter and recalculate data for interactive legends\n\tconst { visibleData, allSegmentsHidden, legendData } = useInteractiveLegendData( {\n\t\tdata: dataWithPercentages,\n\t\tchartId,\n\t\tlegendInteractive,\n\t\tisSeriesVisible,\n\t} );\n\n\t// Define accessors with useMemo to avoid changing dependencies\n\tconst accessors = useMemo(\n\t\t() => ( {\n\t\t\tvalue: ( d: DataPointPercentageCalculated ) => d.value,\n\t\t\tsort: (\n\t\t\t\ta: DataPointPercentageCalculated & { index: number },\n\t\t\t\tb: DataPointPercentageCalculated & { index: number }\n\t\t\t) => b.value - a.value,\n\t\t\tfill: ( d: DataPointPercentageCalculated & { index: number } ) =>\n\t\t\t\tgetElementStyles( { data: d, index: d.index } ).color,\n\t\t} ),\n\t\t[ getElementStyles ]\n\t);\n\n\t// Memoize legend options to prevent unnecessary re-calculations\n\tconst legendOptions = useMemo(\n\t\t() => ( { showValues: true, legendValueDisplay } ),\n\t\t[ legendValueDisplay ]\n\t);\n\n\t// Create legend items using legendData (has recalculated percentages for visible items)\n\tconst legendItems = useChartLegendItems( legendData, legendOptions );\n\n\t// Process children to extract compound components\n\tconst { svgChildren, htmlChildren, legendChildren, otherChildren } = useChartChildren(\n\t\tchildren,\n\t\t'PieSemiCircleChart'\n\t);\n\n\t// Memoize metadata to prevent unnecessary re-registration\n\tconst chartMetadata = useMemo(\n\t\t() => ( {\n\t\t\tthickness,\n\t\t\tclockwise,\n\t\t} ),\n\t\t[ thickness, clockwise ]\n\t);\n\n\t// Register chart with context only if data is valid\n\tuseChartRegistration( {\n\t\tchartId,\n\t\tlegendItems,\n\t\tchartType: 'pie-semi-circle',\n\t\tisDataValid: isValid,\n\t\tmetadata: chartMetadata,\n\t} );\n\n\tconst prefersReducedMotion = usePrefersReducedMotion();\n\n\tconst effectiveWidth = propWidth || DEFAULT_WIDTH;\n\n\tif ( ! isValid ) {\n\t\tconst errorWidth = propHeight\n\t\t\t? Math.min( propWidth || propHeight * 2, propHeight * 2 )\n\t\t\t: effectiveWidth;\n\t\tconst errorHeight = errorWidth / 2;\n\n\t\treturn (\n\t\t\t<div className={ styles[ 'pie-semi-circle-chart' ] }>\n\t\t\t\t<svg width={ errorWidth } height={ errorHeight } data-testid=\"pie-chart-svg\">\n\t\t\t\t\t<text x=\"50%\" y=\"50%\" textAnchor=\"middle\" className={ styles.error }>\n\t\t\t\t\t\t{ message }\n\t\t\t\t\t</text>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Map data with index for color assignment\n\t// When interactive, we need to find the original index to maintain consistent colors\n\tconst dataWithIndex = visibleData.map( d => {\n\t\tconst originalIndex = data.findIndex( item => item.label === d.label );\n\t\treturn {\n\t\t\t...d,\n\t\t\tindex: originalIndex >= 0 ? originalIndex : 0,\n\t\t};\n\t} );\n\n\t// Configure pie angles based on clockwise direction\n\tconst startAngle = clockwise ? -Math.PI / 2 : Math.PI / 2;\n\tconst endAngle = clockwise ? Math.PI / 2 : -Math.PI / 2;\n\n\tconst legendElement = showLegend && (\n\t\t<Legend\n\t\t\torientation={ legend.orientation ?? 'horizontal' }\n\t\t\tposition={ legendPosition }\n\t\t\talignment={ legend.alignment ?? 'center' }\n\t\t\tlabelStyles={ legend.labelStyles }\n\t\t\titemClassName={ legend.itemClassName }\n\t\t\titemStyles={ legend.itemStyles }\n\t\t\tshapeStyles={ legend.shapeStyles }\n\t\t\tshape={ legend.shape ?? 'circle' }\n\t\t\tchartId={ chartId }\n\t\t\tinteractive={ legendInteractive }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<SingleChartContext.Provider value={ { chartId } }>\n\t\t\t<ChartLayout\n\t\t\t\tlegendPosition={ legendPosition }\n\t\t\t\tlegendElement={ legendElement }\n\t\t\t\tlegendChildren={ legendChildren }\n\t\t\t\tgap={ gap }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'pie-semi-circle-chart',\n\t\t\t\t\tstyles[ 'pie-semi-circle-chart' ],\n\t\t\t\t\t{\n\t\t\t\t\t\t[ styles[ 'pie-semi-circle-chart--responsive' ] ]: ! propWidth && ! propHeight,\n\t\t\t\t\t},\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: propWidth || undefined,\n\t\t\t\t\theight: propHeight || undefined,\n\t\t\t\t} }\n\t\t\t\tdata-testid=\"pie-chart-container\"\n\t\t\t\ttrailingContent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ withTooltips && tooltipOpen && tooltipData && (\n\t\t\t\t\t\t\t<TooltipInPortal top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>\n\t\t\t\t\t\t\t\t<div role=\"tooltip\">{ renderTooltip( { tooltipData } ) }</div>\n\t\t\t\t\t\t\t</TooltipInPortal>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ htmlChildren }\n\t\t\t\t\t\t{ otherChildren }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ ( { contentWidth, contentHeight } ) => {\n\t\t\t\t\t// Calculate chart dimensions maintaining the 2:1 width-to-height ratio.\n\t\t\t\t\t// Use measured dimensions to respect height constraints, falling back\n\t\t\t\t\t// to explicit props during initial render before measurement is available.\n\t\t\t\t\tconst availableWidth = contentWidth > 0 ? contentWidth : effectiveWidth;\n\t\t\t\t\tconst availableHeight =\n\t\t\t\t\t\tcontentHeight > 0 ? contentHeight : propHeight || effectiveWidth / 2;\n\t\t\t\t\t// Constrain width so that height (= width / 2) never exceeds the available height\n\t\t\t\t\tconst width = Math.min( availableWidth, availableHeight * 2 );\n\t\t\t\t\tconst height = width / 2;\n\t\t\t\t\tconst radius = height; // For a semi-circle, radius equals the SVG height\n\t\t\t\t\tconst innerRadius = radius * ( 1 - thickness );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Center ref={ containerRef }>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\t\t\tviewBox={ `0 0 ${ width } ${ height }` }\n\t\t\t\t\t\t\t\tdata-testid=\"pie-chart-svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t\t<RadialWipeAnimation\n\t\t\t\t\t\t\t\t\t\tid={ `radial-wipe-${ chartId }` }\n\t\t\t\t\t\t\t\t\t\tradius={ radius }\n\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\tstartAngle=\"-180deg\"\n\t\t\t\t\t\t\t\t\t\twipePercentage={ 50 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t\t\t{ /* Main chart group centered horizontally and positioned at bottom */ }\n\t\t\t\t\t\t\t\t<Group\n\t\t\t\t\t\t\t\t\ttop={ height }\n\t\t\t\t\t\t\t\t\tleft={ width / 2 }\n\t\t\t\t\t\t\t\t\tmask={\n\t\t\t\t\t\t\t\t\t\tanimation && ! prefersReducedMotion ? `url(#radial-wipe-${ chartId })` : null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ allSegmentsHidden ? (\n\t\t\t\t\t\t\t\t\t\t<SvgEmptyState x={ 0 } y={ -radius / 2 } width={ width } height={ height }>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'All segments are hidden. Click legend items to show data.',\n\t\t\t\t\t\t\t\t\t\t\t\t'jetpack-charts'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</SvgEmptyState>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ /* Pie chart */ }\n\t\t\t\t\t\t\t\t\t\t\t<Pie< DataPointPercentageCalculated & { index: number } >\n\t\t\t\t\t\t\t\t\t\t\t\tdata={ dataWithIndex }\n\t\t\t\t\t\t\t\t\t\t\t\tpieValue={ accessors.value }\n\t\t\t\t\t\t\t\t\t\t\t\touterRadius={ radius }\n\t\t\t\t\t\t\t\t\t\t\t\tinnerRadius={ innerRadius }\n\t\t\t\t\t\t\t\t\t\t\t\tcornerRadius={ 3 }\n\t\t\t\t\t\t\t\t\t\t\t\tpadAngle={ PAD_ANGLE }\n\t\t\t\t\t\t\t\t\t\t\t\tstartAngle={ startAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tendAngle={ endAngle }\n\t\t\t\t\t\t\t\t\t\t\t\tpieSort={ accessors.sort }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ pie => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn pie.arcs.map( arc => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<g\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ arc.data.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove={ withTooltips ? handleArcMouseMove( arc ) : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonMouseLeave={ withTooltips ? handleMouseLeave : undefined }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td={ pie.path( arc ) || '' }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill={ accessors.fill( arc.data ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"pie-segment\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t</Pie>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Label and note text */ }\n\t\t\t\t\t\t\t\t\t\t\t<Group>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -40 } // Position above the chart with space for note\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.label }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tverticalAnchor=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ty={ -20 } // Position between label and chart\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={ styles.note }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ note }\n\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t</Group>\n\n\t\t\t\t\t\t\t\t\t\t\t{ /* Render SVG children from composition API */ }\n\t\t\t\t\t\t\t\t\t\t\t{ ! allSegmentsHidden && svgChildren }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Group>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</Center>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</ChartLayout>\n\t\t</SingleChartContext.Provider>\n\t);\n};\n\nconst PieSemiCircleChartWithProvider: FC< PieSemiCircleChartProps > = props => {\n\tconst existingContext = useContext( GlobalChartsContext );\n\n\t// If we're already in a GlobalChartsProvider context, don't create a new one\n\tif ( existingContext ) {\n\t\treturn <PieSemiCircleChartInternal { ...props } />;\n\t}\n\n\t// Otherwise, create our own GlobalChartsProvider\n\treturn (\n\t\t<GlobalChartsProvider>\n\t\t\t<PieSemiCircleChartInternal { ...props } />\n\t\t</GlobalChartsProvider>\n\t);\n};\n\nPieSemiCircleChartWithProvider.displayName = 'PieSemiCircleChart';\n\n// Create PieSemiCircleChart with composition API\nconst PieSemiCircleChart = attachSubComponents( PieSemiCircleChartWithProvider, {\n\tLegend: Legend,\n\tSVG: ChartSVG,\n\tHTML: ChartHTML,\n} ) as PieSemiCircleChartComponent;\n\n// Create responsive PieSemiCircleChart with composition API\nconst PieSemiCircleChartResponsive = attachSubComponents(\n\twithResponsive< PieSemiCircleChartProps >( PieSemiCircleChartWithProvider ),\n\t{\n\t\tLegend: Legend,\n\t\tSVG: ChartSVG,\n\t\tHTML: ChartHTML,\n\t}\n) as PieSemiCircleChartResponsiveComponent;\n\nexport {\n\tPieSemiCircleChartResponsive as default,\n\tPieSemiCircleChart as PieSemiCircleChartUnresponsive,\n};\n","import clsx from 'clsx';\nimport { useMemo, forwardRef } from 'react';\nimport { useGlobalChartsTheme } from '../../providers';\nimport { LineChartUnresponsive } from '../line-chart';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './sparkline.module.scss';\nimport type { SparklineProps } from './types';\nimport type { SeriesData } from '../../types';\n\nconst DEFAULT_WIDTH = 100;\nconst DEFAULT_HEIGHT = 40;\n\n/**\n * Transforms a simple number array into SeriesData format for LineChart.\n * Uses index-based dates to create a linear x-axis.\n *\n * @param data - Array of numeric values to plot\n * @param color - Optional color for the line stroke\n * @param strokeWidth - Optional stroke width for the line\n * @return SeriesData array suitable for LineChart\n */\nconst transformToSeriesData = (\n\tdata: number[],\n\tcolor?: string,\n\tstrokeWidth?: number\n): SeriesData[] => {\n\t// Use a fixed base date and increment by index to create linear spacing\n\tconst baseDate = new Date( 2000, 0, 1 );\n\n\treturn [\n\t\t{\n\t\t\tlabel: 'sparkline',\n\t\t\tdata: data.map( ( value, index ) => ( {\n\t\t\t\tdate: new Date( baseDate.getTime() + index * 86400000 ), // Add days\n\t\t\t\tvalue,\n\t\t\t} ) ),\n\t\t\toptions: {\n\t\t\t\tstroke: color,\n\t\t\t\tseriesLineStyle: strokeWidth ? { strokeWidth } : undefined,\n\t\t\t},\n\t\t},\n\t];\n};\n\nconst SparklineComponent = forwardRef< HTMLDivElement, SparklineProps >(\n\t(\n\t\t{\n\t\t\tdata,\n\t\t\twidth = DEFAULT_WIDTH,\n\t\t\theight = DEFAULT_HEIGHT,\n\t\t\tcolor,\n\t\t\tstrokeWidth: strokeWidthProp,\n\t\t\twithGradientFill = true,\n\t\t\tgradient,\n\t\t\tclassName,\n\t\t\tchartId,\n\t\t\tmargin: marginProp,\n\t\t\tanimation,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst theme = useGlobalChartsTheme();\n\n\t\t// Get theme defaults for sparkline\n\t\tconst themeStrokeWidth = theme.sparkline?.strokeWidth ?? 1.5;\n\n\t\t// Use prop values or fall back to theme defaults\n\t\tconst strokeWidth = strokeWidthProp ?? themeStrokeWidth;\n\n\t\t// Transform number[] to SeriesData[] for LineChart\n\t\tconst seriesData = useMemo( () => {\n\t\t\tif ( ! data || data.length === 0 ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn transformToSeriesData( data, color, strokeWidth );\n\t\t}, [ data, color, strokeWidth ] );\n\n\t\t// Merge margins with theme defaults\n\t\tconst finalMargin = useMemo( () => {\n\t\t\tconst themeMargin = theme.sparkline?.margin ?? { top: 2, right: 2, bottom: 2, left: 2 };\n\t\t\tconst margin = marginProp ?? themeMargin;\n\t\t\treturn {\n\t\t\t\t...themeMargin,\n\t\t\t\t...margin,\n\t\t\t};\n\t\t}, [ marginProp, theme.sparkline?.margin ] );\n\n\t\t// Build gradient options for the series if custom gradient is provided\n\t\t// Note: This must be called before any early returns to follow React hooks rules\n\t\tconst seriesWithGradient = useMemo( () => {\n\t\t\tif ( ! gradient || seriesData.length === 0 ) {\n\t\t\t\treturn seriesData;\n\t\t\t}\n\n\t\t\treturn seriesData.map( series => ( {\n\t\t\t\t...series,\n\t\t\t\toptions: {\n\t\t\t\t\t...series.options,\n\t\t\t\t\tgradient: {\n\t\t\t\t\t\tfrom: gradient.from || color || '#000000',\n\t\t\t\t\t\tto: gradient.to || '#ffffff',\n\t\t\t\t\t\tfromOpacity: gradient.fromOpacity ?? 0.5,\n\t\t\t\t\t\ttoOpacity: gradient.toOpacity ?? 0.0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} ) );\n\t\t}, [ seriesData, gradient, color ] );\n\n\t\t// Handle empty data\n\t\tif ( ! data || data.length === 0 ) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--empty' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-empty\"\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Handle single data point - render a simple dot\n\t\tif ( data.length === 1 ) {\n\t\t\tconst cx = width / 2;\n\t\t\tconst cy = height / 2;\n\t\t\tconst resolvedColor = color || '#000000';\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'sparkline',\n\t\t\t\t\t\tstyles.sparkline,\n\t\t\t\t\t\tstyles[ 'sparkline--single-point' ],\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { width, height } }\n\t\t\t\t\tdata-testid=\"sparkline-single-point\"\n\t\t\t\t>\n\t\t\t\t\t<svg width={ width } height={ height } aria-hidden=\"true\">\n\t\t\t\t\t\t<circle cx={ cx } cy={ cy } r={ strokeWidth * 1.5 } fill={ resolvedColor } />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'sparkline', styles.sparkline, className ) }\n\t\t\t\tdata-testid=\"sparkline\"\n\t\t\t>\n\t\t\t\t<LineChartUnresponsive\n\t\t\t\t\tdata={ seriesWithGradient }\n\t\t\t\t\twidth={ width }\n\t\t\t\t\theight={ height }\n\t\t\t\t\tmargin={ finalMargin }\n\t\t\t\t\tchartId={ chartId }\n\t\t\t\t\twithGradientFill={ withGradientFill }\n\t\t\t\t\twithTooltips={ false }\n\t\t\t\t\tshowLegend={ false }\n\t\t\t\t\tgridVisibility=\"none\"\n\t\t\t\t\toptions={ {\n\t\t\t\t\t\taxis: {\n\t\t\t\t\t\t\tx: { display: false },\n\t\t\t\t\t\t\ty: { display: false },\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tcurveType=\"monotone\"\n\t\t\t\t\tanimation={ animation }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nSparklineComponent.displayName = 'SparklineComponent';\n\n/**\n * Sparkline - A minimal line chart for inline data visualization.\n *\n * Sparklines are compact charts designed to be embedded inline with text or\n * displayed in small spaces like table cells or dashboards. They show trends\n * without axes, labels, or other chart chrome.\n *\n * This component is built on top of LineChart with preconfigured settings\n * for minimal display (no axes, grid, tooltips, or legend).\n */\nconst SparklineUnresponsive = SparklineComponent;\n\nSparklineUnresponsive.displayName = 'SparklineUnresponsive';\n\n/**\n * Responsive Sparkline chart component\n */\nconst Sparkline = withResponsive< SparklineProps >( SparklineUnresponsive );\n\nexport { Sparkline as default, SparklineUnresponsive };\n","import clsx from 'clsx';\nimport styles from './trend-indicator.module.scss';\nimport type { TrendIndicatorProps, TrendDirection } from './types';\n\nconst DIRECTION_LABELS: Record< TrendDirection, string > = {\n\tup: 'Increase',\n\tdown: 'Decrease',\n\tneutral: 'No change',\n};\n\nconst Icon = ( { direction }: { direction: TrendDirection } ) => {\n\tif ( direction === 'neutral' ) {\n\t\treturn null;\n\t}\n\n\tconst isUp = direction === 'up';\n\treturn (\n\t\t<svg\n\t\t\tclassName={ styles[ 'trend-indicator__icon' ] }\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\tfill=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path\n\t\t\t\td={ isUp ? 'M8 13V3M4 7l4-4 4 4' : 'M8 3v10M4 9l4 4 4-4' }\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t);\n};\n\n/**\n * TrendIndicator displays a directional trend with a value.\n * Used to show percentage changes or growth metrics.\n *\n * @param {TrendIndicatorProps} props - Component props\n * @return {JSX.Element} The rendered trend indicator\n */\nexport function TrendIndicator( {\n\tdirection,\n\tvalue,\n\tclassName,\n\tstyle,\n\tshowIcon = true,\n}: TrendIndicatorProps ) {\n\tconst ariaLabel = `${ DIRECTION_LABELS[ direction ] }: ${ value }`;\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'trend-indicator' ],\n\t\t\t\tstyles[ `trend-indicator--${ direction }` ],\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t\taria-label={ ariaLabel }\n\t\t>\n\t\t\t{ showIcon && <Icon direction={ direction } /> }\n\t\t\t<span className={ styles[ 'trend-indicator__value' ] }>{ value }</span>\n\t\t</span>\n\t);\n}\n"],"x_google_ignoreList":[18,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,88,89,90,91,92,93,94,95,96,97,98,99,100,101,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