semiotic 3.4.0 → 3.4.1

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 (187) hide show
  1. package/CLAUDE.md +16 -3
  2. package/ai/schema.json +42 -1
  3. package/ai/system-prompt.md +4 -0
  4. package/dist/components/Annotation.d.ts +42 -2
  5. package/dist/components/CategoryColors.d.ts +1 -1
  6. package/dist/components/ChartGrid.d.ts +1 -1
  7. package/dist/components/ContextLayout.d.ts +1 -1
  8. package/dist/components/DataSummaryContext.d.ts +1 -1
  9. package/dist/components/DetailsPanel.d.ts +3 -2
  10. package/dist/components/Legend.d.ts +2 -3
  11. package/dist/components/LinkedCharts.d.ts +1 -1
  12. package/dist/components/ThemeProvider.d.ts +1 -1
  13. package/dist/components/Tooltip/FlippingTooltip.d.ts +1 -1
  14. package/dist/components/Tooltip/Tooltip.d.ts +4 -3
  15. package/dist/components/charts/geo/ChoroplethMap.d.ts +4 -4
  16. package/dist/components/charts/geo/DistanceCartogram.d.ts +5 -4
  17. package/dist/components/charts/geo/FlowMap.d.ts +4 -4
  18. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +4 -3
  19. package/dist/components/charts/index.d.ts +2 -0
  20. package/dist/components/charts/network/ChordDiagram.d.ts +4 -3
  21. package/dist/components/charts/network/CirclePack.d.ts +3 -3
  22. package/dist/components/charts/network/ForceDirectedGraph.d.ts +3 -2
  23. package/dist/components/charts/network/OrbitDiagram.d.ts +6 -5
  24. package/dist/components/charts/network/SankeyDiagram.d.ts +4 -3
  25. package/dist/components/charts/network/TreeDiagram.d.ts +3 -3
  26. package/dist/components/charts/network/Treemap.d.ts +3 -3
  27. package/dist/components/charts/ordinal/BarChart.d.ts +24 -4
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +4 -3
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +4 -3
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +4 -3
  31. package/dist/components/charts/ordinal/FunnelChart.d.ts +4 -3
  32. package/dist/components/charts/ordinal/GaugeChart.d.ts +2 -1
  33. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -3
  34. package/dist/components/charts/ordinal/Histogram.d.ts +4 -3
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +4 -3
  36. package/dist/components/charts/ordinal/PieChart.d.ts +4 -3
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +4 -3
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +4 -3
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -3
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +4 -3
  42. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +7 -6
  43. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  44. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -6
  45. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -6
  46. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -6
  47. package/dist/components/charts/shared/ChartError.d.ts +1 -2
  48. package/dist/components/charts/shared/annotationResolvers.d.ts +4 -3
  49. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  50. package/dist/components/charts/shared/colorUtils.d.ts +4 -3
  51. package/dist/components/charts/shared/datumTypes.d.ts +20 -0
  52. package/dist/components/charts/shared/diagnoseConfig.d.ts +2 -7
  53. package/dist/components/charts/shared/formatUtils.d.ts +4 -2
  54. package/dist/components/charts/shared/hooks.d.ts +27 -23
  55. package/dist/components/charts/shared/legendUtils.d.ts +3 -2
  56. package/dist/components/charts/shared/mergeShapeStyle.d.ts +43 -0
  57. package/dist/components/charts/shared/networkUtils.d.ts +7 -6
  58. package/dist/components/charts/shared/selectionUtils.d.ts +5 -4
  59. package/dist/components/charts/shared/statisticalOverlays.d.ts +14 -26
  60. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +2 -2
  61. package/dist/components/charts/shared/statsTooltip.d.ts +3 -2
  62. package/dist/components/charts/shared/tooltipUtils.d.ts +7 -6
  63. package/dist/components/charts/shared/types.d.ts +22 -13
  64. package/dist/components/charts/shared/useChartSetup.d.ts +7 -6
  65. package/dist/components/charts/shared/useLikertAggregation.d.ts +18 -7
  66. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +3 -2
  67. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -1
  68. package/dist/components/charts/shared/validateChartData.d.ts +2 -1
  69. package/dist/components/charts/shared/validateProps.d.ts +2 -8
  70. package/dist/components/charts/shared/withChartWrapper.d.ts +1 -1
  71. package/dist/components/charts/xy/AreaChart.d.ts +4 -3
  72. package/dist/components/charts/xy/BubbleChart.d.ts +4 -3
  73. package/dist/components/charts/xy/CandlestickChart.d.ts +47 -0
  74. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -3
  75. package/dist/components/charts/xy/Heatmap.d.ts +12 -7
  76. package/dist/components/charts/xy/LineChart.d.ts +4 -3
  77. package/dist/components/charts/xy/MinimapChart.d.ts +4 -4
  78. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +5 -4
  79. package/dist/components/charts/xy/QuadrantChart.d.ts +4 -3
  80. package/dist/components/charts/xy/Scatterplot.d.ts +4 -3
  81. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +3 -3
  82. package/dist/components/charts/xy/StackedAreaChart.d.ts +4 -3
  83. package/dist/components/data/transforms.d.ts +8 -7
  84. package/dist/components/export/chartConfig.d.ts +4 -3
  85. package/dist/components/geo/mergeData.d.ts +2 -1
  86. package/dist/components/realtime/BinAccumulator.d.ts +3 -2
  87. package/dist/components/realtime/renderers/types.d.ts +2 -1
  88. package/dist/components/realtime/renderers/waterfallRenderer.d.ts +2 -1
  89. package/dist/components/realtime/types.d.ts +20 -16
  90. package/dist/components/semiotic-themes.d.ts +2 -1
  91. package/dist/components/semiotic-xy.d.ts +2 -0
  92. package/dist/components/semiotic.d.ts +3 -3
  93. package/dist/components/server/animatedGif.d.ts +4 -18
  94. package/dist/components/server/renderToStaticSVG.d.ts +5 -4
  95. package/dist/components/server/serverChartConfigs.d.ts +2 -10
  96. package/dist/components/server/staticAnnotations.d.ts +2 -1
  97. package/dist/components/server/staticLegend.d.ts +2 -1
  98. package/dist/components/store/ObservationStore.d.ts +4 -3
  99. package/dist/components/store/SelectionStore.d.ts +3 -8
  100. package/dist/components/store/ThemeStore.d.ts +32 -4
  101. package/dist/components/store/TooltipStore.d.ts +1 -1
  102. package/dist/components/store/useSelection.d.ts +6 -5
  103. package/dist/components/stream/AccessibleDataTable.d.ts +5 -5
  104. package/dist/components/stream/CanvasHitTester.d.ts +2 -1
  105. package/dist/components/stream/DataSourceAdapter.d.ts +2 -1
  106. package/dist/components/stream/FocusRing.d.ts +1 -2
  107. package/dist/components/stream/GeoParticlePool.d.ts +2 -1
  108. package/dist/components/stream/GeoPipelineStore.d.ts +7 -6
  109. package/dist/components/stream/MarginalGraphics.d.ts +1 -2
  110. package/dist/components/stream/NetworkPipelineStore.d.ts +3 -2
  111. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -4
  112. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -19
  113. package/dist/components/stream/OrdinalPipelineStore.d.ts +6 -5
  114. package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -5
  115. package/dist/components/stream/PipelineStore.d.ts +63 -28
  116. package/dist/components/stream/SVGOverlay.d.ts +10 -10
  117. package/dist/components/stream/SceneGraph.d.ts +6 -5
  118. package/dist/components/stream/StreamGeoFrame.d.ts +2 -1
  119. package/dist/components/stream/StreamNetworkFrame.d.ts +2 -1
  120. package/dist/components/stream/StreamOrdinalFrame.d.ts +2 -1
  121. package/dist/components/stream/StreamXYFrame.d.ts +2 -1
  122. package/dist/components/stream/XYBrushOverlay.d.ts +1 -21
  123. package/dist/components/stream/devDataAccessWarning.d.ts +2 -11
  124. package/dist/components/stream/geoTypes.d.ts +25 -18
  125. package/dist/components/stream/hoverUtils.d.ts +2 -1
  126. package/dist/components/stream/layouts/hierarchySceneBuilders.d.ts +4 -3
  127. package/dist/components/stream/layouts/hierarchyUtils.d.ts +4 -3
  128. package/dist/components/stream/networkTypes.d.ts +33 -28
  129. package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +1 -1
  130. package/dist/components/stream/ordinalSceneBuilders/barScene.d.ts +2 -2
  131. package/dist/components/stream/ordinalSceneBuilders/connectorScene.d.ts +1 -1
  132. package/dist/components/stream/ordinalSceneBuilders/pointScene.d.ts +2 -2
  133. package/dist/components/stream/ordinalSceneBuilders/statisticalScene.d.ts +4 -4
  134. package/dist/components/stream/ordinalSceneBuilders/swimlaneScene.d.ts +1 -1
  135. package/dist/components/stream/ordinalSceneBuilders/timelineScene.d.ts +1 -1
  136. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +9 -8
  137. package/dist/components/stream/ordinalTypes.d.ts +54 -22
  138. package/dist/components/stream/pipelineDecay.d.ts +2 -1
  139. package/dist/components/stream/pipelinePulse.d.ts +2 -1
  140. package/dist/components/stream/pipelineTransitions.d.ts +16 -4
  141. package/dist/components/stream/renderers/colorUtils.d.ts +20 -0
  142. package/dist/components/stream/types.d.ts +45 -8
  143. package/dist/components/stream/xySceneBuilders/areaScene.d.ts +3 -2
  144. package/dist/components/stream/xySceneBuilders/barScene.d.ts +2 -1
  145. package/dist/components/stream/xySceneBuilders/boundsScene.d.ts +2 -1
  146. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +2 -1
  147. package/dist/components/stream/xySceneBuilders/emitPointNodes.d.ts +3 -2
  148. package/dist/components/stream/xySceneBuilders/heatmapScene.d.ts +2 -1
  149. package/dist/components/stream/xySceneBuilders/lineScene.d.ts +2 -1
  150. package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +2 -1
  151. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -1
  152. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +2 -1
  153. package/dist/components/stream/xySceneBuilders/types.d.ts +35 -26
  154. package/dist/components/stream/xySceneBuilders/waterfallScene.d.ts +2 -1
  155. package/dist/components/types/marginType.d.ts +15 -0
  156. package/dist/geo.min.js +1 -1
  157. package/dist/geo.module.min.js +1 -1
  158. package/dist/network.min.js +1 -1
  159. package/dist/network.module.min.js +1 -1
  160. package/dist/ordinal.min.js +1 -1
  161. package/dist/ordinal.module.min.js +1 -1
  162. package/dist/realtime.min.js +1 -1
  163. package/dist/realtime.module.min.js +1 -1
  164. package/dist/semiotic-ai.min.js +1 -1
  165. package/dist/semiotic-ai.module.min.js +1 -1
  166. package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +1 -0
  167. package/dist/semiotic-themes.d.ts +2 -1
  168. package/dist/semiotic-themes.min.js +1 -1
  169. package/dist/semiotic-themes.module.min.js +1 -1
  170. package/dist/semiotic-utils.min.js +1 -1
  171. package/dist/semiotic-utils.module.min.js +1 -1
  172. package/dist/semiotic-xy.d.ts +2 -0
  173. package/dist/semiotic.d.ts +3 -3
  174. package/dist/semiotic.min.js +1 -1
  175. package/dist/semiotic.module.min.js +1 -1
  176. package/dist/server.min.js +1 -1
  177. package/dist/server.module.min.js +1 -1
  178. package/dist/test-utils/canvasMock.d.ts +10 -2
  179. package/dist/xy.min.js +1 -1
  180. package/dist/xy.module.min.js +1 -1
  181. package/package.json +38 -31
  182. package/dist/components/types/annotationTypes.d.ts +0 -145
  183. package/dist/components/types/generalTypes.d.ts +0 -241
  184. package/dist/components/types/interactionTypes.d.ts +0 -72
  185. package/dist/components/types/networkTypes.d.ts +0 -174
  186. package/dist/components/types/ordinalTypes.d.ts +0 -112
  187. package/dist/semiotic-statisticalOverlays-DGX_WWc5.js +0 -1
@@ -1 +1 @@
1
- import*as e from"react";import{useEffect as t,useMemo as n,useRef as o,createContext as r,useContext as i,useCallback as s,useSyncExternalStore as a,useState as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleLinear as g,scaleBand as p}from"d3-scale";import{quadtree as y}from"d3-quadtree";import{schemeCategory10 as f,interpolatePlasma as m,interpolateViridis as v,interpolatePurples as b,interpolateOranges as x,interpolateGreens as w,interpolateReds as A,interpolateBlues as k,schemeSet3 as O,schemeTableau10 as j}from"d3-scale-chromatic";import{quantile as S}from"d3-array";import{packEnclose as _}from"d3-hierarchy";import{area as E,curveCatmullRom as C,curveCardinal as P,curveBasis as M,curveStepBefore as L,curveStepAfter as T,curveStep as B,curveMonotoneY as I,curveMonotoneX as H,curveLinear as R,arc as $}from"d3-shape";import D from"regression";import{select as N}from"d3-selection";import{brushX as F,brushY as z}from"d3-brush";class W{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class q{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class G{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function V(e,t,n){return e+(t-e)*n}function X(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Y(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const K={category10:f,tableau10:j,set3:O,blues:k,reds:A,greens:w,oranges:x,purples:b,viridis:v,plasma:m},U=f,Z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],J=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ee(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||J.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):U[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%U.length]}function te(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const i=K[n]||K.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:U;return h().domain(o).range(e).unknown("#999")}}function ne(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function oe(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function re(e){var t,n,o;const r=e.length,i=e[0],s=e[r-1];return{n:r,min:i,q1:null!==(t=S(e,.25))&&void 0!==t?t:i,median:null!==(n=S(e,.5))&&void 0!==n?n:(i+s)/2,q3:null!==(o=S(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/r}}const ie={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,getStack:a,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,p=i.normalize,y=[];if(a){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of y){const s=t.get(i);if(!s)continue;let u=s.total;p&&n>0&&(u/=n);const y=l(s.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(ne(e.x,t,e.width,Math.abs(n),y,f,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(ne(t,e.x,Math.abs(n),e.width,y,f,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),g=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ne(i,Math.min(a,d),o,Math.abs(a-d),g,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ne(Math.min(a,d),i,Math.abs(d-a),o,g,r,h[s]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:oe,donut:oe,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=a,p=[],y="vertical"===g,f=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=S(t,.25))&&void 0!==n?n:a,g=null!==(o=S(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=S(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,A=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,k=d(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=y?e.middle:h(n),r=y?h(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(A),stats:{n:t.length,min:w,q1:c,median:g,q3:m,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:k,datum:e.pieceData,category:e.name,outliers:O}),f)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:k.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;p>t;t++){const n=u(i+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(i+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=S(t,.25))&&void 0!==n?n:i,l=null!==(o=S(t,.5))&&void 0!==o?o:(i+s)/2,c=null!==(r=S(t,.75))&&void 0!==r?r:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:re(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,y=Math.max(...i,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(ne(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:re(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(ne(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(ne(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,s,a,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,p=[],y=t.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return p;const k=new Map;for(const e of v){const t=w[0].groups.get(e);k.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,j=x?.95*y:.9*t.width,S=g().domain([0,A]).range([0,j]),_=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let E=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,g=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=S(o.total))}let r=y,i=y;for(let a=0;v.length>a;a++){const l=v[a],c=t.groups.get(l);if(!c)continue;const m=S(c.total),b=a%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=h(c.pieces[0],l),A=null!==(s=k.get(l))&&void 0!==s?s:c.total,O=A>0?c.total/A*100:0,j=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:O,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});f&&(0===a&&(j.__funnelStepLabel=n.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.push(ne(x,d,m,u,w,j,l)),g.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,s=S(e),a=y-s/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),w=O>0?e/O*100:0,A=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=d,A.__funnelRowWidth=s,A.__funnelValueLabelX=y,A.__funnelValueLabelY=d,A.__funnelBarW=s),p.push(ne(a,d,s,u,x,A,b)),g.set(l,{x:a,y:d,w:s,h:u})}if(e>0&&E.size>0){const e=x?v:[v[0]];for(const o of e){const e=E.get(o),r=g.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),s={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:_},datum:null!==(l=null===(a=t.groups.get(o))||void 0===a?void 0:a.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};p.push(s)}}E=g}return p},"bar-funnel":function(e,t){var n,o,r,i;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),E=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(ne(O,j,u,S,_,E,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(ne(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(ne(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(ne(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class se{constructor(e){this.rExtent=new G,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new q(e.windowSize),this.getO=Q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new G)):(this.getR=Y(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Q(e.stackBy),this.getGroup=Q(e.groupBy),this.getColor=Q(e.colorAccessor),this.getConnector=Q(e.connectorAccessor),this.getDataId=Q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new q(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l="radial"===r,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let u,d;if(l){u=p().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=g().domain(s).range([o,n])}else a?(u=p().domain(i).range([0,e.height]).padding(c),d=g().domain(s).range([0,e.width])):(u=p().domain(i).range([0,e.width]).padding(c),d=g().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const s=this.rExtents[r];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?g().domain([l,c]).range([0,e.width]):g().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,i,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ie[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Z,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o];let l=r.get(a);l||(l=[],r.set(a,l)),l.push(i)}return this._categoryIndexCache={version:this._dataVersion,map:r},r}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,se.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=y().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let r=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=i-t;if(s>n){const e=1-n/s;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;s>r&&(n._pulseIntensity=1-r/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,r;this.prevPositionMap.clear();const i=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,i);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(r=t.style.opacity)&&void 0!==r?r:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,r;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(r=e.category)&&void 0!==r?r:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],r=this.getNodeKey(o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(r=d.w)&&void 0!==r?r:c.w,c.h=null!==(i=d.h)&&void 0!==i?i:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e})}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const i=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(i,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=V(r,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=V(o.x,e._targetX,s),e.y=V(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=V(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=V(r,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=V(n.x,e._targetX,s),e.y=V(n.y,e._targetY,s),void 0!==n.w&&(e.w=V(n.w,e._targetW,s),e.h=V(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:V(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=V(n.startAngle,e._targetStartAngle,s),e.endAngle=V(n.endAngle,e._targetEndAngle,s))}}}if(i>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!X(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!X(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!X(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(X(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,r=Array.isArray(n)?n:[n],i=Array.isArray(o)?o:[o];if(r.length!==i.length||r.some((e,t)=>!X(e,i[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new G)):(this.getR=Y(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!X(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Q(this.config.stackBy):void 0),"groupBy"in e&&!X(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Q(this.config.groupBy):void 0),"colorAccessor"in e&&!X(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!X(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Q(this.config.connectorAccessor):void 0)}}function ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function le(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ce(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function ue(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ae(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function de(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=le(Math.atan2(r,o)),a=le(e.startAngle),l=le(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function he(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ge(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function pe(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function ye(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}se.QUADTREE_THRESHOLD=500;const fe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function me(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,fe[n])(o(e,t)),r}function ve(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function xe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function we(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=me(t,u,d,h),b=be(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ve,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=me(t,u,h,g),w=be(t,r,i),A=i&&i.size>0&&i.has(t.label),k=26+7*t.label.length;d&&d>0&&f>0&&f+k>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?A||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,A&&e.createElement(ve,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=k});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const A=m+1;return{items:y,offset:x,totalRows:A,totalHeight:22*A}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},l),m)}function Ae(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function ke(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Oe(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:ke((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:Ae(s,c):[],f=i?u?[i]:Ae(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let w=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+f.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(A+2):18:"leftRight"===d&&(k="middle"===h?-(A+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(A+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),w)}(l,v,b,h))}function je(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Se(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function _e(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function Ee(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Se(e,n),c=_e(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ce(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Pe={linear:R,monotoneX:H,monotoneY:I,step:B,stepAfter:T,stepBefore:L,basis:M,cardinal:P,catmullRom:C};function Me(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Le)(e)})),[l,d,g,h]),f=u&&l&&!g,m=c&&l&&!g;return f||m?e.createElement("svg",{width:i,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&e.createElement("g",{className:"ordinal-grid"},y.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,p?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Le(e){return Math.round(100*e)/100+""}function Te(t){var r,i;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:p,rLabel:y,oFormat:f,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:S,annotations:C,svgAnnotationRules:P,xAccessor:M,yAccessor:L,annotationData:T,underlayRendered:B,children:I}=t,H="radial"===(null==d?void 0:d.projection),$="horizontal"===(null==d?void 0:d.projection),N=!1!==g,F=n(()=>h&&N&&d&&!H?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:f?f(e,t):e}}):[],[h,N,d,f,H]),z=t.rTickValues,W=t.tickLabelEdgeAlign,q=n(()=>h&&d&&!H?(z||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Le)(e)})):[],[h,d,m,H,z]),G=o(new Map),V=o(null!==(r=null==C?void 0:C.length)&&void 0!==r?r:0),X=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;V.current!==X&&(V.current=X,G.current=new Map);const Y=n(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,C,P,M,L,T,B,I,H,$,N,F,z,W,q,G,V,X,Y,Q,K,U,Z,J,ee,te;switch(t.type){case"label":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ce(i,s,o)?e.createElement(je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ce(i,s,o)?e.createElement(je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Se(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=_e(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Se(Object.assign(Object.assign({},e),{type:"point"}),o),y:_e(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=_(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Se(Object.assign(Object.assign({},e),{type:"point"}),o),y:_e(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Se(n,o),a=_e(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Se(t,o),i=_e(t,o);return e.createElement(je,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?D.polynomial(p,{order:t.order||2}):D.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Pe[o.curve||"linear"]||R,g=E().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(A=t.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(k=o.scales)||void 0===k?void 0:k.x)&&void 0!==O?O:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(C=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==C?C:null===(P=o.scales)||void 0===P?void 0:P.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(L=t.fillOpacity)&&void 0!==L?L:.1,m=t.anomalyColor||"#ef4444",v=null!==(T=t.anomalyRadius)&&void 0!==T?T:6,b=a(c+h*d),x=a(g),w=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((t,n)=>{const r=Se(t,o),i=_e(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=o.scales)||void 0===H?void 0:H.time,l=null!==(N=null===($=o.scales)||void 0===$?void 0:$.y)&&void 0!==N?N:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=D.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(z=t.confidence)&&void 0!==z?z:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const A=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${A.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),j=`${a(b)},${l(u(b))}`,S=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:k,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:a(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:S,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Ee(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ce(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(Q=t.width)&&void 0!==Q?Q:32,c=null!==(K=t.height)&&void 0!==K?K:32,u=null!==(U=t.content)&&void 0!==U?U:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(Z=o.scales)||void 0===Z?void 0:Z.o,s=null===(J=o.scales)||void 0===J?void 0:J.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n="horizontal"===(null==d?void 0:d.projection),o=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,r={scales:d?{x:n?d.r:o||d.r,y:n&&o||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:M,yAccessor:L,width:s,height:a,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:G.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,a,d,M,L,T]);return h||b||x||S||Y&&Y.length>0||v||I?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!H&&!B&&e.createElement("g",{className:"ordinal-grid"},q.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!H&&e.createElement("g",{className:"ordinal-axes"},$?e.createElement(e.Fragment,null,!B&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},p),!B&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!B&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&s-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,n)=>{const o=W?0===n?"start":n===q.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!B&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):a,n=0>t||t>a?a:t;return e.createElement("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!B&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},y))),Y,S,I),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(xe,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(we,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:j,title:b,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O})):null}function Be({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,onBrush:c}){const u=o(null),d=o(null),h=o(c);h.current=c;const g=o(l);g.current=l;const p=o(!1),y=o(null),f="horizontal"===(null==l?void 0:l.projection),m=o(f);return m.current=f,t(()=>{if(!u.current)return;const e=N(u.current).select(".brush-g"),t=f?F():z();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};y.current=i,h.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,f]),t(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=N(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),e.createElement("svg",{ref:u,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}}))}function Ie(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const He="undefined"==typeof window||"undefined"==typeof document,Re=e.createContext(null),$e={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function De(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Ne=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Fe={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},ze={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},We={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},qe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ge={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Ve={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Xe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ye({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(Re),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:$e}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:$e,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=_.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(t),f=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ne(e.min)} to ${Ne(e.max)}, mean ${Ne(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:Fe,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:We},"×"),e.createElement("div",{role:"note",style:ze},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:qe},e.createElement("caption",{style:Xe},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Ge},"type"),x.map(t=>e.createElement("th",{key:t,style:Ge},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:Ve},t.label),x.map(n=>{return e.createElement("td",{key:n,style:Ve},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ne(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Qe({summary:t}){return t?e.createElement("div",{role:"note",style:$e},t):null}function Ke({tableId:t}){return e.createElement("a",{href:"#"+t,style:$e,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,$e)}},"Skip to data table")}function Ue({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:$e},n)}const Ze="var(--semiotic-focus, #005fcc)";function Je({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ze,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function et({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function tt(t){const l=r(null),c=nt(t);return[function({children:o}){const r=n(()=>nt(t),[]);return e.createElement(l.Provider,{value:r,children:o})},e=>{var t;const n=null!==(t=i(l))&&void 0!==t?t:c,r=o(e);r.current=e;const u=s(()=>r.current(n.getState()),[n]),d=s(()=>r.current(n.getState()),[n]);return a(n.subscribe,u,d)}]}function nt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function ot(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:rt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],it={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},st={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},at={mode:"light",colors:{primary:"#0000cc",categorical:rt,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[lt,ct]=tt(e=>({theme:it,setTheme(t){e(e=>{if("light"===t)return{theme:it};if("dark"===t)return{theme:st};if("high-contrast"===t)return{theme:at};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?st:it;return{theme:ot(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:ot(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const ut=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,dt=new WeakMap;let ht=0,gt=!1,pt=null,yt=null,ft=null;function mt(e,t){var n,o;if(!t)return t;const r=ut.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(gt)return;if("undefined"==typeof window||"undefined"==typeof document)return;gt=!0;const e=()=>{ht++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(pt=new MutationObserver(e),pt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{yt=window.matchMedia("(prefers-color-scheme: dark)"),ft=e,"function"==typeof yt.addEventListener?yt.addEventListener("change",ft):"function"==typeof yt.addListener&&yt.addListener(ft)}catch(e){}}();let s=dt.get(i);s&&s.version===ht||(s={version:ht,map:new Map},dt.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function vt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function bt(r){const i=function(){const[e,n]=l(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),e}(),a=o(i);a.current=i;const[c,u]=function(e,n,r){const i=o(null),[s,a]=l(null);return t(()=>{if(!n&&!r)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,r]),[i,[n&&s?s.w:e[0],r&&s?s.h:e[1]]]}(r.sizeProp,r.responsiveWidth,r.responsiveHeight),d=n(()=>Object.assign(Object.assign({},r.marginDefault),r.userMargin),[r.marginDefault,r.userMargin]),h=u[0]-d.left-d.right,g=u[1]-d.top-d.bottom,p=vt(r.foregroundGraphics,u,d),y=vt(r.backgroundGraphics,u,d),f=ct(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(r.animate,r.transitionProp),b="semiotic-table-"+e.useId(),x=o(0),w=o(()=>{}),A=s(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);t(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=o(()=>{}),O=o(()=>{}),j=o(null),S=o(0),_=s(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),E=s(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),C=s(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);t(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=r.themeDirtyRef;return t(()=>{P&&(ht++,P.current=!0,A())},[f,A,P]),{reducedMotion:i,reducedMotionRef:a,responsiveRef:c,size:u,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:E,onPointerLeave:C}}function xt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wt(e,t,n=.3){xt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function At(e,t,n=.6){var o,r,i,s,a;if(!xt(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function kt(e,t,n,o=.35){xt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Ot=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)jt(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));wt(e,t),e.globalAlpha=1}};function jt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const St=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?mt(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),At(e,t),e.globalAlpha=1}}finally{e.restore()}}};function _t(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Et(e,t){const n=$().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Ct=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(i=t.style.opacity)&&void 0!==i?i:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Et(e,t)):(_t(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(_t(e,t),kt(e,t)),e.globalAlpha=1}};const Pt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Mt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=mt(e,n.style.stroke)||("string"==typeof n.style.fill?mt(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Lt(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Tt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Bt=null;function It(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Bt||(Bt=document.createElement("canvas")),Bt.width=e,Bt.height=e,Bt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Ht=new Map;function Rt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ht.get(n);if(void 0!==o)return o;const r=It({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ht.set(n,r),r}function $t(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Dt(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Nt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ft=e=>[Mt,...e],zt={bar:Ft([Ot]),clusterbar:Ft([Ot]),point:Ft([St]),swarm:Ft([St]),pie:[Ct],donut:[Ct],boxplot:Ft([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},St]),violin:Ft([Pt]),histogram:Ft([Ot]),ridgeline:Ft([Pt]),timeline:Ft([Ot]),funnel:[Ot,(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Lt(r):null!=i?`${Lt(r)} (${Tt(i)})`:Lt(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Lt(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ot,(e,t,n,o)=>{var r,i;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=Rt(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,s=i?Nt(r):"",a=Dt(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),$t(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),$t(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:Ft([Ot])},Wt={top:50,right:40,bottom:60,left:70},qt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Gt({hover:t}){var n,o,r,i,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:qt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:qt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:qt},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:qt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",y=null!==(a=null!==(s=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!p&&""===y){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:qt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:qt},p&&e.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&e.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const Vt=c(function(r,i){var a,c,d,h,g,p,y,f,m,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:A="category",rAccessor:k="value",colorAccessor:O,stackBy:j,groupBy:S,multiAxis:_,timeAccessor:E,valueAccessor:C,categoryAccessor:P,projection:M="vertical",size:L=[600,400],responsiveWidth:T,responsiveHeight:B,margin:I,barPadding:H,roundedTop:R,baselinePadding:D,innerRadius:N,cornerRadius:F,normalize:z,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:U,showLabels:Z,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,rExtent:ne,oExtent:oe,extentPadding:re=.05,oSort:ie,windowMode:le="sliding",windowSize:fe=200,pieceStyle:me,summaryStyle:ve,colorScheme:be,barColors:xe,showAxes:we=!0,showCategoryTicks:Ae,categoryLabel:ke,valueLabel:Oe,categoryFormat:je,valueFormat:Se,oLabel:_e,rLabel:Ee,oFormat:Ce,rFormat:Pe,rTickValues:Le,tickLabelEdgeAlign:Re,enableHover:$e=!0,hoverAnnotation:Ne,tooltipContent:Fe,customHoverBehavior:ze,annotations:We,svgAnnotationRules:qe,showGrid:Ge=!1,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,backgroundGraphics:rt,foregroundGraphics:it,title:st,className:at,background:lt,centerContent:ct,decay:ut,pulse:dt,transition:ht,animate:gt,staleness:pt,brush:yt,onBrush:ft,accessibleTable:mt=!0,description:vt,summary:xt}=r,wt=o(!0),At=bt({sizeProp:L,responsiveWidth:T,responsiveHeight:B,userMargin:I,marginDefault:Wt,foregroundGraphics:it,backgroundGraphics:rt,animate:gt,transitionProp:ht,themeDirtyRef:wt}),{reducedMotionRef:kt,responsiveRef:Ot,size:jt,margin:St,adjustedWidth:_t,adjustedHeight:Et,resolvedForeground:Ct,resolvedBackground:Pt,currentTheme:Mt,transition:Lt,introEnabled:Tt,tableId:Bt,rafRef:It,renderFnRef:Ht,scheduleRender:Rt}=At,$t=null!=ke?ke:_e,Dt=null!=Oe?Oe:Ee,Nt=null!=je?je:Ce,Ft=null!=Se?Se:Pe,qt=o(null),Vt=o(null),[Xt,Yt]=l(null),[Qt,Kt]=l(null),[Ut,Zt]=l(0),[Jt,en]=l(!1),tn=$e||Ne,nn="streaming"===x,on=n(()=>{var e;return{chartType:b,runtimeMode:nn?"streaming":"bounded",windowSize:fe,windowMode:le,extentPadding:re,projection:M,oAccessor:nn?void 0:A,rAccessor:nn?void 0:k,colorAccessor:O,stackBy:j,groupBy:S,multiAxis:_,timeAccessor:nn?E:void 0,valueAccessor:nn?C||("string"==typeof k||"function"==typeof k?k:void 0):void 0,categoryAccessor:nn?P||A:void 0,rExtent:ne,oExtent:oe,barPadding:H,roundedTop:R,baselinePadding:D,innerRadius:N,cornerRadius:F,normalize:z,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:U,showLabels:Z,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,oSort:ie,pieceStyle:me,summaryStyle:ve,colorScheme:be,themeCategorical:null===(e=null==Mt?void 0:Mt.colors)||void 0===e?void 0:e.categorical,barColors:xe,decay:ut,pulse:dt,transition:Lt,introAnimation:Tt,staleness:pt}},[b,fe,le,re,M,A,k,O,j,S,_,E,C,P,ne,oe,H,R,D,N,F,z,q,G,V,X,Y,Q,K,U,Z,J,ee,te,ie,me,ve,be,xe,ut,dt,null==Lt?void 0:Lt.duration,null==Lt?void 0:Lt.easing,Tt,pt,nn,Mt]),rn=o(null);rn.current||(rn.current=new se(on)),t(()=>{var e;null===(e=rn.current)||void 0===e||e.updateConfig(on),wt.current=!0,Rt()},[on,Rt]);const sn=o(null);sn.current||(sn.current=new W(e=>{const t=rn.current;t&&t.ingest(e)&&(wt.current=!0,Rt())}));const an=s(e=>{var t;null===(t=sn.current)||void 0===t||t.push(e)},[]),ln=s(e=>{var t;null===(t=sn.current)||void 0===t||t.pushMany(e)},[]),cn=s(()=>{var e,t;null===(e=sn.current)||void 0===e||e.clear(),null===(t=rn.current)||void 0===t||t.clear(),wt.current=!0,Rt()},[Rt]),un=s(e=>{var t,n;null===(t=sn.current)||void 0===t||t.clearLastData(),null===(n=sn.current)||void 0===n||n.setReplacementData(e)},[]);u(i,()=>({push:an,pushMany:ln,replace:un,remove:e=>{var t,n,o,r;null===(t=sn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=rn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=Vt.current)||void 0===r?void 0:r.data;!!Vt.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Vt.current=null,Yt(null)),wt.current=!0,Rt()}return i},update:(e,t)=>{var n,o,r;null===(n=sn.current)||void 0===n||n.flush();const i=null!==(r=null===(o=rn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(wt.current=!0,Rt()),i},clear:cn,getData:()=>{var e,t,n;return null===(e=sn.current)||void 0===e||e.flush(),null!==(n=null===(t=rn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=rn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[an,ln,un,cn,Rt]),t(()=>{var e;w&&(null===(e=sn.current)||void 0===e||e.setBoundedData(w))},[w]);const{hoverHandlerRef:dn,hoverLeaveRef:hn,onPointerMove:gn,onPointerLeave:pn}=At;dn.current=e=>{if(!tn)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-St.left,r=e.clientY-n.top-St.top;if(0>o||o>_t||0>r||r>Et)return void(Vt.current&&(Vt.current=null,Yt(null),ze&&ze(null),Rt()));const i=rn.current;if(!i||0===i.scene.length)return;const s="radial"===M,a=function(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,g)=>{if(r>a||s>h||i>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);ae(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":e=ce(i,t,n);break;case"point":if(r)break;e=ue(i,t,n,o);break;case"wedge":e=de(i,t,n);break;case"boxplot":e=he(i,t,n);break;case"violin":e=ge(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(i.scene,s?o-_t/2:o,s?r-Et/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!a)return void(Vt.current&&(Vt.current=null,Yt(null),ze&&ze(null),Rt()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Vt.current=l,Yt(l),ze&&(ze(l),wt.current=!0),Rt()},hn.current=()=>{Vt.current&&(Vt.current=null,Yt(null),ze&&(ze(null),wt.current=!0),Rt())};const yn=o(-1),fn=o(null),mn=o(null),vn=s(e=>{const t=rn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(mn.current&&mn.current.version===n)o=mn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),mn.current={version:n,graph:o}}const r=yn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yn.current=0;const t=o.flat[0];fn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ye(t)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});return Vt.current=n,Yt(n),ze&&ze(n),void Rt()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?pe(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?pe(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return yn.current=-1,fn.current=null,Vt.current=null,Yt(null),ze&&ze(null),void Rt();yn.current=s;const a=o.flat[s];fn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ye(a)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});Vt.current=l,Yt(l),ze&&ze(l),Rt()},[ze,Rt]),bn=s(e=>{yn.current=-1,fn.current=null,gn(e)},[gn]);Ht.current=()=>{var e,t;It.current=0;const n=qt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=rn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(kt.current?i+1e6:i),a=!kt.current&&s,l=wt.current;l&&!s&&(r.computeScene({width:_t,height:Et}),wt.current=!1),(l||a)&&n.setAttribute("aria-label",De(r.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=jt[0]*c,d=jt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=jt[0]+"px",n.style.height=jt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,jt[0],jt[1]);const h=null!==(e=null==pt?void 0:pt.threshold)&&void 0!==e?e:5e3,g=pt&&r.lastIngestTime>0&&i-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==lt&&!rt){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=lt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,jt[0],jt[1]))}const p="radial"===M;o.save(),o.beginPath(),o.rect(St.left,St.top,_t,Et),o.clip(),p?(o.save(),o.translate(St.left+_t/2,St.top+Et/2)):o.translate(St.left,St.top);const y=zt[b]||[],f={width:_t,height:Et};for(const e of y)e(o,r.scene,r.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Kt(r.scales),Zt(e=>e+1)),(null==pt?void 0:pt.showBadge)&&en(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(It.current=requestAnimationFrame(()=>Ht.current()))},t(()=>(Rt(),()=>{var e;null===(e=sn.current)||void 0===e||e.clear()}),[Rt]),t(()=>{wt.current=!0,Rt()},[b,_t,Et,we,lt,Rt]),function(e,n,o,r,i,s){t(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,i,r])}(pt,rn,wt,Rt,Jt,en);const xn=tn&&Xt?Fe?Fe(Xt):e.createElement(Gt,{hover:Xt}):null,wn="radial"===M,An=xn?e.createElement(et,{x:Xt?wn?Xt.x+_t/2:Xt.x:0,y:Xt?wn?Xt.y+Et/2:Xt.y:0,containerWidth:_t,containerHeight:Et,margin:St,className:"stream-ordinal-tooltip"},xn):null;if(He){const t=rn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:_t,height:Et}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===M,i=r?St.left+_t/2:St.left,s=r?St.top+Et/2:St.top;return e.createElement("div",{className:"stream-ordinal-frame"+(at?" "+at:""),role:"img","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:jt[0],height:jt[1]}},e.createElement(Qe,{summary:xt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:jt[0],height:jt[1],style:{position:"absolute",left:0,top:0}},Pt&&e.createElement("g",{transform:`translate(${St.left},${St.top})`},Pt),e.createElement("g",{transform:`translate(${i},${s})`},lt&&e.createElement("rect",{x:0,y:0,width:_t,height:Et,fill:lt}),n.map((t,n)=>function(t,n){var o,r,i,s,a;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:s}=n;let a;switch(n.roundedEdge){case"right":a=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o},${r+s} Z`;break;case"left":a=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+s-t} A${t},${t} 0 0 0 ${o+t},${r+s} L${o+i},${r+s} Z`;break;case"bottom":a=`M${o},${r} L${o+i},${r} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o+t},${r+s} A${t},${t} 0 0 1 ${o},${r+s-t} Z`;break;default:a=`M${o},${r+s} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s} Z`}return e.createElement("path",{key:u,d:a,fill:Ie(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:Ie(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:Ie(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=$().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:Ie(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Ie(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Ie(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Ie(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:Ie(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Te,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:o,showAxes:we,showCategoryTicks:Ae,oLabel:$t,rLabel:Dt,oFormat:Nt,rFormat:Ft,rTickValues:Le,tickLabelEdgeAlign:Re,showGrid:Ge,title:st,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,foregroundGraphics:Ct,annotations:We,svgAnnotationRules:qe,annotationFrame:0,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null==t?void 0:t.getData()}),ct&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:St.left+_t/2,top:St.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ct))}return e.createElement("div",{ref:Ot,className:"stream-ordinal-frame"+(at?" "+at:""),role:"group","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":jt[0],height:B?"100%":jt[1],overflow:"visible"},onKeyDown:vn},mt&&e.createElement(Ke,{tableId:Bt}),mt&&e.createElement(Ye,{scene:null!==(h=null===(d=rn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Bt,chartTitle:"string"==typeof st?st:void 0}),e.createElement(Qe,{summary:xt}),e.createElement("div",{role:"img","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:tn?bn:void 0,onMouseLeave:tn?pn:void 0},Pt&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:jt[0],height:jt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${St.left},${St.top})`},Pt)),e.createElement(Me,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,showAxes:we,showGrid:Ge,rFormat:Ft,rTickValues:Le}),e.createElement("canvas",{ref:qt,"aria-label":De(null!==(p=null===(g=rn.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:jt[0],height:jt[1]}}),e.createElement(Ue,{hoverPoint:Xt}),e.createElement(Te,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,showAxes:we,showCategoryTicks:Ae,oLabel:$t,rLabel:Dt,oFormat:Nt,rFormat:Ft,showGrid:Ge,title:st,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,foregroundGraphics:Ct,annotations:We,svgAnnotationRules:qe,annotationFrame:Ut,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null===(y=rn.current)||void 0===y?void 0:y.getData(),underlayRendered:!0}),(yt||ft)&&"radial"!==M&&e.createElement(Be,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,onBrush:ft||(()=>{})}),ct&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:St.left+_t/2,top:St.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ct),(null==pt?void 0:pt.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pt.badgePosition?{top:4,left:4}:"bottom-left"===pt.badgePosition?{bottom:4,left:4}:"bottom-right"===pt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Jt?"#dc3545":"#28a745",color:"white"})},Jt?"STALE":"LIVE"),e.createElement(Je,{active:yn.current>=0,hoverPoint:Xt,margin:St,size:jt,shape:null===(f=fn.current)||void 0===f?void 0:f.shape,width:null===(m=fn.current)||void 0===m?void 0:m.w,height:null===(v=fn.current)||void 0===v?void 0:v.h}),An))});Vt.displayName="StreamOrdinalFrame";const Xt=r(null);function Yt(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Qt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Kt,Ut]=tt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Qt(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Qt(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Zt,Jt]=tt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let en={positions:new Map};const tn=new Set;function nn(){for(const e of tn)e()}function on(e,t){const n=en.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(en.positions);o.delete(e),en={positions:o},nn()}function rn(e){const t=d(),o=e.clientId||t,{name:r}=e,i=Ut(e=>e.selections.get(r)),a=Ut(e=>e.setClause),l=Ut(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Yt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:c,selectPoints:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:s(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:s(()=>{l(r,o)},[l,r,o]),clientId:o}}const sn=r(!1);function an({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Z[i%Z.length];return{label:r+"",color:a}}),label:""}]}}function ln(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function cn(){var e;const t=ct(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function un(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=K[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}function dn(e,t,o){return n(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}e.createContext(void 0);const hn={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function gn(e,t,n){var o,r,i,s,a,l,c;const u=hn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:pn(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function pn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const yn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function fn(e,t){return"function"==typeof t?t(e):e[t]}function mn(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function vn(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=fn(t,o);a=mn(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=fn(t,o);l.push({label:n,value:mn(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=mn(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=mn(t[e[0]],r))}}const c=Object.assign(Object.assign({},yn),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function bn(t){if(!0===t)return vn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:yn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?vn(t):vn())}function xn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function wn(e,t){return"function"==typeof t?t(e):e[t]}function An({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1,valueFormat:s}){return a=>{var l;const c=i?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=wn(c,t),d=wn(c,n),h=o?wn(c,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},xn(u)),e.createElement("div",{style:{marginTop:4}},function(e,t){if(!t)return xn(e);try{const n=t(e);return null==n?xn(e):n}catch(t){return xn(e)}}(d,s)),null!=h&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||("string"==typeof(g=o)?g:"value"),": ",xn(h)));var g}}function kn({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class On extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(kn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function jn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Sn(e,t,n=3){let o,r=n+1;for(const n of t){const t=jn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function _n(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function En(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Sn(e,t,3))&&void 0!==n?n:null)}function Cn({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=_n(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=En(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Pn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Mn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ln={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Tn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Bn=["vertical","horizontal"],In={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Bn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Pn),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Pn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Bn},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Pn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Pn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Pn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Hn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Rn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),$n=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Dn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Nn=new Set(["LineChart","AreaChart","StackedAreaChart"]),Fn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function zn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Wn(e,t){const n=zn(e),o=zn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const qn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Gn(e,t){const n=[],o=function(e,t){const n=[],o=In[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(In).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Hn(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Sn(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=Cn({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=_n(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=En(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return In[e]?(function(e,t,n){const o=In[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=In[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Rn.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){$n.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=In[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Dn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!Nn.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=In[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Fn.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Wn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Wn(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of qn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var Vn;const Xn="undefined"!=typeof process&&"production"!==(null===(Vn=process.env)||void 0===Vn?void 0:Vn.NODE_ENV);function Yn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(On,{fallback:i=>{let s="";if(Xn&&r)try{const e=Gn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(kn,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const Qn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Kn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Un(e,t,n,o){if(!Xn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Zn(o){const{data:r,rawData:a,colorBy:c,colorScheme:u,legendInteraction:h,legendPosition:g,selection:p,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:E,height:C}=o,P="string"==typeof o.colorBy?o.colorBy:void 0,{activeSelectionHook:M,hoverSelectionHook:L,customHoverBehavior:T,customClickBehavior:B,crosshairSourceId:I}=function({selection:e,linkedHover:o,fallbackFields:r=[],unwrapData:i=!1,onObservation:a,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:p}){const y=d(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(o,r),m=rn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=rn({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||r||[]}),b=Jt(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=l(null),k=p||r[0],O=n(()=>{if(!g||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,w,k]),j=s(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=en.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(en={positions:new Map(en.positions).set(e,{xValue:t,sourceId:n})},nn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&on(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(g&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(a||b){const o={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});a&&a(e),b&&b(e)}}},[o,v,f,y,a,c,u,b,g,k]),S=s(e=>{var t,n,o,r;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=en.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(en.positions);return t.delete(e),en={positions:t},nn(),!1}en={positions:new Map(en.positions).set(e,{xValue:t,sourceId:n,locked:!0})},nn()}(f.name||"hover",Number(n),y)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});a&&a(e),b&&b(e)}}},[h,a,b,c,u,f,y]);return t(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=en.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(en.positions);o.delete(e),en={positions:o},nn()}(e,y),on(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:p,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),H=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,I),R=function(e,t,o){const r=i(Xt),s=cn();return n(()=>{var n;if(!t)return;const i=null!==(n=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=te(n.map(e=>({_cat:e})),"_cat",i);return t=>r[t]||e(t)}return te(n.map(e=>({_cat:e})),"_cat",i)}if(r&&Object.keys(r).length>0){const n=te(e,t,i);return e=>r[e]||n(e)}return te(e,t,i)}if(r&&Object.keys(r).length>0){const e=te([{_:"a"}],"_",i);return t=>r[t]||e(t)}},[e,t,o,r,s])}(r,c,u),$=n(()=>{if(!c)return[];const e=new Set;for(const t of r){const n="function"==typeof c?c(t):t[c];null!=n&&e.add(n+"")}return Array.from(e)},[r,c]),D=function(e,t,o){const[r,i]=l(null),[a,c]=l(new Set),u=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,r,a]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(h,c,$),N=n(()=>L||(D.legendSelectionHook?D.legendSelectionHook:M),[L,D.legendSelectionHook,M]),F=function(e){const t=ct(e=>e.theme.colors.selectionOpacity);return n(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(p),{legend:z,margin:W,legendPosition:q}=function({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:s="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=i(sn),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return an({data:e,colorBy:t,colorScale:o,getColor:ee,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===s&&110>e.right?e.right=110:"left"===s&&110>e.left?e.left=110:"top"===s&&50>e.top?e.top=50:"bottom"===s&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,s]);return{legend:h,margin:g,legendPosition:s}}({data:r,colorBy:c,colorScale:R,showLegend:w,legendPosition:g,userMargin:A,defaults:k}),G=n(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),h&&"none"!==h&&(e.legendHoverBehavior=D.onLegendHover,e.legendClickBehavior=D.onLegendClick,e.legendHighlightedCategory=D.highlightedCategory,e.legendIsolatedCategories=D.isolatedCategories),e},[z,q,h,D.onLegendHover,D.onLegendClick,D.highlightedCategory,D.isolatedCategories]),V=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Kn),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}(S,E,C),X=V?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Qn),{width:n,height:o})},r||"No data available"):null}(a,E,C,_);return{colorScale:R,allCategories:$,legendState:D,effectiveSelectionHook:N,activeSelectionHook:M,customHoverBehavior:T,customClickBehavior:B,legend:z,margin:W,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:H,resolvedSelection:F}}const Jn=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,showCategoryTicks:I,categoryFormat:H,dataIdAccessor:R}=t,$=i.width,D=i.height,N=i.enableHover,F=i.showGrid,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=Zn({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"BarChart",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:$,height:D});if(Q.earlyReturn)return Q.earlyReturn;Un("BarChart",Y,"categoryAccessor",d),Un("BarChart",Y,"valueAccessor",h);const K=dn(Y,m,h),U=cn(),Z=n(()=>new Map,[Y]),J=n(()=>(e,t)=>{const n={};return n.fill=y?ee(e,y,Q.colorScale):un(B,U,f,void 0,Z),n},[y,Q.colorScale,B,U,f,Z]),te=n(()=>{const e=null==k?void 0:k.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},J(t,n)),e(t,n)||{}):J},[J,k]),ne=n(()=>ln(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:y&&y!==d?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[d,h,y,p]),re=Cn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"BarChart",message:re,width:$,height:D});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[$,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:v}),null!=b&&{roundedTop:b}),R&&{dataIdAccessor:R}),{baselinePadding:x,enableHover:N,showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I,oSort:m}),Q.legendBehaviorProps),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||oe}),(j||S||_||E)&&{customHoverBehavior:Q.customHoverBehavior}),(S||_||j)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"BarChart",width:$,height:D},e.createElement(Vt,Object.assign({ref:s},ie)))});function eo({isPushMode:e,colorBy:t,colorScheme:r,showLegend:i,legendPosition:a="right"}){const c=o(new Set),u=o([]),[d,h]=l(0),g=s(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=s(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=s(e=>t=>{p([t]),e(t)},[p]),f=s(e=>t=>{p(t),e(t)},[p]),m=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!t||!1===i)return;const n=u.current;if(0===n.length)return;const o=Array.isArray(r)?r:Z,s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],o[e%o.length]);const a="string"==typeof t?t:"__streamCat";return an({data:n.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ee})},[e,t,i,r,d]),b=n(()=>{if(v)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[v,a]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function to({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l,setup:c}){const d=eo({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l}),h=s(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=s(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:l||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,l]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}Jn.displayName="BarChart";const no=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:E,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,categoryFormat:H}=t,R=i.width,$=i.height,D=i.enableHover,N=i.showGrid,F=i.showLegend,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=y||d,K=void 0===a,U=Zn({data:Y,rawData:a,colorBy:Q,colorScheme:f,legendInteraction:T,legendPosition:B,selection:j,linkedHover:S,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:_,onClick:E,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:R,height:$});if(U.earlyReturn)return U.earlyReturn;const Z=cn(),J=n(()=>new Map,[Y]),te=n(()=>(e,t)=>Q?U.colorScale?{fill:ee(e,Q,U.colorScale)}:{}:{fill:un(I,Z,f,t,J)},[Q,U.colorScale,I,Z,f,J]),ne=n(()=>{const e=null==O?void 0:O.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=te(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:te},[te,O]),oe=n(()=>ln(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),re=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ie=Cn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:ae}=to({ref:r,frameRef:s,isPushMode:K,colorBy:Q,colorScheme:f,showLegend:F,legendPosition:B,setup:U}),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:D}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:N}),se),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:bn(A)||re}),(S||_||E||C)&&{customHoverBehavior:U.customHoverBehavior}),(_||E||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ie?e.createElement(kn,{componentName:"StackedBarChart",message:ie,width:R,height:$}):e.createElement(Yn,{componentName:"StackedBarChart",width:R,height:$},e.createElement(Vt,Object.assign({ref:s},le)))});no.displayName="StackedBarChart";const oo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I}=t,H=i.width,R=i.height,$=i.enableHover,D=i.showGrid,N=i.showLegend,F=i.title,z=i.description,W=i.summary,q=i.accessibleTable,G=i.categoryLabel,V=i.valueLabel,X=a||[],Y=y||d,Q=void 0===a,K=Zn({data:X,rawData:a,colorBy:Y,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"GroupedBarChart",chartId:C,showLegend:N,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:H,height:R});if(K.earlyReturn)return K.earlyReturn;const U=cn(),Z=n(()=>new Map,[X]),J=k.pieceStyle,te=n(()=>(e,t)=>{const n=Y?K.colorScale?{fill:ee(e,Y,K.colorScale)}:{}:{fill:un(B,U,f,t,Z)};if(J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Y,K.colorScale,B,U,f,Z,J]),ne=n(()=>ln(te,K.effectiveSelectionHook,K.resolvedSelection),[te,K.effectiveSelectionHook,K.resolvedSelection]),oe=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),re=Cn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ie,effectiveMargin:se}=to({ref:r,frameRef:s,isPushMode:Q,colorBy:Y,colorScheme:f,showLegend:N,legendPosition:T,setup:K}),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:V,rFormat:p}),I&&{oFormat:I}),{showGrid:D}),ie),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||oe}),(j||S||_||E)&&{customHoverBehavior:K.customHoverBehavior}),(S||_||j)&&{customClickBehavior:K.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return re?e.createElement(kn,{componentName:"GroupedBarChart",message:re,width:H,height:R}):e.createElement(Yn,{componentName:"GroupedBarChart",width:H,height:R},e.createElement(Vt,Object.assign({ref:s},ae)))});function ro({brushProp:e,onBrushProp:t,linkedBrush:r,valueAccessor:i}){const a=(l="string"==typeof r?r:r?{name:r.name,xField:r.rField}:void 0)?"string"==typeof l?{name:l}:l:null;var l;const c=function(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=rn({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}({name:(null==a?void 0:a.name)||"__unused_ordinal_brush__",xField:(null==a?void 0:a.xField)||("string"==typeof i?i:"value")}),u=o(c.brushInteraction);u.current=c.brushInteraction;const d=s(e=>{if(a){u.current.end(e?e.r:null)}null==t||t(e)},[t,a]),h=!!(e||r||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}oo.displayName="GroupedBarChart";const io=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I,rTickValues:H,tickLabelEdgeAlign:R,showCategoryTicks:$}=t,D=i.width,N=i.height,F=i.enableHover,z=i.showGrid,W=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,K=a||[],U=y||d,Z=void 0===a,J=Zn({data:K,rawData:a,colorBy:U,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"SwimlaneChart",chartId:C,showLegend:W,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:D,height:N}),te=ro({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const ne=cn(),oe=n(()=>new Map,[K]),re=k.pieceStyle,ie=n(()=>(e,t)=>{const n=U?J.colorScale?{fill:ee(e,U,J.colorScale)}:{}:{fill:un(B,ne,f,t,oe)};if(re){const o=re(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[U,J.colorScale,B,ne,f,oe,re]),se=n(()=>ln(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),ae=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),le=Cn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:ce,effectiveMargin:ue}=to({ref:r,frameRef:s,isPushMode:Z,colorBy:U,colorScheme:f,showLegend:W,legendPosition:T,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[D,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===$?void 0:Y,rLabel:Q,rFormat:p}),H&&{rTickValues:H}),null!=R&&{tickLabelEdgeAlign:R}),I&&{oFormat:I}),void 0!==$&&{showCategoryTicks:$}),{showGrid:z}),ce),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:bn(v)||ae}),(j||S||_||E)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),b&&b.length>0&&{annotations:b}),te.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return le?e.createElement(kn,{componentName:"SwimlaneChart",message:le,width:D,height:N}):e.createElement(Yn,{componentName:"SwimlaneChart",width:D,height:N},e.createElement(Vt,Object.assign({ref:s},de)))});io.displayName="SwimlaneChart";const so=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:E,linkedHover:C,onObservation:P,onClick:M,hoverHighlight:L,chartId:T,loading:B,emptyContent:I,legendInteraction:H,legendPosition:R,color:$,showCategoryTicks:D,categoryFormat:N}=t,F=i.width,z=i.height,W=i.enableHover,q=i.showGrid,G=i.title,V=i.description,X=i.summary,Y=i.accessibleTable,Q=i.categoryLabel,K=i.valueLabel,U=a||[],Z=Zn({data:U,rawData:a,colorBy:y,colorScheme:f,legendInteraction:H,legendPosition:R,selection:E,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:M,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:I,width:F,height:z}),J=ro({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const te=n(()=>{if(!m)return;const e=U.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[U,m]),ne=cn(),oe=n(()=>new Map,[U]),re=_.pieceStyle,ie=n(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ee(e,y,Z.colorScale):un($,ne,f,void 0,oe),n.r=m?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}(e,m,v,te):b,re){const o=re(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,Z.colorScale,m,v,te,b,x,$,ne,f,oe,re]),se=n(()=>ln(ie,Z.effectiveSelectionHook,Z.resolvedSelection),[ie,Z.effectiveSelectionHook,Z.resolvedSelection]),ae=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:y||void 0,valueFormat:p}),[d,h,y,p]),le=Cn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e.createElement(kn,{componentName:"SwarmPlot",message:le,width:F,height:z});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:w,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:p}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:bn(A)||ae}),(C||P||M||L)&&{customHoverBehavior:Z.customHoverBehavior}),(P||M||C)&&{customClickBehavior:Z.customClickBehavior}),k&&k.length>0&&{annotations:k}),J.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"SwarmPlot",width:F,height:z},e.createElement(Vt,Object.assign({ref:s},ce)))});function ao(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:yn},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=i.length,a=s>0?s%2!=0?i[Math.floor(s/2)]:(i[s/2-1]+i[s/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:yn},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),s>0&&e.createElement("div",null,"n = ",s),null!=a&&e.createElement("div",null,"Median: ",a.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}so.displayName="SwarmPlot";const lo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:E,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,showCategoryTicks:T,categoryFormat:B}=t,I=i.width,H=i.height,R=i.enableHover,$=i.showGrid,D=i.title,N=i.description,F=i.summary,z=i.accessibleTable,W=i.categoryLabel,q=i.valueLabel,G=a||[],V=Zn({data:G,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:C,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const X=cn(),Y=n(()=>new Map,[G]),Q=n(()=>e=>{const t=y?ee(e,y,V.colorScale):un(L,X,f,void 0,Y);return{fill:t,stroke:t,fillOpacity:.8}},[y,V.colorScale,L,X,f,Y]),K=n(()=>ln(Q,V.effectiveSelectionHook,V.resolvedSelection),[Q,V.effectiveSelectionHook,V.resolvedSelection]),U=n(()=>ao(),[]),Z=Cn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(kn,{componentName:"BoxPlot",message:Z,width:I,height:H});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:G}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:v,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:W,rLabel:q,rFormat:p}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T}),V.legendBehaviorProps),D&&{title:D}),N&&{description:N}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:bn(b)||U}),(k||O||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(O||j||k)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"BoxPlot",width:I,height:H},e.createElement(Vt,Object.assign({ref:s},J)))});lo.displayName="BoxPlot";const co=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:"horizontal"}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:p=!1,valueFormat:y,colorBy:f,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:w,onBrush:A,linkedBrush:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:E,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,showCategoryTicks:H,categoryFormat:R}=t,$=i.width,D=i.height,N=i.enableHover,F=i.showGrid,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=Zn({data:Y,rawData:a,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:j,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:E,hoverHighlight:C,chartType:"Histogram",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:$,height:D}),K=ro({brushProp:w,onBrushProp:A,linkedBrush:k,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const U=n(()=>{if(0===Y.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Y){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Y,h]),Z=cn(),J=n(()=>new Map,[Y]),te=n(()=>e=>{const t=f?ee(e,f,Q.colorScale):un(I,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[f,Q.colorScale,I,Z,m,J]),ne=n(()=>ln(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:yn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),re=Cn({componentName:"Histogram",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"Histogram",message:re,width:$,height:D});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=a&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ne,bins:g,normalize:p}),U&&{rExtent:U}),{size:[$,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:N}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:y}),R&&{oFormat:R}),{showGrid:F,showCategoryTicks:H}),Q.legendBehaviorProps),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:bn(b)||oe}),(S||_||E||C)&&{customHoverBehavior:Q.customHoverBehavior}),(_||E||S)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"Histogram",width:$,height:D},e.createElement(Vt,Object.assign({ref:s},ie)))});co.displayName="Histogram";const uo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:E,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,showCategoryTicks:R,categoryFormat:$}=t,D=i.width,N=i.height,F=i.enableHover,z=i.showGrid,W=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=a||[],K=Zn({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:I,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:D,height:N}),U=ro({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=cn(),J=n(()=>new Map,[Q]),te=n(()=>e=>{const t=m?ee(e,m,K.colorScale):un(H,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,H,Z,v,J]),ne=n(()=>ln(te,K.effectiveSelectionHook,K.resolvedSelection),[te,K.effectiveSelectionHook,K.resolvedSelection]),oe=n(()=>ao({valueAccessor:h}),[h]),re=Cn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"ViolinPlot",message:re,width:D,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:ne,bins:p,showIQR:y,size:[D,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:f}),$&&{oFormat:$}),{showGrid:z,showCategoryTicks:R}),K.legendBehaviorProps),W&&{title:W}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||oe}),(_||E||C||P)&&{customHoverBehavior:K.customHoverBehavior}),(E||C||_)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),U.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"ViolinPlot",width:D,height:N},e.createElement(Vt,Object.assign({ref:s},ie)))});uo.displayName="ViolinPlot";const ho=c(function(t,r){var i;const s=gn(t.mode,{width:t.width,height:t.height,showGrid:null===(i=t.showGrid)||void 0===i||i,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=o(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I}=t,H=s.width,R=s.height,$=s.enableHover,D=s.showGrid,N=s.title,F=s.description,z=s.summary,W=s.accessibleTable,q=s.categoryLabel,G=s.valueLabel,V=l||[],X=Zn({data:V,rawData:l,colorBy:f,colorScheme:m,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"DotPlot",chartId:C,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:H,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=dn(V,v,g),Q=cn(),K=n(()=>new Map,[V]),U=k.pieceStyle,Z=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ee(e,f,X.colorScale):un(B,Q,m,void 0,K),U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,X.colorScale,b,B,Q,m,K,U]),J=n(()=>ln(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),te=n(()=>An({categoryAccessor:h,valueAccessor:g,valueFormat:y}),[h,g,y]),ne=Cn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ne)return e.createElement(kn,{componentName:"DotPlot",message:ne,width:H,height:R});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:J,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,barPadding:x,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:q,rLabel:G,rFormat:y}),I&&{oFormat:I}),{showGrid:D,oSort:v}),X.legendBehaviorProps),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||te}),(j||S||_||E)&&{customHoverBehavior:X.customHoverBehavior}),(S||_||j)&&{customClickBehavior:X.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"DotPlot",width:H,height:R},e.createElement(Vt,Object.assign({ref:a},oe)))});ho.displayName="DotPlot";const go=c(function(t,r){var i,s;const a=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=o(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:E,legendInteraction:C,legendPosition:P,color:M}=t,L=a.width,T=a.height,B=a.enableHover,I=a.showLegend,H=a.title,R=a.description,$=a.summary,D=a.accessibleTable,N=c||[],F=p||h,z=void 0===c,W=Zn({data:N,rawData:c,colorBy:F,colorScheme:y,legendInteraction:C,legendPosition:P,selection:w,linkedHover:A,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:I,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:E,width:L,height:T});if(W.earlyReturn)return W.earlyReturn;const q=cn(),G=n(()=>new Map,[N]),V=n(()=>(e,t)=>F?W.colorScale?{fill:ee(e,F,W.colorScale)}:{}:{fill:un(M,q,y,t,G)},[F,W.colorScale,M,q,y,G]),X=n(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},V(t,n)),e(t,n)||{}):V},[V,x]),Y=n(()=>ln(X,W.effectiveSelectionHook,W.resolvedSelection),[X,W.effectiveSelectionHook,W.resolvedSelection]),Q=n(()=>An({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),K=Cn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:U,effectiveMargin:Z}=to({ref:r,frameRef:l,isPushMode:z,colorBy:F,colorScheme:y,showLegend:I,legendPosition:P,setup:W}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:N}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Y,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,enableHover:B}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),U),H&&{title:H}),R&&{description:R}),$&&{summary:$}),void 0!==D&&{accessibleTable:D}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:bn(v)||Q}),(A||k||O||j)&&{customHoverBehavior:W.customHoverBehavior}),(k||O||A)&&{customClickBehavior:W.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(kn,{componentName:"PieChart",message:K,width:L,height:T}):e.createElement(Yn,{componentName:"PieChart",width:L,height:T},e.createElement(Vt,Object.assign({ref:l},J)))});go.displayName="PieChart";const po=c(function(t,r){var i,s;const a=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),l=o(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:p=60,centerContent:y,colorBy:f,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:T}=t,B=a.width,I=a.height,H=a.enableHover,R=a.showLegend,$=a.title,D=a.description,N=a.summary,F=a.accessibleTable,z=c||[],W=f||h,q=void 0===c,G=Zn({data:z,rawData:c,colorBy:W,colorScheme:m,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"DonutChart",chartId:E,showLegend:R,userMargin:u,marginDefaults:a.marginDefaults,loading:C,emptyContent:P,width:B,height:I});if(G.earlyReturn)return G.earlyReturn;const V=cn(),X=n(()=>new Map,[z]),Y=A.pieceStyle,Q=n(()=>(e,t)=>{let n;if(n=W?G.colorScale?{fill:ee(e,W,G.colorScale)}:{}:{fill:un(T,V,m,t,X)},Y){const o=Y(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[W,G.colorScale,T,V,m,X,Y]),K=n(()=>ln(Q,G.effectiveSelectionHook,G.resolvedSelection),[Q,G.effectiveSelectionHook,G.resolvedSelection]),U=n(()=>An({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Z=Cn({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:te}=to({ref:r,frameRef:l,isPushMode:q,colorBy:W,colorScheme:m,showLegend:R,legendPosition:L,setup:G}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=c&&{data:z}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,innerRadius:p,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:y,size:[B,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||U}),(O||j||S||_)&&{customHoverBehavior:G.customHoverBehavior}),(j||S||O)&&{customClickBehavior:G.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return Z?e.createElement(kn,{componentName:"DonutChart",message:Z,width:B,height:I}):e.createElement(Yn,{componentName:"DonutChart",width:B,height:I},e.createElement(Vt,Object.assign({ref:l},ne)))});po.displayName="DonutChart";const yo=c(function(t,r){var i,s,a;const l=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:300,height:null!==(s=t.height)&&void 0!==s?s:250,enableHover:null===(a=t.enableHover)||void 0===a||a,showLegend:!1,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),c=o(null),{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!0,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_}=t,E=l.width,C=l.height,P=l.title,M=l.description,L=l.summary,T=l.accessibleTable,B=Math.max(d,Math.min(h,u)),I=h-d||1,H=(B-d)/I,{gaugeData:R,pieceStyle:$,gaugeAnnotations:D}=n(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],s=(i.value-r)/I;if(k){const o=(r-d)/I,a=Math.max(0,Math.min(H,(i.value-d)/I)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,H,I,w,k]),N=A*Math.PI/180,F=180+(360-A)/2,z=-Math.PI/2+F*Math.PI/180,W=[[Math.cos(z),Math.sin(z)],[Math.cos(z+N),Math.sin(z+N)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-z)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>N+.001||W.push([Math.cos(e),Math.sin(e)]);const q=Math.min(...W.map(e=>e[0])),G=Math.max(...W.map(e=>e[0])),V=Math.min(...W.map(e=>e[1])),X=Math.max(...W.map(e=>e[1])),Y=(V+X)/2,Q=(q+G)/2,K=Math.max(10,Math.min((E-20)/(G-q),(C-20)/(X-V))-4),U=Math.max(10,K*(1-f)),Z=E/2-Q*K,J=C/2-Y*K,ee=2*(K+4),te=n(()=>{if(null!=b)return"function"==typeof b?b(B,d,h):b;const t=x?x(B):Math.round(B)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),w&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,B,d,h,x,w,K]),ne=n(()=>{if(!m)return null;const e=-Math.PI/2+F*Math.PI/180+H*N,t=U-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,H,F,N,U,v]),oe=n(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||E)/2},${(o.height||C)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+F*Math.PI/180+(t.value-d)/I*N,i=U-14,s=(o.height||C)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||E)/2+Math.cos(r)*i,y:s+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[E,C,d,I,F,N,U]),re=n(()=>{const e=[...D,...j||[]];return ne&&e.push(ne),e},[D,j,ne]),ie=n(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===R.length)return e.createElement(kn,{componentName:"GaugeChart",message:"No data to display",width:E,height:C});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:R,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:U,startAngle:F,sweepAngle:A,centerContent:te,size:[E,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:{top:J-ee/2,bottom:C-J-ee/2,left:Z-ee/2,right:E-Z-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:bn(O)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),P&&{title:P}),M&&{description:M}),L&&{summary:L}),void 0!==T&&{accessibleTable:T}),_&&{className:_}),null!=t.animate&&{animate:t.animate}),S);return e.createElement(Yn,{componentName:"GaugeChart",width:E,height:C},e.createElement(Vt,Object.assign({ref:c},se)))});yo.displayName="GaugeChart";const fo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,showCategoryTicks:B,categoryFormat:I}=t,H=i.width,R=i.height,$=i.enableHover,D=i.showGrid,N=i.title,F=i.description,z=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V=a||[],X=Zn({data:V,rawData:a,colorBy:m,colorScheme:v,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:H,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=cn(),Q=n(()=>new Map,[V]),K=n(()=>e=>{const t=m?ee(e,m,X.colorScale):un(T,Y,v,void 0,Q);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,Y,v,Q]),U=n(()=>ln(K,X.effectiveSelectionHook,X.resolvedSelection),[K,X.effectiveSelectionHook,X.resolvedSelection]),Z=n(()=>ao(),[]),J=Cn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(kn,{componentName:"RidgelinePlot",message:J,width:H,height:R});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:U,bins:p,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,barPadding:b,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G,rFormat:f}),I&&{oFormat:I}),{showGrid:D,showCategoryTicks:B,oSort:!1,amplitude:y}),X.legendBehaviorProps),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||Z}),(O||j||S||_)&&{customHoverBehavior:X.customHoverBehavior}),(j||S||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"RidgelinePlot",width:H,height:R},e.createElement(Vt,Object.assign({ref:s},te)))});fo.displayName="RidgelinePlot";const mo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:!1}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:p,colorScheme:y,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:E,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,categoryFormat:T}=t,B="vertical"===f,I=i.width,H=i.height,R=i.enableHover,$=i.title,D=i.description,N=i.summary,F=i.accessibleTable,z=a||[],W=p||g,q=!W,G=Zn({data:z,rawData:a,colorBy:W,colorScheme:y,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"FunnelChart",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:$?60:40,right:20,bottom:60,left:60}:{top:$?40:10,right:10,bottom:10,left:10},loading:E,emptyContent:C,width:I,height:H});if(G.earlyReturn)return G.earlyReturn;Un("FunnelChart",z,"stepAccessor",d),Un("FunnelChart",z,"valueAccessor",h);const V=cn(),X=n(()=>new Map,[z]),Y=n(()=>{if(q)return L||((null==V?void 0:V[0])?V[0]:Array.isArray(y)&&y[0]?y[0]:"#4e79a7")},[q,L,V,y]),Q=w.pieceStyle,K=n(()=>(e,t)=>{const n={};if(n.fill=Y||(W?ee(e,W,G.colorScale):un(L,V,y,t,X)),Q){const o=Q(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Y,W,G.colorScale,L,V,y,X,Q]),U=n(()=>ln(K,G.effectiveSelectionHook,G.resolvedSelection),[K,G.effectiveSelectionHook,G.resolvedSelection]),Z=n(()=>t=>{var n,o,r,i,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,y=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:yn},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),p&&p!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",y))},[]),J=Cn({componentName:"FunnelChart",data:a,accessors:{stepAccessor:d,valueAccessor:h}});if(J)return e.createElement(kn,{componentName:"FunnelChart",message:J,width:I,height:H});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=a&&{data:z}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:U,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),G.legendBehaviorProps),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Z:bn(b)||Z}),(k||O||j||S)&&{customHoverBehavior:G.customHoverBehavior}),(O||j||k)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"FunnelChart",width:I,height:H},e.createElement(Vt,Object.assign({ref:s},te)))});mo.displayName="FunnelChart";const vo="__likert_neutral_neg",bo="__likert_neutral_pos";function xo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function wo(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function Ao(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:vo,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:bo,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function ko(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===vo?i=n:n.__likertLevel===bo?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Oo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=o(null),{data:l,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:p,countAccessor:y="count",levels:f,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,valueFormat:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,categoryFormat:B}=t,I=i.width,H=i.height,R=i.enableHover,$=i.showGrid,D=i.showLegend,N=i.title,F=i.description,z=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V="horizontal"===m,X=void 0===l,Y=!p,Q=n(()=>v&&Array.isArray(v)&&v.length>=f.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(f.length),[v,f.length]),K=n(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],Q[t]||"#888");return e},[f,Q]),{processedData:U,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:t,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:l,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>xo(r,"question"),[r]),g=n(()=>d?xo(i,"score"):null,[d,i]),p=n(()=>d?null:xo(a,"level"),[d,a]),y=n(()=>d?null:xo(l,"count"),[d,l]),f=e||[],m=o([]),v=n(()=>{if(0===f.length)return[];let e=wo(f,t,h,g,p,y);return c&&(e=Ao(e,t),e=ko(e,t)),e},[f,t,h,g,p,y,c]),b=s(e=>{var n;let o=wo(e,t,h,g,p,y);c&&(o=Ao(o,t),o=ko(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:f,categoryAccessor:h,valueAccessor:g,levelAccessor:p,countAccessor:y,isDiverging:V,frameRef:a}),ee="__likertLevelLabel",te=eo({isPushMode:X,colorBy:ee,colorScheme:Q,showLegend:D,legendPosition:T}),ne=s(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=s(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;J.current=[],te.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ne,oe,te.resetCategories,J]);const re=Zn({data:U,rawData:l,colorBy:ee,colorScheme:Q,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"LikertChart",chartId:E,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:I,height:H});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=f.length;return e%2!=0&&K.get(f[Math.floor(e/2)])||"#888"},[f,K]),se=A.pieceStyle,ae=n(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(i===vo||i===bo)s={fill:ie};else{const e=r||i;s=e&&K.has(e)?{fill:K.get(e)}:{fill:"#888"}}if(se){const n=se(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[K,ie,se]),le=n(()=>ln(ae,re.effectiveSelectionHook,re.resolvedSelection),[ae,re.effectiveSelectionHook,re.resolvedSelection]),ce=n(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),ue=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===vo||o===bo?ce:o,i=n.__likertCategory||"",s=Math.abs(n.__likertPct||0),a=o===vo||o===bo?2*s:s,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${a.toFixed(1)}% (n=${l})`))},[ce]),de=n(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&p)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(p&&!y)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Y?g&&(e.valueAccessor=g):(p&&(e.levelAccessor=p),y&&(e.countAccessor=y)),Cn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:f}})},[l,h,g,p,y,f,Y]),he=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,K]),ge=n(()=>!1!==D?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:he},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,D,he]),pe=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==D){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,V,X,D,T]),ye=n(()=>C||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,C]),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:U}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:le,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:b,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:ye}),B&&{oFormat:B}),{showGrid:$}),ge),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:!0===x?ue:bn(x)||ue}),(O||j||S||_)&&{customHoverBehavior:re.customHoverBehavior}),(j||S||O)&&{customClickBehavior:re.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return de?e.createElement(kn,{componentName:"LikertChart",message:de,width:I,height:H}):e.createElement(Yn,{componentName:"LikertChart",width:I,height:H},e.createElement(Vt,Object.assign({ref:a},fe)))});Oo.displayName="LikertChart";export{Jn as BarChart,lo as BoxPlot,po as DonutChart,ho as DotPlot,mo as FunnelChart,yo as GaugeChart,oo as GroupedBarChart,co as Histogram,Oo as LikertChart,go as PieChart,fo as RidgelinePlot,no as StackedBarChart,Vt as StreamOrdinalFrame,so as SwarmPlot,io as SwimlaneChart,uo as ViolinPlot,It as createHatchPattern};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useEffect as i,useMemo as r,useRef as s,createContext as a,useContext as l,useCallback as c,useSyncExternalStore as u,useState as d,forwardRef as h,useImperativeHandle as g,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as f,scaleBand as m}from"d3-scale";import{quadtree as v}from"d3-quadtree";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as w,interpolatePurples as A,interpolateOranges as k,interpolateGreens as O,interpolateReds as j,interpolateBlues as S,schemeSet3 as _,schemeTableau10 as C,interpolateSpectral as M,interpolateRdYlGn as P,interpolateRdYlBu as L,interpolateBrBG as T,interpolatePRGn as B,interpolatePiYG as I,interpolateRdBu as H}from"d3-scale-chromatic";import{quantile as R}from"d3-array";import{packEnclose as $}from"d3-hierarchy";import{area as D,curveCatmullRom as N,curveCardinal as W,curveBasis as F,curveStepBefore as z,curveStepAfter as E,curveStep as q,curveMonotoneY as G,curveMonotoneX as V,curveLinear as X,arc as Y}from"d3-shape";import Q from"regression";import{select as U}from"d3-selection";import{brushX as K,brushY as Z}from"d3-brush";class J{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class ee{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class te{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function ne(e,t,n){return e+(t-e)*n}function oe(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function ie(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const se={category10:b,tableau10:C,set3:_,blues:S,reds:j,greens:O,oranges:k,purples:A,viridis:w,plasma:x},ae=b,le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ce=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ue(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ce.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ae[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%ae.length]}function de(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=se[n]||se.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ae;return y().domain(o).range(e).unknown("#999")}}function he(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ge(e,t){const{columns:n,config:o,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function pe(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=R(e,.25))&&void 0!==t?t:r,median:null!==(n=R(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=R(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const ye={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],p="vertical"===h,y="horizontal"===h,f=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;f&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(p){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(he(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(y){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(he(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(he(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const y=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=r(e.datum);y>0&&(e.roundedTop=y),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:ge,donut:ge,boxplot:function(e,t){var n,o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:p}=l,y=[],f="vertical"===p,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],p=null!==(n=R(l,.25))&&void 0!==n?n:c,v=null!==(o=R(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=R(l,.75))&&void 0!==i?i:u,x=b-p,w=p-1.5*x,A=b+1.5*x,k=null!==(r=l.find(e=>e>=w))&&void 0!==r?r:c,O=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:u,j=h(t.pieceData[0],t.name),S=[];if(m)for(const e of t.pieceData){const n=d(e);if(w>n||n>A){const o=f?t.middle:g(n),i=f?g(n):t.middle;S.push({px:o,py:i,value:n,datum:e})}}if(y.push({type:"boxplot",x:f?t.middle:0,y:f?0:t.middle,projection:f?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(k),q1Pos:g(p),medianPos:g(v),q3Pos:g(b),maxPos:g(O),stats:{n:l.length,min:k,q1:p,median:v,q3:b,max:O,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:S}),m)for(const t of S)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;p>t;t++){const n=u(r+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(r+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(r+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(r+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=R(t,.25))&&void 0!==n?n:r,l=null!==(o=R(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=R(t,.75))&&void 0!==i?i:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(r)),width:e.width,height:Math.abs(u(s)-u(r))}:{x:Math.min(u(r),u(s)),y:e.x,width:Math.abs(u(s)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:pe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,y=Math.max(...r,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/y)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(he(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/p*f}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:pe(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(he(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(he(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],A=[];let k=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}A.push({col:e,groups:t,stepTotal:n}),w||n>k&&(k=n)}if(w)for(const e of A){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>k&&(k=o)}if(0===k)return p;const O=new Map;for(const e of b){const t=A[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const j=A[0].stepTotal,S=w?.95*y:.9*t.width,_=f().domain([0,k]).range([0,S]),C=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;A.length>t;t++){const n=A[t],o=n.col,u=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=y,i=y;for(let r=0;b.length>r;r++){const a=b[r],l=n.groups.get(a);if(!l)continue;const c=_(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const w=g(l.pieces[0],a),A=null!==(s=O.get(a))&&void 0!==s?s:l.total,k=A>0?l.total/A*100:0,j=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});m&&(0===r&&(j.__funnelStepLabel=o.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=f,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+c/2,j.__funnelValueLabelY=f,j.__funnelBarW=c),p.push(he(x,f,c,h,w,j,a)),v.set(a,{x:x,y:f,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=y-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?a:o.name,x=g(c,d),w=j>0?e/j*100:0,A=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?a:o.name});m&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=f,A.__funnelRowWidth=t,A.__funnelValueLabelX=y,A.__funnelValueLabelY=f,A.__funnelBarW=t),p.push(he(s,f,t,h,x,A,d)),v.set(a,{x:s,y:f,w:t,h:h})}if(t>0&&M.size>0){const t=w?b:[b[0]];for(const i of t){const t=M.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:C},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};p.push(u)}}M=v}return p},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(i=m.get(h))&&void 0!==i?i:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),C=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(he(O,j,u,S,_,C,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),i=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(he(O,e,u,t,o,i,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:i,getStack:r,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(i(n));if(0===o)continue;const l=r?r(n):e.name,d=s(n,l);if(u){const i=a(t),r=a(t+o);c.push(he(i,e.x,r-i,e.width,d,n,l))}else{const i=a(t+o),r=a(t);c.push(he(e.x,i,e.width,r-i,d,n,l))}t+=o}}return c}};class fe{constructor(e){this.rExtent=new te,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new ee(e.windowSize),this.getO=re(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new te)):(this.getR=ie(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=re(e.stackBy),this.getGroup=re(e.groupBy),this.getColor=re(e.colorAccessor),this.getConnector=re(e.connectorAccessor),this.getDataId=re(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=m().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=f().domain(s).range([o,n])}else a?(u=m().domain(r).range([0,e.height]).padding(c),d=f().domain(s).range([0,e.width])):(u=m().domain(r).range([0,e.width]).padding(c),d=f().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?f().domain([l,c]).range([0,e.width]):f().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ye[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(n,i);i=[...e,...i]}return i}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||le,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,fe.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=v().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e})}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=ne(o.x,e._targetX,s),e.y=ne(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=ne(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=ne(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ne(n.x,e._targetX,s),e.y=ne(n.y,e._targetY,s),void 0!==n.w&&(e.w=ne(n.w,e._targetW,s),e.h=ne(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ne(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=ne(n.startAngle,e._targetStartAngle,s),e.endAngle=ne(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!oe(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!oe(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(oe(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=re(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!oe(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ie(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new te)):(this.getR=ie(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!oe(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?re(this.config.stackBy):void 0),"groupBy"in e&&!oe(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?re(this.config.groupBy):void 0),"colorAccessor"in e&&!oe(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?re(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!oe(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?re(this.config.connectorAccessor):void 0)}}function me(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ve(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function be(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function xe(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>me(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function we(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ve(Math.atan2(i,o)),a=ve(e.startAngle),l=ve(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Ae(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ke(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Oe(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function je(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}fe.QUADTREE_THRESHOLD=500;const Se={fill:e=>t("rect",{style:e,width:16,height:16}),line:e=>t("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function _e(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,Se[n])(o(e,t)),i}function Ce(){return t("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Pe=(n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=n,y=[];let f=0;const m=!(!o&&!i),v="isolate"===d||void 0===d&&null!=s;return p.forEach((n,d)=>{const b=_e(n,d,h,g),x=Me(n,r,s),w=s&&s.size>0&&s.has(n.label);y.push(e("g",{transform:`translate(0,${f})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&d===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?w||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),f+=22}),y};function Le({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&t("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),t("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let e=0;64>=e;e++){const n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[0]))},e))}return e("g",{"aria-label":l||"Gradient legend",children:[l&&t("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("defs",{children:t("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),t("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),t("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),t("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function Te(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical"}=n,[p,y]=o.useState(0),[f,m]=o.useState(0),v=o.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(t("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,e.label&&(d+=16,h.push(t("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+g)),d+=8),h.push(t("g",{className:"legend-item",transform:`translate(0,${d})`,children:Pe(e,o,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*e.items.length+8}),h})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h})=>{let g=0;const p=[];n.forEach((n,o)=>{let y=0;n.label&&(y+=16);const f=((n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:p,items:y}=n,f=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===d||void 0===d&&null!=s;y.forEach((n,d)=>{const w=_e(n,d,g,p),A=Me(n,r,s),k=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),f.push(e("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:b?c===a&&d===l?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&x?k||!1:void 0,"aria-current":b&&!x&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(d+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[b&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,k&&t(Ce,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=O});let w=0,A=0;for(const e of y){const t=26+7*e.label.length;h&&h>0&&A>0&&A+t>h?(w=Math.max(w,A),A=t):A+=t}w=Math.max(w,A);const k=v+1;return{items:f,offset:w,totalRows:k,totalHeight:22*k}})(n,r,s,a,l,c,u,o,d,h,i);y+=f.offset+5,p.push(Object.assign(Object.assign({label:n.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),g+=y+12});let y=g>i?0:Math.max(0,(i-g)/2);const f=[];return p.forEach((e,i)=>{const r=n[i];r.label&&(f.push(t("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),f.push(t("g",{className:"legend-item",transform:`translate(${y},0)`,children:e.items},"legend-group-"+i)),y+=e.offset+5,n[i+1]&&f.push(t("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(e.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),t("g",{children:f})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:f,onFocusedIndexChange:v,legendInteraction:c}),x=!(!r&&!s);return e("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&t("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),b]})}function Be(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ie(e){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=r.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=i-r.bottom+50):(p=o-r.right+10,y=r.top),t("g",{transform:`translate(${p}, ${y})`,children:(f=n,"object"==typeof f&&null!==f&&"gradient"in f?t(Le,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Be(n)?t(Te,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var f}function He(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Re(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function $e(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===g?p="end":"middle"===g&&(p="middle"):p=0>o?"end":"start";const y=16,f=a?d?[a]:He(a,u):[],m=s?d?[s]:He(s,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(x.push(t("text",{className:"annotation-note-title",fill:w,textAnchor:p,fontWeight:"bold",children:f.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-title")),b=f.length*y),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:p,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:y,children:e},n))},"annotation-note-label"));let A=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(u,120);let n=0,o=e;"end"===p?(n=-e,o=0):"middle"===p&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+m.length)*y+(m.length>0?y:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),A=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+m.length-1)*y;let O=0;return"topBottom"===h?O=0>i?-(k+2):18:"leftRight"===h&&(O="middle"===g?-(k+y+(m.length>0&&f.length>0?2:0))/2+8:"bottom"===g||0>i?-(k+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),A]})}function De(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:Re((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ne(e,n,o,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const t=s.width||0,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),u=t/2,d=o/2,h=e*d>n*u?u/e:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return t("g",{className:"annotation-connector",children:a})}function We(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y,{children:[!m.has("connector")&&Ne(v,b,c,h,x,u),!m.has("subject")&&De(x,u,h,n,o),!m.has("note")&&$e(l,v,b,h)]}))}function Fe(e){var n,o;const{noteData:i}=e,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const e=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(We,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(We,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ee(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function qe(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=ze(e,n),c=Ee(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ge(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ve={linear:X,monotoneX:V,monotoneY:G,step:q,stepAfter:E,stepBefore:z,basis:F,cardinal:W,catmullRom:N};function Xe(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:p}=o,y="radial"===(null==u?void 0:u.projection),f="horizontal"===(null==u?void 0:u.projection),m=r(()=>!u||y?[]:(p||u.r.ticks(5)).map(e=>({value:e,pixel:u.r(e),label:(g||Ye)(e)})),[u,g,y,p]),v=h&&u&&!y,b=d&&u&&!y;return v||b?t("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${c.left},${c.top})`,children:[v&&t("g",{className:"ordinal-grid",children:m.map((e,n)=>t("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:i,y2:f?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),b&&t(n,{children:e(n,f?{children:[t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[t("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Ye(e){return Math.round(100*e)/100+""}function Qe(o){var i,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:A,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:_="right",foregroundGraphics:C,annotations:M,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:B,underlayRendered:I,children:H}=o,R="radial"===(null==g?void 0:g.projection),N="horizontal"===(null==g?void 0:g.projection),W=!1!==y,F=r(()=>p&&W&&g&&!R?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,W,g,v,R]),z=o.rTickValues,E=o.tickLabelEdgeAlign,q=r(()=>p&&g&&!R?(z||g.r.ticks(5)).map(e=>({value:e,pixel:g.r(e),label:(b||Ye)(e)})):[],[p,g,b,R,z]),G=s(new Map),V=s(null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0),Y=null!==(a=null==M?void 0:M.length)&&void 0!==a?a:0;V.current!==Y&&(V.current=Y,G.current=new Map);const U=r(()=>{if(!M||0===M.length)return null;const n=function(n,o,i){var r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,_,C,M,P,L,T,B,I,H,R,N,W,F,z,E,q,G,V,Y,U,K,Z,J,ee,te,ne;switch(n.type){case"label":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ge(r,s,i)?t(Fe,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=ze(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:12,e("g",{children:[t("line",{x1:r,y1:0,x2:r,y2:i.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ee(n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(i.width||0)/2,c="middle"):(l=(i.width||0)-4,c="end"),e("g",{children:[t("line",{x1:0,y1:r,x2:i.width||0,y2:r,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=$(r),a=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:ze(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ee(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.padding||10,a=r.map(e=>e.x),l=r.map(e=>e.y),c=Math.min(...a)-s,u=Math.max(...a)+s,d=Math.min(...l)-s,h=Math.max(...l)+s;return e("g",{children:[t("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=ze(e,i),a=Ee(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=ze(n,i),r=Ee(n,i);return t(Fe,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",p=i.yAccessor||"y",y=h.map(e=>[e[g],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(s=null===(r=i.scales)||void 0===r?void 0:r.x)&&void 0!==s?s:null===(a=i.scales)||void 0===a?void 0:a.time,m=null!==(c=null===(l=i.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=i.scales)||void 0===u?void 0:u.value;if(!f||!m)return null;const v=n.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(d=n.bandwidth)&&void 0!==d?d:.3):("polynomial"===v?Q.polynomial(y,{order:n.order||2}):Q.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=n.color||"#6366f1";return e("g",{children:[t("polyline",{points:x,fill:"none",stroke:w,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11,children:n.label})]},"ann-"+o)}case"band":{const r=null!==(g=null===(h=i.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(p=i.scales)||void 0===p?void 0:p.value,s=null!==(y=null==r?void 0:r(n.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(n.y1))&&void 0!==f?f:i.height||0;return e("g",{children:[t("rect",{x:0,y:Math.min(s,a),width:i.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v:null===(b=i.scales)||void 0===b?void 0:b.time,l=null!==(w=null===(x=i.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(A=i.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=r.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=Ve[i.curve||"linear"]||X,p=D().x(e=>a(e[s])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!p)return null;const y=n.fill||"#6366f1";return e("g",{children:[t("path",{d:p,fill:y,fillOpacity:null!==(k=n.fillOpacity)&&void 0!==k?k:.15,stroke:"none"}),n.label&&h.length>0&&t("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"anomaly-band":{const r=i.data||[];if(2>r.length)return null;const s=i.yAccessor||"y",a=null!==(j=null===(O=i.scales)||void 0===O?void 0:O.x)&&void 0!==j?j:null===(S=i.scales)||void 0===S?void 0:S.time,l=null!==(C=null===(_=i.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(M=i.scales)||void 0===M?void 0:M.value;if(!a||!l)return null;const c=r.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(P=n.threshold)&&void 0!==P?P:2,p=u-g*h,y=!1!==n.showBand,f=n.fill||"#6366f1",m=null!==(L=n.fillOpacity)&&void 0!==L?L:.1,v=n.anomalyColor||"#ef4444",b=null!==(T=n.anomalyRadius)&&void 0!==T?T:6,x=l(u+g*h),w=l(p),A=r.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-u)>g*h});return e("g",{children:[y&&t("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:f,fillOpacity:m}),A.map((e,n)=>{const o=ze(e,i),r=Ee(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:f,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(I=null===(B=i.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=i.scales)||void 0===H?void 0:H.time,c=null!==(N=null===(R=i.scales)||void 0===R?void 0:R.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.value;if(!l||!c)return null;const u=r.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=Q.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;d=e=>a+s*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(h-2,1)),y=u.reduce((e,t)=>e+t[0],0)/h,f=u.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=n.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=n.steps)&&void 0!==z?z:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),A=[];for(let e=1;b>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=p*Math.sqrt(1+1/h+(f>0?Math.pow(e-y,2)/f:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${k.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),S=`${l(x)},${c(d(x))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(E=n.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),t("polyline",{points:`${S} ${j}`,fill:"none",stroke:_,strokeWidth:null!==(q=n.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=n.strokeDasharray)&&void 0!==G?G:"6,3"}),n.label&&k.length>0&&t("text",{x:l(k[k.length-1].x)+4,y:c(k[k.length-1].yCenter)-4,fill:_,fontSize:11,children:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=qe(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ge(e,r,i))return null;const s=null!==(V=n.dx)&&void 0!==V?V:0,a=null!==(Y=n.dy)&&void 0!==Y?Y:0,l=null!==(U=n.width)&&void 0!==U?U:32,c=null!==(K=n.height)&&void 0!==K?K:32,u=null!==(Z=n.content)&&void 0!==Z?Z:t("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return t("foreignObject",{x:e+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:t("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const e=qe(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=null===(J=i.scales)||void 0===J?void 0:J.o,a=null===(ee=i.scales)||void 0===ee?void 0:ee.x,l=null===(te=i.scales)||void 0===te?void 0:te.y,c=(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:(null==l?void 0:l.bandwidth)?l:null;if(!c)return null;const u=c(r);if(null==u)return null;const d=c.bandwidth(),h=n.color||"var(--semiotic-primary, #4589ff)",g=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:c===a)?{children:[t("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:g}),p&&t("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:g}),p&&t("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="horizontal"===(null==g?void 0:g.projection),i=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,r={scales:g?{x:o?g.r:i||g.r,y:o&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:l,height:c,data:B,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:G.current};return M.map((e,t)=>{if(P){const o=P(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[M,P,l,c,g,L,T,B]);return p||w||A||C||U&&U.length>0||x||H?e("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[t("title",{children:"string"==typeof w?w:"Ordinal Chart"}),t("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!R&&!I&&t("g",{className:"ordinal-grid",children:q.map((e,n)=>t("line",{x1:N?e.pixel:0,y1:N?0:e.pixel,x2:N?e.pixel:l,y2:N?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&g&&!R&&t("g",{className:"ordinal-axes",children:e(n,N?{children:[!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!I&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&l-1>e?t("line",{x1:e,y1:0,x2:e,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((n,o)=>{const i=E?0===o?"start":o===q.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:i,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m})]}:{children:[!I&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,o)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:n.label})})]},"cat-"+o)),f&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:f}),!I&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((n,o)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label})]},"val-"+o)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"},children:m})]})}),U,C,H]}),w&&t("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),Ie({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:_,title:w,legendHoverBehavior:k,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function Ue({width:e,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const u=s(null),d=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const p=s(!1),y=s(null),f="horizontal"===(null==l?void 0:l.projection),m=s(f);return m.current=f,i(()=>{if(!u.current)return;const t=U(u.current).select(".brush-g"),o=f?K():Z();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};y.current=r,h.current(r)}),t.call(o),d.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[e,n,f]),i(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=U(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),t("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Ke(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ze="undefined"==typeof window||"undefined"==typeof document,Je=o.createContext(null),et={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function tt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const nt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},it={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},rt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},st={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},at={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},lt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},ct={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ut({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),u=o.useContext(Je),d=null!==(a=null==u?void 0:u.visible)&&void 0!==a&&a,h=l||d,g=o.useRef(null),p=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,y=o.useCallback(()=>{l||d||c(!0)},[l,d]),f=o.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[d]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:et}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:y,style:et,role:"region","aria-label":p,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=_.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${nt(e.min)} to ${nt(e.max)}, mean ${nt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.slice(0,5),w=new Set;for(const e of x)for(const t of Object.keys(e.values))w.add(t);const A=Array.from(w);return e("div",{ref:g,id:r,tabIndex:-1,onBlur:f,style:ot,role:"region","aria-label":p,children:[t("button",{type:"button",onClick:()=>{d&&u&&u.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:rt,children:"×"}),t("div",{role:"note",style:it,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:st,children:[e("caption",{style:ct,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:at,children:"type"}),A.map(e=>t("th",{style:at,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:lt,children:n.label}),A.map(e=>{return t("td",{style:lt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":nt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function dt({summary:e}){return e?t("div",{role:"note",style:et,children:e}):null}function ht({tableId:e}){return t("a",{href:"#"+e,style:et,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,et)},children:"Skip to data table"})}function gt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="object"==typeof t?"Focused on data point: "+Object.entries(t).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+t}return t("div",{"aria-live":"polite","aria-atomic":"true",style:et,children:n})}const pt="var(--semiotic-focus, #005fcc)";function yt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);u=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"})}else u=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"});return t("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function ft({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const u=o.useRef(null),[d,h]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let g;return g=d?`translate(${d.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${d.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,t("div",{ref:u,className:l,style:{position:"absolute",left:s.left+e,top:s.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"},children:a})}function mt(e){const n=a(null),o=vt(e);return[function({children:o}){const i=r(()=>vt(e),[]);return t(n.Provider,{value:i,children:o})},e=>{var t;const i=null!==(t=l(n))&&void 0!==t?t:o,r=s(e);r.current=e;const a=c(()=>r.current(i.getState()),[i]),d=c(()=>r.current(i.getState()),[i]);return u(i.subscribe,a,d)}]}function vt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function bt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function xt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:wt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const wt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],At={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ot={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:wt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[jt,St]=mt(e=>({theme:At,setTheme(t){e(e=>{if("light"===t)return{theme:At};if("dark"===t)return{theme:kt};if("high-contrast"===t)return{theme:Ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:At;return{theme:xt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:xt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));const _t=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ct=new WeakMap;let Mt=0,Pt=!1,Lt=null,Tt=null,Bt=null;function It(e,t){var n,o;if(!t)return t;const i=_t.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Pt=!0;const e=()=>{Mt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Lt=new MutationObserver(e),Lt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Tt=window.matchMedia("(prefers-color-scheme: dark)"),Bt=e,"function"==typeof Tt.addEventListener?Tt.addEventListener("change",Bt):"function"==typeof Tt.addListener&&Tt.addListener(Bt)}catch(e){}}();let s=Ct.get(r);s&&s.version===Mt||(s={version:Mt,map:new Map},Ct.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function Ht(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Rt(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[a,l]=function(e,t,n){const o=s(null),[r,a]=d(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-u.left-u.right,g=l[1]-u.top-u.bottom,p=Ht(e.foregroundGraphics,l,u),y=Ht(e.backgroundGraphics,l,u),f=St(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=s(0),w=s(()=>{}),A=c(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=s(()=>{}),O=s(()=>{}),j=s(null),S=s(0),_=c(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),C=c(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),M=c(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);i(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=e.themeDirtyRef;return i(()=>{P&&(Mt++,P.current=!0,A())},[f,A,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function $t(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Dt(e,t,n=.3){$t(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Nt(e,t,n=.6){var o,i,r,s,a;if(!$t(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Wt(e,t,n,o=.35){$t(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ft(e,t,n){const o=t.fillGradient;if(!o)return null;const i=t.roundedEdge;let r=t.x,s=t.y,a=t.x,l=t.y+t.h;if("bottom"===i?(s=t.y+t.h,l=t.y):"right"===i?(r=t.x+t.w,s=t.y,a=t.x,l=t.y):"left"===i&&(r=t.x,s=t.y,a=t.x+t.w,l=t.y),"colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;const n=e.createLinearGradient(r,s,a,l);for(const e of t)n.addColorStop(e.offset,e.color);return n}const c=e.createLinearGradient(r,s,a,l),[u,d,h]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}(e,n);return c.addColorStop(0,`rgba(${u},${d},${h},${o.topOpacity})`),c.addColorStop(1,`rgba(${u},${d},${h},${o.bottomOpacity})`),c}const zt=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Et(e,t);else if(t.roundedTop&&t.roundedTop>0){const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:s,w:a,h:l}=t;switch(t.roundedEdge){case"right":e.moveTo(r,s),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r,s+l);break;case"left":e.moveTo(r+a,s),e.lineTo(r+i,s),e.arcTo(r,s,r,s+i,i),e.lineTo(r,s+l-i),e.arcTo(r,s+l,r+i,s+l,i),e.lineTo(r+a,s+l);break;case"bottom":e.moveTo(r,s),e.lineTo(r+a,s),e.lineTo(r+a,s+l-i),e.arcTo(r+a,s+l,r+a-i,s+l,i),e.lineTo(r+i,s+l),e.arcTo(r,s+l,r,s+l-i,i);break;default:e.moveTo(r,s+l),e.lineTo(r,s+i),e.arcTo(r,s,r+i,s,i),e.lineTo(r+a-i,s),e.arcTo(r+a,s,r+a,s+i,i),e.lineTo(r+a,s+l)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||It(e,"var(--semiotic-primary, #007bff)"),o="string"==typeof n?Ft(e,t,n):null;e.fillStyle=o||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Dt(e,t),e.globalAlpha=1}};function Et(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const qt=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?It(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Nt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Gt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Vt(e,t){const n=Y().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Xt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Vt(e,t)):(Gt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Gt(e,t),Wt(e,t)),e.globalAlpha=1}};const Yt=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?It(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Qt=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=It(e,n.style.stroke)||("string"==typeof n.style.fill?It(e,n.style.fill):n.style.fill)||It(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Ut(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Kt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Zt=null;function Jt(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Zt||(Zt=document.createElement("canvas")),Zt.width=e,Zt.height=e,Zt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const en=new Map;function tn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=en.get(n);if(void 0!==o)return o;const i=Jt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return en.set(n,i),i}function nn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function on(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function rn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const sn=e=>[Qt,...e],an={bar:sn([zt]),clusterbar:sn([zt]),point:sn([qt]),swarm:sn([qt]),pie:[Xt],donut:[Xt],boxplot:sn([(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=It(e,"var(--semiotic-primary, #007bff)"),a=It(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?It(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?It(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},qt]),violin:sn([Yt]),histogram:sn([zt]),ridgeline:sn([Yt]),timeline:sn([zt]),funnel:[zt,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=It(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Ut(i):null!=r?`${Ut(i)} (${Kt(r)})`:Ut(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ut(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[zt,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||It(e,"var(--semiotic-border, #999)"),o=tn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=It(e,"var(--semiotic-text, #333)"),s=It(e,"var(--semiotic-text-secondary, #666)");for(const t of i){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,a=!(!0===n.__barFunnelIsFirstStep)&&null!=i,l=a?rn(i):"",c=on(o);e.font="bold 13px sans-serif";const u=a?e.measureText(l).width:0;e.font="11px sans-serif";const d=e.measureText(c).width,h=Math.max(u,d)+12,g=a?32:17,p=n.__barFunnelLabelX,y=p-h/2,f=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),nn(e,y,f,h,g,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),nn(e,y,f,h,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",a?(e.font="bold 13px sans-serif",e.fillStyle=r,e.fillText(l,p,f+3),e.font="11px sans-serif",e.fillStyle=s,e.fillText(c,p,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=r,e.fillText(c,p,f+3))}e.lineWidth=1}],swimlane:sn([zt])},ln={top:50,right:40,bottom:60,left:70},cn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function un({hover:n}){var o,i,r,s,a,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:["n = ",u.n]}),e("div",{children:["Min: ",u.min.toLocaleString()]}),e("div",{children:["Q1: ",u.q1.toLocaleString()]}),e("div",{children:["Median: ",u.median.toLocaleString()]}),e("div",{children:["Q3: ",u.q3.toLocaleString()]}),e("div",{children:["Max: ",u.max.toLocaleString()]}),e("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return e("div",{className:"semiotic-tooltip",style:cn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:cn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,p=n.__chartType;if("swarm"===p||"point"===p){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const y=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",f=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!y&&""===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:cn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:cn,children:[y&&t("div",{style:{fontWeight:"bold"},children:y+""}),""!==f&&t("div",{children:"number"==typeof f?f.toLocaleString():f+""})]})}const dn=h(function(n,a){var l,u,h,p,y,f,m,v,b,x;const{chartType:w,runtimeMode:A,data:k,oAccessor:O="category",rAccessor:j="value",colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:P,valueAccessor:L,categoryAccessor:T,projection:B="vertical",size:I=[600,400],responsiveWidth:H,responsiveHeight:R,margin:$,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,rExtent:re,oExtent:se,extentPadding:ae=.05,oSort:le,windowMode:ce="sliding",windowSize:ue=200,pieceStyle:de,summaryStyle:he,colorScheme:ge,barColors:pe,showAxes:ye=!0,showCategoryTicks:ve,categoryLabel:Se,valueLabel:_e,categoryFormat:Ce,valueFormat:Me,oLabel:Pe,rLabel:Le,oFormat:Te,rFormat:Be,rTickValues:Ie,tickLabelEdgeAlign:He,enableHover:Re=!0,hoverAnnotation:$e,tooltipContent:De,customHoverBehavior:Ne,annotations:We,svgAnnotationRules:Fe,showGrid:ze=!1,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,backgroundGraphics:et,foregroundGraphics:nt,title:ot,className:it,background:rt,centerContent:st,decay:at,pulse:lt,transition:ct,animate:pt,staleness:mt,brush:vt,onBrush:xt,accessibleTable:wt=!0,description:At,summary:kt}=n,Ot=s(!0),jt=Rt({sizeProp:I,responsiveWidth:H,responsiveHeight:R,userMargin:$,marginDefault:ln,foregroundGraphics:nt,backgroundGraphics:et,animate:pt,transitionProp:ct,themeDirtyRef:Ot}),{reducedMotionRef:St,responsiveRef:_t,size:Ct,margin:Mt,adjustedWidth:Pt,adjustedHeight:Lt,resolvedForeground:Tt,resolvedBackground:Bt,currentTheme:It,transition:Ht,introEnabled:$t,tableId:Dt,rafRef:Nt,renderFnRef:Wt,scheduleRender:Ft}=jt,zt=null!=Se?Se:Pe,Et=null!=_e?_e:Le,qt=null!=Ce?Ce:Te,Gt=null!=Me?Me:Be,Vt=s(null),Xt=s(null),[Yt,Qt]=d(null),[Ut,Kt]=d(null),[Zt,Jt]=d(0),[en,tn]=d(!1),nn=Re||$e,on="streaming"===A,rn=r(()=>{var e,t,n;return{chartType:w,runtimeMode:on?"streaming":"bounded",windowSize:ue,windowMode:ce,extentPadding:ae,projection:B,oAccessor:on?void 0:O,rAccessor:on?void 0:j,colorAccessor:S,stackBy:_,groupBy:C,multiAxis:M,timeAccessor:on?P:void 0,valueAccessor:on?L||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:on?T||O:void 0,rExtent:re,oExtent:se,barPadding:D,roundedTop:N,gradientFill:W,baselinePadding:F,innerRadius:z,cornerRadius:E,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Q,showOutliers:U,showIQR:K,amplitude:Z,connectorOpacity:ee,showLabels:te,connectorAccessor:ne,connectorStyle:oe,dataIdAccessor:ie,oSort:le,pieceStyle:de,summaryStyle:he,colorScheme:ge,themeCategorical:null===(e=null==It?void 0:It.colors)||void 0===e?void 0:e.categorical,themeSemantic:bt(It),themeSequential:null===(t=null==It?void 0:It.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==It?void 0:It.colors)||void 0===n?void 0:n.diverging,barColors:pe,decay:at,pulse:lt,transition:Ht,introAnimation:$t,staleness:mt}},[w,ue,ce,ae,B,O,j,S,_,C,M,P,L,T,re,se,D,N,W,F,z,E,q,G,V,X,Q,U,K,Z,ee,te,ne,oe,ie,le,de,he,ge,pe,at,lt,null==Ht?void 0:Ht.duration,null==Ht?void 0:Ht.easing,$t,mt,on,It]),sn=s(null);sn.current||(sn.current=new fe(rn)),i(()=>{var e;null===(e=sn.current)||void 0===e||e.updateConfig(rn),Ot.current=!0,Ft()},[rn,Ft]);const cn=s(null);cn.current||(cn.current=new J(e=>{const t=sn.current;t&&t.ingest(e)&&(Ot.current=!0,Ft())}));const dn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.push(e)},[]),hn=c(e=>{var t;null===(t=cn.current)||void 0===t||t.pushMany(e)},[]),gn=c(()=>{var e,t;null===(e=cn.current)||void 0===e||e.clear(),null===(t=sn.current)||void 0===t||t.clear(),Ot.current=!0,Ft()},[Ft]),pn=c(e=>{var t,n;null===(t=cn.current)||void 0===t||t.clearLastData(),null===(n=cn.current)||void 0===n||n.setReplacementData(e)},[]);g(a,()=>({push:dn,pushMany:hn,replace:pn,remove:e=>{var t,n,o,i;null===(t=cn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=sn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Xt.current)||void 0===i?void 0:i.data;!!Xt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Xt.current=null,Qt(null)),Ot.current=!0,Ft()}return r},update:(e,t)=>{var n,o,i;null===(n=cn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=sn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ot.current=!0,Ft()),r},clear:gn,getData:()=>{var e,t,n;return null===(e=cn.current)||void 0===e||e.flush(),null!==(n=null===(t=sn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=sn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[dn,hn,pn,gn,Ft]),i(()=>{var e;k&&(null===(e=cn.current)||void 0===e||e.setBoundedData(k))},[k]);const{hoverHandlerRef:yn,hoverLeaveRef:fn,onPointerMove:mn,onPointerLeave:vn}=jt;yn.current=e=>{if(!nn)return;const t=Vt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Mt.left,i=e.clientY-n.top-Mt.top;if(0>o||o>Pt||0>i||i>Lt)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const r=sn.current;if(!r||0===r.scene.length)return;const s="radial"===B,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-n,a=Math.sqrt(r*r+s*s);me(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":e=be(r,t,n);break;case"point":if(i)break;e=xe(r,t,n,o);break;case"wedge":e=we(r,t,n);break;case"boxplot":e=Ae(r,t,n);break;case"violin":e=ke(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Pt/2:o,s?i-Lt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Xt.current&&(Xt.current=null,Qt(null),Ne&&Ne(null),Ft()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Xt.current=l,Qt(l),Ne&&(Ne(l),Ot.current=!0),Ft()},fn.current=()=>{Xt.current&&(Xt.current=null,Qt(null),Ne&&(Ne(null),Ot.current=!0),Ft())};const bn=s(-1),xn=s(null),wn=s(null),An=c(e=>{const t=sn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(wn.current&&wn.current.version===n)o=wn.current.graph;else{const e=function(e){var t,n,o,i;const r=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";r.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)r.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(i=s.group)&&void 0!==i?i:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;r.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return r.sort((e,t)=>e.x-t.x||e.y-t.y),r}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),wn.current={version:n,graph:o}}const i=bn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bn.current=0;const t=o.flat[0];xn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},je(t)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});return Xt.current=n,Qt(n),Ne&&Ne(n),void Ft()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Oe(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Oe(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return bn.current=-1,xn.current=null,Xt.current=null,Qt(null),Ne&&Ne(null),void Ft();bn.current=s;const a=o.flat[s];xn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},je(a)),{__oAccessor:"string"==typeof O?O:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:w});Xt.current=l,Qt(l),Ne&&Ne(l),Ft()},[Ne,Ft]),kn=c(e=>{bn.current=-1,xn.current=null,mn(e)},[mn]);Wt.current=()=>{var e,t;Nt.current=0;const n=Vt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=sn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(St.current?r+1e6:r),a=!St.current&&s,l=Ot.current;l&&!s&&(i.computeScene({width:Pt,height:Lt}),Ot.current=!1),(l||a)&&n.setAttribute("aria-label",tt(i.scene,w+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Ct[0]*c,d=Ct[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ct[0]+"px",n.style.height=Ct[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ct[0],Ct[1]);const h=null!==(e=null==mt?void 0:mt.threshold)&&void 0!==e?e:5e3,g=mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==mt?void 0:mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,Ct[0],Ct[1]))}const p="radial"===B;o.save(),o.beginPath(),o.rect(Mt.left,Mt.top,Pt,Lt),o.clip(),p?(o.save(),o.translate(Mt.left+Pt/2,Mt.top+Lt/2)):o.translate(Mt.left,Mt.top);const y=an[w]||[],f={width:Pt,height:Lt};for(const e of y)e(o,i.scene,i.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Kt(i.scales),Jt(e=>e+1)),(null==mt?void 0:mt.showBadge)&&tn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Wt.current()))},i(()=>(Ft(),()=>{var e;null===(e=cn.current)||void 0===e||e.clear()}),[Ft]),i(()=>{Ot.current=!0,Ft()},[w,Pt,Lt,ye,rt,Ft]),function(e,t,n,o,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(mt,sn,Ot,Ft,en,tn);const On=nn&&Yt?De?De(Yt):t(un,{hover:Yt}):null,jn="radial"===B,Sn=On?t(ft,{x:Yt?jn?Yt.x+Pt/2:Yt.x:0,y:Yt?jn?Yt.y+Lt/2:Yt.y:0,containerWidth:Pt,containerHeight:Lt,margin:Mt,className:"stream-ordinal-tooltip",children:On}):null;if(Ze){const n=sn.current;n&&k&&(n.ingest({inserts:k,bounded:!0}),n.computeScene({width:Pt,height:Lt}));const i=null!==(l=null==n?void 0:n.scene)&&void 0!==l?l:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,s="radial"===B,a=s?Mt.left+Pt/2:Mt.left,c=s?Mt.top+Lt/2:Mt.top;return e("div",{className:"stream-ordinal-frame"+(it?" "+it:""),role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:Ct[0],height:Ct[1]},children:[t(dt,{summary:kt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[Bt&&t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt}),e("g",{transform:`translate(${a},${c})`,children:[rt&&t("rect",{x:0,y:0,width:Pt,height:Lt,fill:rt}),i.map((n,i)=>function(n,i){var r,s,a,l,c;const u=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",d=e=>`ord-${n.type}-${u}-${i}-${e}`,h=`ord-${n.type}-${u}-${i}`;switch(n.type){case"rect":{const i=n,r=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(h)+"-grad",s=function(e,n){const o=e.fillGradient;if(!o)return null;let i=e.x,r=e.y,s=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,s=e.x,a=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,s=e.x+e.w,a=e.y);const l=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=Ke(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Ke(i.style.fill);if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:d,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:Ke(e.style.fill),opacity:null!==(r=e.style.opacity)&&void 0!==r?r:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}case"wedge":{const e=n,o=Y().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&o.cornerRadius(e.cornerRadius);const i=o({})||"";return t("path",{d:i,transform:`translate(${e.cx},${e.cy})`,fill:Ke(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Ke(o.style.fill),fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Ke(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:Ke(e.style.fill),fillOpacity:null!==(l=e.style.fillOpacity)&&void 0!==l?l:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},d("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med"))):o.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},d("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},d("med")))}return t("g",{children:o},h)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(c=n.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:Ke(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(n,i)).filter(Boolean)]})]}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:r,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,rTickValues:Ie,tickLabelEdgeAlign:He,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:0,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==n?void 0:n.getData()}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st})]})}return e("div",{ref:_t,className:"stream-ordinal-frame"+(it?" "+it:""),role:"group","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:H?"100%":Ct[0],height:R?"100%":Ct[1],overflow:"visible"},onKeyDown:An,children:[wt&&t(ht,{tableId:Dt}),wt&&t(ut,{scene:null!==(p=null===(h=sn.current)||void 0===h?void 0:h.scene)&&void 0!==p?p:[],chartType:w+" chart",tableId:Dt,chartTitle:"string"==typeof ot?ot:void 0}),t(dt,{summary:kt}),e("div",{role:"img","aria-label":At||("string"==typeof ot?ot:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nn?kn:void 0,onMouseLeave:nn?vn:void 0,children:[Bt&&t("svg",{style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Mt.left},${Mt.top})`,children:Bt})}),t(Xe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showGrid:ze,rFormat:Gt,rTickValues:Ie}),t("canvas",{ref:Vt,"aria-label":tt(null!==(f=null===(y=sn.current)||void 0===y?void 0:y.scene)&&void 0!==f?f:[],w+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),t(gt,{hoverPoint:Yt}),t(Qe,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,showAxes:ye,showCategoryTicks:ve,oLabel:zt,rLabel:Et,oFormat:qt,rFormat:Gt,showGrid:ze,title:ot,legend:Ee,legendHoverBehavior:qe,legendClickBehavior:Ge,legendHighlightedCategory:Ve,legendIsolatedCategories:Ye,legendPosition:Je,foregroundGraphics:Tt,annotations:We,svgAnnotationRules:Fe,annotationFrame:Zt,xAccessor:"string"==typeof O?O:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(m=sn.current)||void 0===m?void 0:m.getData(),underlayRendered:!0}),(vt||xt)&&"radial"!==B&&t(Ue,{width:Pt,height:Lt,totalWidth:Ct[0],totalHeight:Ct[1],margin:Mt,scales:Ut,onBrush:xt||(()=>{})}),st&&"radial"===B&&t("div",{style:{position:"absolute",left:Mt.left+Pt/2,top:Mt.top+Lt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:st}),(null==mt?void 0:mt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===mt.badgePosition?{top:4,left:4}:"bottom-left"===mt.badgePosition?{bottom:4,left:4}:"bottom-right"===mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:en?"#dc3545":"#28a745",color:"white"}),children:en?"STALE":"LIVE"}),t(yt,{active:bn.current>=0,hoverPoint:Yt,margin:Mt,size:Ct,shape:null===(v=xn.current)||void 0===v?void 0:v.shape,width:null===(b=xn.current)||void 0===b?void 0:b.w,height:null===(x=xn.current)||void 0===x?void 0:x.h}),Sn]})]})});dn.displayName="StreamOrdinalFrame";const hn=a(null);function gn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function pn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[yn,fn]=mt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=pn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[mn,vn]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let bn={positions:new Map};const xn=new Set;function wn(){for(const e of xn)e()}function An(e,t){const n=bn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}function kn(e){const t=p(),n=e.clientId||t,{name:o}=e,i=fn(e=>e.selections.get(o)),s=fn(e=>e.setClause),a=fn(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(gn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:c(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:c(()=>{a(o,n)},[a,o,n]),clientId:n}}const On=a(!1);function jn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):le[r%le.length];return{label:i+"",color:a}}),label:""}]}}function Sn(e,t,n){return t?o=>{var i;const r=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function _n(){return St(e=>e.theme)}function Cn(){var e;const t=_n(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Mn(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=se[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}function Pn(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const Ln={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Tn(e,t,n){var o,i,r,s,a,l,c;const u=Ln[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Bn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Bn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function In(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}const Hn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Rn(e,t){return"function"==typeof t?t(e):e[t]}function $n(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Dn(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Rn(n,i);l=$n(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Rn(n,o);c.push({label:t,value:$n(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=$n(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=$n(n[e[0]],r))}}const u=Object.assign(Object.assign({},Hn),s);return e("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[l&&t("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((t,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function Nn(e){if(!0===e)return Dn();if("function"==typeof e){const n=e;return e=>{const o=n(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==o?null:t("div",{className:"semiotic-tooltip",style:Hn,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Dn(e):Dn())}function Wn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Fn(e,t){if(!t)return Wn(e);try{const n=t(e);return null==n?Wn(e):n}catch(t){return Wn(e)}}function zn(e,t){return"function"==typeof t?t(e):e[t]}function En({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const u=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=zn(u,n),h=zn(u,o),g=i?zn(u,i):void 0;return e("div",{className:"semiotic-tooltip",style:Hn,children:[t("div",{style:{fontWeight:"bold"},children:Wn(d)}),t("div",{style:{marginTop:4},children:Fn(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(p=i,"string"==typeof p?p:"value"),": ",Wn(g)]})]});var p}}function qn({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return t("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400},children:[t("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&t("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class Gn extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(qn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Vn(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Xn(e,t,n=3){let o,i=n+1;for(const n of t){const t=Vn(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}function Yn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Qn(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Xn(e,t,3))&&void 0!==n?n:null)}function Un({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=Yn(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Qn(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Kn={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Zn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Jn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},eo=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],to=["vertical","horizontal"],no={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:eo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:to},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:to},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Kn),Jn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Kn),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Kn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:to},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Kn),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Kn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Kn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Kn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function oo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const io=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ro=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),so=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ao=new Set(["LineChart","AreaChart","StackedAreaChart"]),lo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function co(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,i]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],r=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*r(n)+.7152*r(o)+.0722*r(i)}function uo(e,t){const n=co(e),o=co(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const ho=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function go(e,t){const n=[],o=function(e,t){const n=[],o=no[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(no).join(", ")}`]};for(const i of o.required)null==t[i]&&n.push(`"${i}" is required for ${e}.`);for(const[e,i]of Object.entries(t)){if(null==i)continue;const t=o.props[e];if(t){if(!oo(i,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(i)?"array":typeof i}.`);continue}t.enum&&"string"==typeof i&&!t.enum.includes(i)&&n.push(`"${e}" value "${i}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const i=Object.keys(o.props),r=new Set(i);for(const o of Object.keys(t))if(void 0!==t[o]&&!r.has(o)){const t=Xn(o,i),r=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${i.join(", ")}.`;n.push(r)}if("array"===o.dataShape){const i=t.data,r={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(r[e]=n)}const s=Un({componentName:e,data:i,accessors:Object.keys(r).length>0?r:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const i=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const n=Yn(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Qn(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});i&&n.push(i)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return no[e]?(function(e,t,n){const o=no[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,i=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===i||"number"==typeof i&&i>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(i)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=no[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=Object.keys(r);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in r||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){io.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){ro.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=no[e];if(!o||"array"!==o.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const r=i[0];if(!r||"object"!=typeof r)return;const s=t.xAccessor;"string"==typeof s&&r[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!so.has(e))return;const i=t.rExtent||t.yExtent;i&&Array.isArray(i)&&i.length>=1&&null!=i[0]&&0!==i[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${i[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=i[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!ao.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=t.yAccessor||"y";"string"==typeof i&&o.some(e=>{const t=e[i];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${i}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,i;const r=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(i=t.height)&&void 0!==i?i:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);r>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${r}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const i=no[e];if(!i||"array"!==i.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(r.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const i=null===(o=r[n])||void 0===o?void 0:o[e.name];if("number"==typeof i&&Number.isFinite(i)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!lo.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const i=o.bottom;"number"==typeof i&&70>i&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${i}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const i=t.margin;if(!i||"object"!=typeof i)return;const r=i.right;"number"==typeof r&&100>r&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${r}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const i=o[0];if(i&&"object"==typeof i)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const r=i[o];"string"==typeof r&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${r}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const i="string"==typeof t.background?t.background:"#ffffff";if(!i.startsWith("#"))return;const r=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=uo(e,i);null!==t&&3>t&&r.push(`${e} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${r.length} color(s) in colorScheme have < 3:1 contrast against background "${i}": ${r.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const i=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>i.length)return;const r=[];for(let e=0;i.length-1>e;e++){const t=uo(i[e],i[e+1]);null!==t&&1.5>t&&r.push(`${i[e]} / ${i[e+1]} (${t.toFixed(1)}:1)`)}r.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${r.length} adjacent color pair(s) in colorScheme have very similar luminance: ${r.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,i="string"==typeof t.description&&t.description.trim().length>0,r="string"==typeof t.summary&&t.summary.trim().length>0;o||i||r||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of ho)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var po;const yo="undefined"!=typeof process&&"production"!==(null===(po=process.env)||void 0===po?void 0:po.NODE_ENV);function fo({componentName:e,width:n,height:o,chartProps:i,children:r}){return t(Gn,{fallback:r=>{let s="";if(yo&&i)try{const t=go(e,i);t.ok||(s=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return t(qn,{componentName:e,message:r.message,diagnosticHint:s,width:n,height:o})},children:r})}const mo={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},vo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function bo(e,t,n,o){if(!yo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function xo(e){const{data:n,rawData:o,colorBy:s,colorScheme:a,legendInteraction:u,legendPosition:h,selection:g,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:C,height:M}=e,P="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:L,hoverSelectionHook:T,customHoverBehavior:B,customClickBehavior:I,crosshairSourceId:H}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:s,chartType:a,chartId:l,onClick:u,hoverHighlight:h,colorByField:g}){const y=p(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,n),m=kn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=kn({name:t});return{onHover:c(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||n||[]}),b=vn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=d(null),k=g||n[0],O=r(()=>{if(!h||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,k]),j=c(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=bn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n})},wn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&An(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(h&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,f,y,s,a,l,b,h,k]),S=c(e=>{var t,n,o,i;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=bn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(bn.positions);return t.delete(e),bn={positions:t},wn(),!1}bn={positions:new Map(bn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wn()}(f.name||"hover",Number(n),y)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[u,s,b,a,l,f,y]);return i(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=bn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(bn.positions);o.delete(e),bn={positions:o},wn()}(e,y),An(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:g,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),R=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,H),$=function(e,t,n){const o=l(hn),i=Cn();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=de(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return de(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=de(e,t,s);return e=>o[e]||n(e)}return de(e,t,s)}if(o&&Object.keys(o).length>0){const e=de([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(n,s,a),D=r(()=>{if(!s)return[];const e=new Set;for(const t of n){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[n,s]),N=function(e,t,n){const[o,i]=d(null),[s,a]=d(new Set),l=c(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=c(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:u,legendSelectionHook:h}}(u,s,D),W=r(()=>T||(N.legendSelectionHook?N.legendSelectionHook:L),[T,N.legendSelectionHook,L]),F=function(e){const t=St(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),{legend:z,margin:E,legendPosition:q}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:c}){const u=l(On),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(!d||!t)return;const o=jn({data:e,colorBy:t,colorScale:n,getColor:ue,categories:c});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,c]),g=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return h&&("right"===i&&110>t.right?t.right=110:"left"===i&&110>t.left?t.left=110:"top"===i&&50>t.top?t.top=50:"bottom"===i&&80>t.bottom&&(t.bottom=80)),t},[a,s,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:n,colorBy:s,colorScale:$,showLegend:w,legendPosition:h,userMargin:A,defaults:k}),G=r(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),u&&"none"!==u&&(e.legendHoverBehavior=N.onLegendHover,e.legendClickBehavior=N.onLegendClick,e.legendHighlightedCategory=N.highlightedCategory,e.legendIsolatedCategories=N.isolatedCategories),e},[z,q,u,N.onLegendHover,N.onLegendClick,N.highlightedCategory,N.isolatedCategories]),V=function(e,n,o){if(!e)return null;const i=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),a=Math.floor((o-(i*(r+s)-s))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},vo),{position:"absolute",top:a+o*(r+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}(S,C,M),X=V?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},mo),{width:n,height:o}),children:i||"No data available"}):null}(o,C,M,_);return{colorScale:$,allCategories:D,legendState:N,effectiveSelectionHook:W,activeSelectionHook:L,customHoverBehavior:B,customClickBehavior:I,legend:z,margin:E,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:R,resolvedSelection:F}}const wo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,gradientFill:x=!1,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=xo({data:Z,rawData:a,colorBy:y,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"BarChart",chartId:P,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:z,height:E});if(J.earlyReturn)return J.earlyReturn;bo("BarChart",Z,"categoryAccessor",u),bo("BarChart",Z,"valueAccessor",d);const ee=Pn(Z,m,d),te=Cn(),ne=r(()=>new Map,[Z]),oe=r(()=>(e,t)=>{const n={};return n.fill=y?ue(e,y,J.colorScale):Mn(H,te,f,void 0,ne),n},[y,J.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},oe(t,n)),e(t,n)||{}):oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[u,d,y,p]),ae=Un({componentName:"BarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(qn,{componentName:"BarChart",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v}),null!=b&&{roundedTop:b}),x&&{gradientFill:!0===x?{topOpacity:.8,bottomOpacity:.05}:x}),F&&{dataIdAccessor:F}),{baselinePadding:w,enableHover:q,showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:p}),W&&{oFormat:W}),{showGrid:G,showCategoryTicks:N,oSort:m}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||se}),(S||_||C||M)&&{customHoverBehavior:J.customHoverBehavior}),(_||C||S)&&{customClickBehavior:J.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"BarChart",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});function Ao({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const a=s(new Set),l=s([]),[u,h]=d(0),g=c(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=c(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||a.current.has(t)||(a.current.add(t),l.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=c(e=>t=>{p([t]),e(t)},[p]),f=c(e=>t=>{p(t),e(t)},[p]),m=c(()=>{a.current=new Set,l.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!t||!1===o)return;const i=l.current;if(0===i.length)return;const r=Array.isArray(n)?n:le,s=new Map;for(let e=0;i.length>e;e++)s.set(i[e],r[e%r.length]);const a="string"==typeof t?t:"__streamCat";return jn({data:i.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ue})},[e,t,o,n,u]),b=r(()=>{if(v)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[v,i]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function ko({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const u=Ao({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a}),d=c(u.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[u.wrapPush]),h=c(u.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[u.wrapPushMany]);return g(e,()=>({push:d,pushMany:h,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;u.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[d,h,u.resetCategories]),{effectiveLegendProps:r(()=>u.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:u.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,u.streamingLegend,a]),effectiveMargin:r(()=>{if(u.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(u.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,u.streamingMarginAdjust])}}wo.displayName="BarChart";const Oo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,stroke:R,strokeWidth:$,opacity:D,categoryFormat:N}=e,W=o.width,F=o.height,z=o.enableHover,E=o.showGrid,q=o.showLegend,G=o.title,V=o.description,X=o.summary,Y=o.accessibleTable,Q=o.categoryLabel,U=o.valueLabel,K=a||[],Z=y||d,J=void 0===a,ee=xo({data:K,rawData:a,colorBy:Z,colorScheme:f,legendInteraction:B,legendPosition:I,selection:j,linkedHover:S,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:L,emptyContent:T,width:W,height:F});if(ee.earlyReturn)return ee.earlyReturn;const te=Cn(),ne=r(()=>new Map,[K]),oe=r(()=>(e,t)=>Z?ee.colorScale?{fill:ue(e,Z,ee.colorScale)}:{}:{fill:Mn(H,te,f,t,ne)},[Z,ee.colorScale,H,te,f,ne]),ie=r(()=>{const e=null==O?void 0:O.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>{const o=oe(t,n),i=e(t,n)||{};return Object.assign(Object.assign({},o),i)}:oe,{stroke:R,strokeWidth:$,opacity:D})},[oe,O,R,$,D]),re=r(()=>Sn(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Un({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=ko({ref:n,frameRef:i,isPushMode:J,colorBy:Z,colorScheme:f,showLegend:q,legendPosition:I,setup:ee}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[W,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:p}),N&&{oFormat:N}),{showGrid:E}),le),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||se}),(S||_||C||M)&&{customHoverBehavior:ee.customHoverBehavior}),(_||C||S)&&{customClickBehavior:ee.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?t(qn,{componentName:"StackedBarChart",message:ae,width:W,height:F}):t(fo,{componentName:"StackedBarChart",width:W,height:F,children:t(dn,Object.assign({ref:i},de))})});Oo.displayName="StackedBarChart";const jo=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.showLegend,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,Q=o.valueLabel,U=a||[],K=y||d,Z=void 0===a,J=xo({data:U,rawData:a,colorBy:K,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:M,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=Cn(),te=r(()=>new Map,[U]),ne=k.pieceStyle,oe=r(()=>(e,t)=>{const n=K?J.colorScale?{fill:ue(e,K,J.colorScale)}:{}:{fill:Mn(I,ee,f,t,te)};if(ne){const o=ne(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[K,J.colorScale,I,ee,f,te,ne]),ie=r(()=>In(oe,{stroke:H,strokeWidth:R,opacity:$}),[oe,H,R,$]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ae=Un({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=ko({ref:n,frameRef:i,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:E,legendPosition:B,setup:J}),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:U}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Y,rLabel:Q,rFormat:p}),D&&{oFormat:D}),{showGrid:z}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Nn(w)||se}),(j||S||_||C)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?t(qn,{componentName:"GroupedBarChart",message:ae,width:N,height:W}):t(fo,{componentName:"GroupedBarChart",width:N,height:W,children:t(dn,Object.assign({ref:i},de))})});function So({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=kn({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=c(e=>{if(!e)return void l();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,n,o,a,l]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof o?o:"value")}),u=s(l.brushInteraction);u.current=l.brushInteraction;const d=c(e=>{if(i){u.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}jo.displayName="GroupedBarChart";const _o=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.showLegend,X=o.title,Y=o.description,Q=o.summary,U=o.accessibleTable,K=o.categoryLabel,Z=o.valueLabel,J=a||[],ee=y||d,te=void 0===a,ne=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(J.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?E:z)-2*n)/(n-1))):1},[m,e.mode,J,u,g,z,E]),oe=xo({data:J,rawData:a,colorBy:ee,colorScheme:f,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:z,height:E}),ie=So({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(oe.earlyReturn)return oe.earlyReturn;const re=Cn(),se=r(()=>new Map,[J]),ae=k.pieceStyle,le=r(()=>(e,t)=>{const n=ee?oe.colorScale?{fill:ue(e,ee,oe.colorScale)}:{}:{fill:Mn(I,re,f,t,se)};if(ae){const o=ae(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[ee,oe.colorScale,I,re,f,se,ae]),ce=r(()=>In(le,{stroke:H,strokeWidth:R,opacity:$}),[le,H,R,$]),de=r(()=>Sn(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),he=r(()=>En({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ge=Un({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:pe,effectiveMargin:ye}=ko({ref:n,frameRef:i,isPushMode:te,colorBy:ee,colorScheme:f,showLegend:V,legendPosition:B,setup:oe}),fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:J}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ne,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===F?void 0:K,rLabel:Z,rFormat:p}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),D&&{oFormat:D}),void 0!==F&&{showCategoryTicks:F}),{showGrid:G}),pe),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==U&&{accessibleTable:U}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||he}),(j||S||_||C)&&{customHoverBehavior:oe.customHoverBehavior}),(S||_||j)&&{customClickBehavior:oe.customClickBehavior}),b&&b.length>0&&{annotations:b}),ie.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?t(qn,{componentName:"SwimlaneChart",message:ge,width:z,height:E}):t(fo,{componentName:"SwimlaneChart",width:z,height:E,children:t(dn,Object.assign({ref:i},fe))})});_o.displayName="SwimlaneChart";const Co=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:B,loading:I,emptyContent:H,legendInteraction:R,legendPosition:$,color:D,stroke:N,strokeWidth:W,opacity:F,showCategoryTicks:z,categoryFormat:E}=e,q=o.width,G=o.height,V=o.enableHover,X=o.showGrid,Y=o.title,Q=o.description,U=o.summary,K=o.accessibleTable,Z=o.categoryLabel,J=o.valueLabel,ee=a||[],te=xo({data:ee,rawData:a,colorBy:y,colorScheme:f,legendInteraction:R,legendPosition:$,selection:C,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:B,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:I,emptyContent:H,width:q,height:G}),ne=So({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:d});if(te.earlyReturn)return te.earlyReturn;const oe=r(()=>{if(!m)return;const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m]),ie=Cn(),re=r(()=>new Map,[ee]),se=_.pieceStyle,ae=r(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ue(e,y,te.colorScale):Mn(D,ie,f,void 0,re),n.r=m?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,v,oe):b,se){const o=se(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,te.colorScale,m,v,oe,b,x,D,ie,f,re,se]),le=r(()=>In(ae,{stroke:N,strokeWidth:W,opacity:F}),[ae,N,W,F]),ce=r(()=>Sn(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),de=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:y||void 0,valueFormat:p}),[u,d,y,p]),he=Un({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(he)return t(qn,{componentName:"SwarmPlot",message:he,width:q,height:G});const ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:w,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),E&&{oFormat:E}),{showGrid:X,showCategoryTicks:z}),te.legendBehaviorProps),Y&&{title:Y}),Q&&{description:Q}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===A?()=>null:Nn(A)||de}),(M||P||L||T)&&{customHoverBehavior:te.customHoverBehavior}),(P||L||M)&&{customClickBehavior:te.customClickBehavior}),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"SwarmPlot",width:q,height:G,children:t(dn,Object.assign({ref:i},ge))})});function Mo(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Hn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&e("div",{children:["n = ",s.n]}),null!=s.min&&e("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&e("div",{children:["Q1: ",s.q1.toLocaleString()]}),e("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&e("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&e("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&e("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return e("div",{className:"semiotic-tooltip",style:Hn,children:[r&&t("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&e("div",{children:["n = ",a]}),null!=l&&e("div",{children:["Median: ",l.toLocaleString()]})]})}return t("div",{className:"semiotic-tooltip",style:Hn,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}Co.displayName="SwarmPlot";const Po=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:B,strokeWidth:I,opacity:H,showCategoryTicks:R,categoryFormat:$}=e,D=o.width,N=o.height,W=o.enableHover,F=o.showGrid,z=o.title,E=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=a||[],Q=xo({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:C,emptyContent:M,width:D,height:N});if(Q.earlyReturn)return Q.earlyReturn;const U=Cn(),K=r(()=>new Map,[Y]),Z=r(()=>e=>{const t=y?ue(e,y,Q.colorScale):Mn(T,U,f,void 0,K);return{fill:t,stroke:t,fillOpacity:.8}},[y,Q.colorScale,T,U,f,K]),J=r(()=>In(Z,{stroke:B,strokeWidth:I,opacity:H}),[Z,B,I,H]),ee=r(()=>Sn(J,Q.effectiveSelectionHook,Q.resolvedSelection),[J,Q.effectiveSelectionHook,Q.resolvedSelection]),te=r(()=>Mo(),[]),ne=Un({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return t(qn,{componentName:"BoxPlot",message:ne,width:D,height:N});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:m,size:[D,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),$&&{oFormat:$}),{showGrid:F,showCategoryTicks:R}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===b?()=>null:Nn(b)||te}),(k||O||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(O||j||k)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"BoxPlot",width:D,height:N,children:t(dn,Object.assign({ref:i},oe))})});Po.displayName="BoxPlot";const Lo=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",bins:p=25,relative:y=!1,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=n,z=i.width,E=i.height,q=i.enableHover,G=i.showGrid,V=i.title,X=i.description,Y=i.summary,Q=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Z=l||[],J=xo({data:Z,rawData:l,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=So({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const te=r(()=>{if(0===Z.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Z){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[Z,h]),ne=Cn(),oe=r(()=>new Map,[Z]),ie=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Mn(R,ne,v,void 0,oe);return{fill:t,stroke:t,fillOpacity:.8}},[m,J.colorScale,R,ne,v,oe]),re=r(()=>In(ie,{stroke:$,strokeWidth:D,opacity:N}),[ie,$,D,N]),se=r(()=>Sn(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:Hn,children:[i&&t("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&e("div",{children:["Count: ",r]}),s&&2===s.length&&e("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]),le=Un({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return t(qn,{componentName:"Histogram",message:le,width:z,height:E});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:se,bins:p,normalize:y}),te&&{rExtent:te}),{size:[z,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||ae}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"Histogram",width:z,height:E,children:t(dn,Object.assign({ref:a},ce))})});Lo.displayName="Histogram";const To=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,emptyContent:B,legendInteraction:I,legendPosition:H,color:R,stroke:$,strokeWidth:D,opacity:N,showCategoryTicks:W,categoryFormat:F}=e,z=o.width,E=o.height,q=o.enableHover,G=o.showGrid,V=o.title,X=o.description,Y=o.summary,Q=o.accessibleTable,U=o.categoryLabel,K=o.valueLabel,Z=a||[],J=xo({data:Z,rawData:a,colorBy:m,colorScheme:v,legendInteraction:I,legendPosition:H,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:T,emptyContent:B,width:z,height:E}),ee=So({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:d});if(J.earlyReturn)return J.earlyReturn;const te=Cn(),ne=r(()=>new Map,[Z]),oe=r(()=>e=>{const t=m?ue(e,m,J.colorScale):Mn(R,te,v,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[m,J.colorScale,R,te,v,ne]),ie=r(()=>In(oe,{stroke:$,strokeWidth:D,opacity:N}),[oe,$,D,N]),re=r(()=>Sn(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=r(()=>Mo({valueAccessor:d}),[d]),ae=Un({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return t(qn,{componentName:"ViolinPlot",message:ae,width:z,height:E});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:p,showIQR:y,size:[z,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:b,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),J.legendBehaviorProps),V&&{title:V}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||se}),(_||C||M||P)&&{customHoverBehavior:J.customHoverBehavior}),(C||M||_)&&{customClickBehavior:J.customClickBehavior}),w&&w.length>0&&{annotations:w}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"ViolinPlot",width:z,height:E,children:t(dn,Object.assign({ref:i},le))})});To.displayName="ViolinPlot";const Bo=h(function(e,n){var o;const i=Tn(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null);g(n,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,loading:P,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,stroke:H,strokeWidth:R,opacity:$,categoryFormat:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=l||[],U=xo({data:Q,rawData:l,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"DotPlot",chartId:M,showLegend:i.showLegend,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Pn(Q,v,h),Z=Cn(),J=r(()=>new Map,[Q]),ee=k.pieceStyle,te=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ue(e,f,U.colorScale):Mn(I,Z,m,void 0,J),ee){const o=ee(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,U.colorScale,b,I,Z,m,J,ee]),ne=r(()=>In(te,{stroke:H,strokeWidth:R,opacity:$}),[te,H,R,$]),oe=r(()=>Sn(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),ie=r(()=>En({categoryAccessor:d,valueAccessor:h,valueFormat:y}),[d,h,y]),re=Un({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return t(qn,{componentName:"DotPlot",message:re,width:N,height:W});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:y}),D&&{oFormat:D}),{showGrid:z,oSort:v}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),u&&{className:u}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:Nn(w)||ie}),(j||S||_||C)&&{customHoverBehavior:U.customHoverBehavior}),(S||_||j)&&{customClickBehavior:U.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"DotPlot",width:N,height:W,children:t(dn,Object.assign({ref:a},se))})});Bo.displayName="DotPlot";const Io=h(function(e,n){var o,i;const a=Tn(e.mode,{width:null!==(o=e.width)&&void 0!==o?o:400,height:null!==(i=e.height)&&void 0!==i?i:400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks}),l=s(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=a.width,R=a.height,$=a.enableHover,D=a.showLegend,N=a.title,W=a.description,F=a.summary,z=a.accessibleTable,E=c||[],q=p||h,G=void 0===c,V=xo({data:E,rawData:c,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:D,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=Cn(),Y=r(()=>new Map,[E]),Q=r(()=>(e,t)=>q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Mn(L,X,y,t,Y)},[q,V.colorScale,L,X,y,Y]),U=r(()=>{const e=null==x?void 0:x.pieceStyle;return In(e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Q(t,n)),e(t,n)||{}):Q,{stroke:T,strokeWidth:B,opacity:I})},[Q,x,T,B,I]),K=r(()=>Sn(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),Z=r(()=>En({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),J=Un({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:ee,effectiveMargin:te}=ko({ref:n,frameRef:l,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:E}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||Z}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(qn,{componentName:"PieChart",message:J,width:H,height:R}):t(fo,{componentName:"PieChart",width:H,height:R,children:t(dn,Object.assign({ref:l},ne))})});Io.displayName="PieChart";const Ho=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:C,legendInteraction:M,legendPosition:P,color:L,stroke:T,strokeWidth:B,opacity:I}=e,H=o.width,R=o.height,$=o.enableHover,D=o.showLegend,N=o.title,W=o.description,F=o.summary,z=o.accessibleTable,E=a||[],q=p||u,G=void 0===a,V=xo({data:E,rawData:a,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:P,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:l,marginDefaults:o.marginDefaults,loading:_,emptyContent:C,width:H,height:R});if(V.earlyReturn)return V.earlyReturn;const X=null!=h?h:Math.max(2,.15*Math.min(H,R)),Y=Cn(),Q=r(()=>new Map,[E]),U=x.pieceStyle,K=r(()=>(e,t)=>{let n;if(n=q?V.colorScale?{fill:ue(e,q,V.colorScale)}:{}:{fill:Mn(L,Y,y,t,Q)},U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[q,V.colorScale,L,Y,y,Q,U]),Z=r(()=>In(K,{stroke:T,strokeWidth:B,opacity:I}),[K,T,B,I]),J=r(()=>Sn(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=r(()=>En({categoryAccessor:u,valueAccessor:d,groupAccessor:p&&p!==u?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[u,d,p]),te=Un({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:ne,effectiveMargin:oe}=ko({ref:n,frameRef:i,isPushMode:G,colorBy:q,colorScheme:y,showLegend:D,legendPosition:P,setup:V}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:E}),{oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:f}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[H,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,enableHover:$}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ne),N&&{title:N}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===v?()=>null:Nn(v)||ee}),(A||k||O||j)&&{customHoverBehavior:V.customHoverBehavior}),(k||O||A)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?t(qn,{componentName:"DonutChart",message:te,width:H,height:R}):t(fo,{componentName:"DonutChart",width:H,height:R,children:t(dn,Object.assign({ref:i},ie))})});Ho.displayName="DonutChart";const Ro=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!c,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_,stroke:C,strokeWidth:M,opacity:P}=n,L=i.width,T=i.height,B=i.title,I=i.description,H=i.summary,R=i.accessibleTable,$=Math.max(d,Math.min(h,u)),D=h-d||1,N=($-d)/D,{gaugeData:W,pieceStyle:F,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let i=d;for(let n=0;o.length>n;n++){const r=o[n],s=(r.value-i)/D;if(k){const o=(i-d)/D,a=Math.max(0,Math.min(N,(r.value-d)/D)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:r.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}i=r.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,N,D,w,k]),E=r(()=>In(F,{stroke:C,strokeWidth:M,opacity:P}),[F,C,M,P]),q=A*Math.PI/180,G=180+(360-A)/2,V=Math.min(10,Math.max(1,Math.min(L,T)/12)),X=-Math.PI/2+G*Math.PI/180,Y=[[Math.cos(X),Math.sin(X)],[Math.cos(X+q),Math.sin(X+q)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-X)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>q+.001||Y.push([Math.cos(e),Math.sin(e)]);const Q=Math.min(...Y.map(e=>e[0])),U=Math.max(...Y.map(e=>e[0])),K=Math.min(...Y.map(e=>e[1])),Z=Math.max(...Y.map(e=>e[1])),J=(K+Z)/2,ee=(Q+U)/2,te=Math.max(4,Math.min((L-2*V)/(U-Q),(T-2*V)/(Z-K))-2),ne=Math.max(0,Math.min(te-1.5,te*(1-f))),oe=L/2-ee*te,ie=T/2-J*te,re=2*(te+4),se=r(()=>{if(c&&null==b)return null;if(null!=b)return"function"==typeof b?b($,d,h):b;const n=x?x($):Math.round($)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*te),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),w&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[b,$,d,h,x,w,te,c]),ae=r(()=>l&&null==b?{type:"gauge-value",text:x?x($):Math.round($)+""}:null,[l,b,$,x]),le=r(()=>{if(!m)return null;const e=-Math.PI/2+G*Math.PI/180+N*q,t=ne>20?ne-8:te-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,N,G,q,ne,v]),ce=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||L)/2,s=(i.height||T)/2,a=Math.max(1,te-ne),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return e("g",{transform:`translate(${r},${s})`,children:[t("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const e=-Math.PI/2+G*Math.PI/180+(n.value-d)/D*q,r=ne-14,s=(i.height||T)/2;return t("text",{x:(i.width||L)/2+Math.cos(e)*r,y:s+Math.sin(e)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:n.label},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||L)/2,y:(i.height||T)/2-.2*ne,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*te)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[L,T,d,D,G,q,ne,te]),ue=r(()=>{const e=[...z,...j||[]];return le&&e.push(le),ae&&e.push(ae),e},[z,j,le,ae]),de=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return e("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[t("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),t("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round($):"Remaining"})]})},[$]);if(0===W.length)return t(qn,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:E,innerRadius:ne,startAngle:G,sweepAngle:A,centerContent:se,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ie-re/2,bottom:T-ie-re/2,left:oe-re/2,right:L-oe-re/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:Nn(O)||de,svgAnnotationRules:ce},ue.length>0&&{annotations:ue}),B&&{title:B}),I&&{description:I}),H&&{summary:H}),void 0!==R&&{accessibleTable:R}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),S);return t(fo,{componentName:"GaugeChart",width:L,height:T,children:t(dn,Object.assign({ref:a},he))})});Ro.displayName="GaugeChart";const $o=h(function(e,n){const o=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),i=s(null);g(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,showCategoryTicks:$,categoryFormat:D}=e,N=o.width,W=o.height,F=o.enableHover,z=o.showGrid,E=o.title,q=o.description,G=o.summary,V=o.accessibleTable,X=o.categoryLabel,Y=o.valueLabel,Q=a||[],U=xo({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:C,showLegend:o.showLegend,userMargin:l,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:N,height:W});if(U.earlyReturn)return U.earlyReturn;const K=Cn(),Z=r(()=>new Map,[Q]),J=r(()=>e=>{const t=m?ue(e,m,U.colorScale):Mn(B,K,v,void 0,Z);return{fill:t,stroke:t,fillOpacity:.5}},[m,U.colorScale,B,K,v,Z]),ee=r(()=>In(J,{stroke:I,strokeWidth:H,opacity:R}),[J,I,H,R]),te=r(()=>Sn(ee,U.effectiveSelectionHook,U.resolvedSelection),[ee,U.effectiveSelectionHook,U.resolvedSelection]),ne=r(()=>Mo(),[]),oe=Un({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return t(qn,{componentName:"RidgelinePlot",message:oe,width:N,height:W});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:Q}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:p,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:b,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:$,oSort:!1,amplitude:y}),U.legendBehaviorProps),E&&{title:E}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===x?()=>null:Nn(x)||ne}),(O||j||S||_)&&{customHoverBehavior:U.customHoverBehavior}),(j||S||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"RidgelinePlot",width:N,height:W,children:t(dn,Object.assign({ref:i},ie))})});$o.displayName="RidgelinePlot";const Do=h(function(n,o){const i=Tn(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);g(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:p,colorBy:y,colorScheme:f,orientation:m="horizontal",connectorOpacity:v=.3,showLabels:b=!0,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:C,loading:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:B,stroke:I,strokeWidth:H,opacity:R,categoryFormat:$}=n,D="vertical"===m,N=i.width,W=i.height,F=i.enableHover,z=i.title,E=i.description,q=i.summary,G=i.accessibleTable,V=l||[],X=y||p,Y=!X,Q=xo({data:V,rawData:l,colorBy:X,colorScheme:f,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"FunnelChart",chartId:C,showLegend:i.showLegend,userMargin:c,marginDefaults:D?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:P,width:N,height:W});if(Q.earlyReturn)return Q.earlyReturn;bo("FunnelChart",V,"stepAccessor",d),bo("FunnelChart",V,"valueAccessor",h);const U=Cn(),K=r(()=>new Map,[V]),Z=r(()=>{if(Y)return B||((null==U?void 0:U[0])?U[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Y,B,U,f]),J=A.pieceStyle,ee=r(()=>(e,t)=>{const n={};if(n.fill=Z||(X?ue(e,X,Q.colorScale):Mn(B,U,f,t,K)),J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Z,X,Q.colorScale,B,U,f,K,J]),te=r(()=>In(ee,{stroke:I,strokeWidth:H,opacity:R}),[ee,I,H,R]),ne=r(()=>Sn(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,p=null==c?void 0:c.__barFunnelIsDropoff,y=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,f=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return e("div",{className:"semiotic-tooltip",style:Hn,children:[u&&t("div",{style:{fontWeight:"bold"},children:u+""}),y&&y!==u&&t("div",{style:{marginTop:2,opacity:.8},children:y+""}),p&&t("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e("div",{style:{marginTop:4},children:[d+"",f]})]})},[]),ie=Un({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(ie)return t(qn,{componentName:"FunnelChart",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:D?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),p&&{stackBy:p}),{projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:ne,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:D,showCategoryTicks:D}),$&&{oFormat:$}),{showGrid:D}),!D&&{connectorOpacity:v}),{showLabels:b}),Q.legendBehaviorProps),z&&{title:z}),E&&{description:E}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===x?()=>null:!0===x||null==x?oe:Nn(x)||oe}),(O||j||S||_)&&{customHoverBehavior:Q.customHoverBehavior}),(j||S||O)&&{customClickBehavior:Q.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return t(fo,{componentName:"FunnelChart",width:N,height:W,children:t(dn,Object.assign({ref:a},re))})});Do.displayName="FunnelChart";const No={RdBu:H,PiYG:I,PRGn:B,BrBG:T,RdYlBu:L,RdYlGn:P,Spectral:M},Wo="__likert_neutral_neg",Fo="__likert_neutral_pos";function zo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Eo(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function qo(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Wo,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Fo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Go(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Wo?r=n:n.__likertLevel===Fo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Vo=h(function(e,n){const i=Tn(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation}),a=s(null),{data:l,margin:u,className:d,categoryAccessor:h="question",valueAccessor:p,levelAccessor:y,countAccessor:f="count",levels:m,orientation:v="horizontal",colorScheme:b,barPadding:x=20,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:C,chartId:M,valueFormat:P,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,categoryFormat:H,stroke:R,strokeWidth:$,opacity:D}=e,N=i.width,W=i.height,F=i.enableHover,z=i.showGrid,E=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,U="horizontal"===v,K=void 0===l,Z=!y,J=function(){var e;const t=_n();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=r(()=>b&&Array.isArray(b)&&b.length>=m.length?b:function(e,t){if(0>=e)return[];if(t){const n=No[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(m.length,J),[b,m.length,J]),te=r(()=>{const e=new Map;for(let t=0;m.length>t;t++)e.set(m[t],ee[t]||"#888");return e},[m,ee]),{processedData:ne,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:u}){const d=!i,h=r(()=>zo(n,"question"),[n]),g=r(()=>d?zo(o,"score"):null,[d,o]),p=r(()=>d?null:zo(i,"level"),[d,i]),y=r(()=>d?null:zo(a,"count"),[d,a]),f=e||[],m=s([]),v=r(()=>{if(0===f.length)return[];let e=Eo(f,t,h,g,p,y);return l&&(e=qo(e,t),e=Go(e,t)),e},[f,t,h,g,p,y,l]),b=c(e=>{var n;let o=Eo(e,t,h,g,p,y);l&&(o=qo(o,t),o=Go(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,l,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:m,categoryAccessor:h,valueAccessor:p,levelAccessor:y,countAccessor:f,isDiverging:U,frameRef:a}),re="__likertLevelLabel",se=Ao({isPushMode:K,colorBy:re,colorScheme:ee,showLegend:E,legendPosition:I}),ae=c(se.wrapPush(e=>{ie.current.push(e),oe(ie.current)}),[se.wrapPush,oe,ie]),le=c(se.wrapPushMany(e=>{ie.current.push(...e),oe(ie.current)}),[se.wrapPushMany,oe,ie]);g(n,()=>({push:ae,pushMany:le,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ie.current=[],se.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=xo({data:ne,rawData:l,colorBy:re,colorScheme:ee,legendInteraction:B,legendPosition:I,selection:O,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:C,chartType:"LikertChart",chartId:M,showLegend:E,userMargin:u,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:W});if(ce.earlyReturn)return ce.earlyReturn;const ue=r(()=>{const e=m.length;return e%2!=0&&te.get(m[Math.floor(e/2)])||"#888"},[m,te]),de=k.pieceStyle,he=r(()=>(e,t)=>{var n,o;const i=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),r=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(r===Wo||r===Fo)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const n=de(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[te,ue,de]),ge=r(()=>In(he,{stroke:R,strokeWidth:$,opacity:D}),[he,R,$,D]),pe=r(()=>Sn(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),ye=r(()=>{const e=m.length;return e%2!=0?m[Math.floor(e/2)]:""},[m]),fe=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Wo||n===Fo?ye:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Wo||n===Fo?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Hn},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ye]),me=r(()=>{if(!m||2>m.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Z?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),f&&(e.countAccessor=f)),Un({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:m}})},[l,h,p,y,f,m,Z]),ve=r(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:m.map(e=>({label:e})),label:""}],[m,te]),be=r(()=>!1!==E?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:I||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,I,E,ve]),xe=r(()=>{const e=Object.assign({},ce.margin);if(K&&!1!==E){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(se.streamingMarginAdjust)for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,U,K,E,I]),we=r(()=>P||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,P]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=l&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:pe,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe,barPadding:x,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q||(U?void 0:"Percentage"),rFormat:we}),H&&{oFormat:H}),{showGrid:z}),be),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=e.animate&&{animate:e.animate}),{tooltipContent:!1===w?()=>null:!0===w?fe:Nn(w)||fe}),(j||S||_||C)&&{customHoverBehavior:ce.customHoverBehavior}),(S||_||j)&&{customClickBehavior:ce.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return me?t(qn,{componentName:"LikertChart",message:me,width:N,height:W}):t(fo,{componentName:"LikertChart",width:N,height:W,children:t(dn,Object.assign({ref:a},Ae))})});Vo.displayName="LikertChart";export{wo as BarChart,Po as BoxPlot,Ho as DonutChart,Bo as DotPlot,Do as FunnelChart,Ro as GaugeChart,jo as GroupedBarChart,Lo as Histogram,Vo as LikertChart,Io as PieChart,$o as RidgelinePlot,Oo as StackedBarChart,dn as StreamOrdinalFrame,Co as SwarmPlot,_o as SwimlaneChart,To as ViolinPlot,Jt as createHatchPattern};