semiotic 3.0.0 → 3.0.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 (181) hide show
  1. package/CLAUDE.md +23 -10
  2. package/README.md +66 -63
  3. package/ai/cli.js +34 -21
  4. package/ai/dist/componentRegistry.js +2 -0
  5. package/ai/dist/mcp-server.js +54 -0
  6. package/ai/examples.md +75 -0
  7. package/ai/schema.json +71 -0
  8. package/ai/system-prompt.md +3 -0
  9. package/dist/{ChartGrid.d.ts → components/ChartGrid.d.ts} +9 -7
  10. package/dist/{LinkedCharts.d.ts → components/LinkedCharts.d.ts} +34 -1
  11. package/dist/{Tooltip → components/Tooltip}/Tooltip.d.ts +9 -2
  12. package/dist/{charts → components/charts}/index.d.ts +2 -0
  13. package/dist/{charts → components/charts}/network/ChordDiagram.d.ts +2 -0
  14. package/dist/{charts → components/charts}/network/CirclePack.d.ts +2 -0
  15. package/dist/{charts → components/charts}/network/ForceDirectedGraph.d.ts +2 -0
  16. package/dist/components/charts/network/OrbitDiagram.d.ts +78 -0
  17. package/dist/{charts → components/charts}/network/SankeyDiagram.d.ts +2 -0
  18. package/dist/{charts → components/charts}/network/TreeDiagram.d.ts +2 -0
  19. package/dist/{charts → components/charts}/network/Treemap.d.ts +2 -0
  20. package/dist/{charts → components/charts}/ordinal/BarChart.d.ts +2 -0
  21. package/dist/{charts → components/charts}/ordinal/BoxPlot.d.ts +2 -0
  22. package/dist/{charts → components/charts}/ordinal/DonutChart.d.ts +2 -0
  23. package/dist/{charts → components/charts}/ordinal/DotPlot.d.ts +2 -0
  24. package/dist/{charts → components/charts}/ordinal/GroupedBarChart.d.ts +2 -0
  25. package/dist/{charts → components/charts}/ordinal/PieChart.d.ts +2 -0
  26. package/dist/{charts → components/charts}/ordinal/StackedBarChart.d.ts +2 -0
  27. package/dist/{charts → components/charts}/ordinal/SwarmPlot.d.ts +2 -0
  28. package/dist/components/charts/shared/diagnoseConfig.d.ts +23 -0
  29. package/dist/{charts → components/charts}/shared/hooks.d.ts +23 -1
  30. package/dist/components/charts/shared/stringDistance.d.ts +11 -0
  31. package/dist/{charts → components/charts}/shared/tooltipUtils.d.ts +1 -1
  32. package/dist/{charts → components/charts}/shared/types.d.ts +6 -0
  33. package/dist/{charts → components/charts}/shared/withChartWrapper.d.ts +10 -0
  34. package/dist/{charts → components/charts}/xy/AreaChart.d.ts +8 -0
  35. package/dist/{charts → components/charts}/xy/BubbleChart.d.ts +8 -0
  36. package/dist/{charts → components/charts}/xy/ConnectedScatterplot.d.ts +3 -0
  37. package/dist/{charts → components/charts}/xy/Heatmap.d.ts +8 -0
  38. package/dist/{charts → components/charts}/xy/LineChart.d.ts +26 -0
  39. package/dist/{charts → components/charts}/xy/Scatterplot.d.ts +3 -0
  40. package/dist/{charts → components/charts}/xy/StackedAreaChart.d.ts +8 -0
  41. package/dist/{export → components/export}/exportChart.d.ts +6 -1
  42. package/dist/components/semiotic-ai.d.ts +61 -0
  43. package/dist/components/semiotic-data.d.ts +7 -0
  44. package/dist/components/semiotic-network.d.ts +14 -0
  45. package/dist/components/semiotic-ordinal.d.ts +18 -0
  46. package/dist/components/semiotic-realtime.d.ts +22 -0
  47. package/dist/components/semiotic-server.d.ts +1 -0
  48. package/dist/components/semiotic-xy.d.ts +16 -0
  49. package/dist/components/semiotic.d.ts +57 -0
  50. package/dist/{server → components/server}/renderToStaticSVG.d.ts +7 -0
  51. package/dist/{stream → components/stream}/NetworkSVGOverlay.d.ts +20 -0
  52. package/dist/{stream → components/stream}/OrdinalSVGOverlay.d.ts +8 -0
  53. package/dist/{stream → components/stream}/PipelineStore.d.ts +7 -0
  54. package/dist/{stream → components/stream}/SVGOverlay.d.ts +15 -0
  55. package/dist/components/stream/SceneToSVG.d.ts +20 -0
  56. package/dist/components/stream/hitTestUtils.d.ts +23 -0
  57. package/dist/{stream → components/stream}/networkTypes.d.ts +10 -2
  58. package/dist/{stream → components/stream}/ordinalTypes.d.ts +16 -10
  59. package/dist/components/stream/renderers/areaCanvasRenderer.d.ts +2 -0
  60. package/dist/{stream → components/stream}/types.d.ts +12 -0
  61. package/dist/components/stream/useStalenessCheck.d.ts +16 -0
  62. package/dist/{types → components/types}/legendTypes.d.ts +5 -0
  63. package/dist/network.min.js +1 -1
  64. package/dist/network.module.min.js +1 -1
  65. package/dist/ordinal.min.js +1 -1
  66. package/dist/ordinal.module.min.js +1 -1
  67. package/dist/realtime.min.js +1 -1
  68. package/dist/realtime.module.min.js +1 -1
  69. package/dist/semiotic-ai.d.ts +3 -0
  70. package/dist/semiotic-ai.min.js +1 -1
  71. package/dist/semiotic-ai.module.min.js +1 -1
  72. package/dist/semiotic-network.d.ts +1 -0
  73. package/dist/semiotic-ordinal.d.ts +1 -0
  74. package/dist/semiotic.d.ts +3 -3
  75. package/dist/semiotic.min.js +1 -1
  76. package/dist/semiotic.module.min.js +1 -1
  77. package/dist/server.min.js +1 -1
  78. package/dist/server.module.min.js +1 -1
  79. package/dist/test/canvasMock.d.ts +2 -0
  80. package/dist/test-utils/canvasMock.d.ts +20 -0
  81. package/dist/test-utils/frameMock.d.ts +78 -0
  82. package/dist/xy.min.js +1 -1
  83. package/dist/xy.module.min.js +1 -1
  84. package/package.json +7 -15
  85. package/dist/stream/renderers/areaCanvasRenderer.d.ts +0 -7
  86. /package/dist/{Annotation.d.ts → components/Annotation.d.ts} +0 -0
  87. /package/dist/{CategoryColors.d.ts → components/CategoryColors.d.ts} +0 -0
  88. /package/dist/{ChartContainer.d.ts → components/ChartContainer.d.ts} +0 -0
  89. /package/dist/{ChartErrorBoundary.d.ts → components/ChartErrorBoundary.d.ts} +0 -0
  90. /package/dist/{ContextLayout.d.ts → components/ContextLayout.d.ts} +0 -0
  91. /package/dist/{DetailsPanel.d.ts → components/DetailsPanel.d.ts} +0 -0
  92. /package/dist/{Legend.d.ts → components/Legend.d.ts} +0 -0
  93. /package/dist/{ThemeProvider.d.ts → components/ThemeProvider.d.ts} +0 -0
  94. /package/dist/{charts → components/charts}/ordinal/Histogram.d.ts +0 -0
  95. /package/dist/{charts → components/charts}/ordinal/RidgelinePlot.d.ts +0 -0
  96. /package/dist/{charts → components/charts}/ordinal/ViolinPlot.d.ts +0 -0
  97. /package/dist/{charts → components/charts}/realtime/RealtimeHeatmap.d.ts +0 -0
  98. /package/dist/{charts → components/charts}/realtime/RealtimeHistogram.d.ts +0 -0
  99. /package/dist/{charts → components/charts}/realtime/RealtimeLineChart.d.ts +0 -0
  100. /package/dist/{charts → components/charts}/realtime/RealtimeSwarmChart.d.ts +0 -0
  101. /package/dist/{charts → components/charts}/realtime/RealtimeWaterfallChart.d.ts +0 -0
  102. /package/dist/{charts → components/charts}/shared/ChartError.d.ts +0 -0
  103. /package/dist/{charts → components/charts}/shared/annotationRules.d.ts +0 -0
  104. /package/dist/{charts → components/charts}/shared/colorUtils.d.ts +0 -0
  105. /package/dist/{charts → components/charts}/shared/formatUtils.d.ts +0 -0
  106. /package/dist/{charts → components/charts}/shared/legendUtils.d.ts +0 -0
  107. /package/dist/{charts → components/charts}/shared/loess.d.ts +0 -0
  108. /package/dist/{charts → components/charts}/shared/networkUtils.d.ts +0 -0
  109. /package/dist/{charts → components/charts}/shared/selectionUtils.d.ts +0 -0
  110. /package/dist/{charts → components/charts}/shared/statisticalOverlays.d.ts +0 -0
  111. /package/dist/{charts → components/charts}/shared/validateChartData.d.ts +0 -0
  112. /package/dist/{charts → components/charts}/shared/validateProps.d.ts +0 -0
  113. /package/dist/{charts → components/charts}/xy/MinimapChart.d.ts +0 -0
  114. /package/dist/{charts → components/charts}/xy/ScatterplotMatrix.d.ts +0 -0
  115. /package/dist/{data → components/data}/fromVegaLite.d.ts +0 -0
  116. /package/dist/{data → components/data}/transforms.d.ts +0 -0
  117. /package/dist/{export → components/export}/chartConfig.d.ts +0 -0
  118. /package/dist/{export → components/export}/selectionSerializer.d.ts +0 -0
  119. /package/dist/{geometry → components/geometry}/sankeyLinks.d.ts +0 -0
  120. /package/dist/{realtime → components/realtime}/BinAccumulator.d.ts +0 -0
  121. /package/dist/{realtime → components/realtime}/IncrementalExtent.d.ts +0 -0
  122. /package/dist/{realtime → components/realtime}/RingBuffer.d.ts +0 -0
  123. /package/dist/{realtime → components/realtime}/renderers/types.d.ts +0 -0
  124. /package/dist/{realtime → components/realtime}/renderers/waterfallRenderer.d.ts +0 -0
  125. /package/dist/{realtime → components/realtime}/types.d.ts +0 -0
  126. /package/dist/{store → components/store}/ObservationStore.d.ts +0 -0
  127. /package/dist/{store → components/store}/SelectionStore.d.ts +0 -0
  128. /package/dist/{store → components/store}/ThemeStore.d.ts +0 -0
  129. /package/dist/{store → components/store}/TooltipStore.d.ts +0 -0
  130. /package/dist/{store → components/store}/createStore.d.ts +0 -0
  131. /package/dist/{store → components/store}/useObservation.d.ts +0 -0
  132. /package/dist/{store → components/store}/useSelection.d.ts +0 -0
  133. /package/dist/{stream → components/stream}/CanvasHitTester.d.ts +0 -0
  134. /package/dist/{stream → components/stream}/DataSourceAdapter.d.ts +0 -0
  135. /package/dist/{stream → components/stream}/MarginalGraphics.d.ts +0 -0
  136. /package/dist/{stream → components/stream}/NetworkCanvasHitTester.d.ts +0 -0
  137. /package/dist/{stream → components/stream}/NetworkPipelineStore.d.ts +0 -0
  138. /package/dist/{stream → components/stream}/OrdinalCanvasHitTester.d.ts +0 -0
  139. /package/dist/{stream → components/stream}/OrdinalPipelineStore.d.ts +0 -0
  140. /package/dist/{stream → components/stream}/ParticlePool.d.ts +0 -0
  141. /package/dist/{stream → components/stream}/SceneGraph.d.ts +0 -0
  142. /package/dist/{stream → components/stream}/StreamNetworkFrame.d.ts +0 -0
  143. /package/dist/{stream → components/stream}/StreamOrdinalFrame.d.ts +0 -0
  144. /package/dist/{stream → components/stream}/StreamXYFrame.d.ts +0 -0
  145. /package/dist/{stream → components/stream}/accessorUtils.d.ts +0 -0
  146. /package/dist/{stream → components/stream}/keyboardNav.d.ts +0 -0
  147. /package/dist/{stream → components/stream}/layouts/chordLayoutPlugin.d.ts +0 -0
  148. /package/dist/{stream → components/stream}/layouts/forceLayoutPlugin.d.ts +0 -0
  149. /package/dist/{stream → components/stream}/layouts/hierarchyLayoutPlugin.d.ts +0 -0
  150. /package/dist/{stream → components/stream}/layouts/index.d.ts +0 -0
  151. /package/dist/{stream → components/stream}/layouts/sankeyLayoutPlugin.d.ts +0 -0
  152. /package/dist/{stream → components/stream}/ordinalSceneBuilders/barScene.d.ts +0 -0
  153. /package/dist/{stream → components/stream}/ordinalSceneBuilders/connectorScene.d.ts +0 -0
  154. /package/dist/{stream → components/stream}/ordinalSceneBuilders/pieScene.d.ts +0 -0
  155. /package/dist/{stream → components/stream}/ordinalSceneBuilders/pointScene.d.ts +0 -0
  156. /package/dist/{stream → components/stream}/ordinalSceneBuilders/statisticalScene.d.ts +0 -0
  157. /package/dist/{stream → components/stream}/ordinalSceneBuilders/timelineScene.d.ts +0 -0
  158. /package/dist/{stream → components/stream}/ordinalSceneBuilders/types.d.ts +0 -0
  159. /package/dist/{stream → components/stream}/renderers/barCanvasRenderer.d.ts +0 -0
  160. /package/dist/{stream → components/stream}/renderers/boxplotCanvasRenderer.d.ts +0 -0
  161. /package/dist/{stream → components/stream}/renderers/candlestickCanvasRenderer.d.ts +0 -0
  162. /package/dist/{stream → components/stream}/renderers/connectorCanvasRenderer.d.ts +0 -0
  163. /package/dist/{stream → components/stream}/renderers/heatmapCanvasRenderer.d.ts +0 -0
  164. /package/dist/{stream → components/stream}/renderers/lineCanvasRenderer.d.ts +0 -0
  165. /package/dist/{stream → components/stream}/renderers/networkArcRenderer.d.ts +0 -0
  166. /package/dist/{stream → components/stream}/renderers/networkCircleRenderer.d.ts +0 -0
  167. /package/dist/{stream → components/stream}/renderers/networkEdgeRenderer.d.ts +0 -0
  168. /package/dist/{stream → components/stream}/renderers/networkParticleRenderer.d.ts +0 -0
  169. /package/dist/{stream → components/stream}/renderers/networkRectRenderer.d.ts +0 -0
  170. /package/dist/{stream → components/stream}/renderers/pointCanvasRenderer.d.ts +0 -0
  171. /package/dist/{stream → components/stream}/renderers/swarmCanvasRenderer.d.ts +0 -0
  172. /package/dist/{stream → components/stream}/renderers/types.d.ts +0 -0
  173. /package/dist/{stream → components/stream}/renderers/violinCanvasRenderer.d.ts +0 -0
  174. /package/dist/{stream → components/stream}/renderers/waterfallCanvasRenderer.d.ts +0 -0
  175. /package/dist/{stream → components/stream}/renderers/wedgeCanvasRenderer.d.ts +0 -0
  176. /package/dist/{stream → components/stream}/useResponsiveSize.d.ts +0 -0
  177. /package/dist/{types → components/types}/annotationTypes.d.ts +0 -0
  178. /package/dist/{types → components/types}/generalTypes.d.ts +0 -0
  179. /package/dist/{types → components/types}/interactionTypes.d.ts +0 -0
  180. /package/dist/{types → components/types}/networkTypes.d.ts +0 -0
  181. /package/dist/{types → components/types}/ordinalTypes.d.ts +0 -0
@@ -1 +1 @@
1
- "use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-array"),o=require("d3-hierarchy"),s=require("d3-scale-chromatic");function i(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const r=i(e),a=5e3;class l{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}clearLastData(){this.lastBoundedData=null,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,a),bounded:!0,totalSize:e.length});let t=a;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+a,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)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class c{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}}}toArray(){const e=[];for(const t of this)e.push(t);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}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 u{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 h(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function d(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function m(e,t,n,o,s,i,r){return{type:"rect",x:e,y:t,w:n,h:o,style:s,datum:i,group:r}}function g(e,t){const{columns:n,config:o,resolvePieceStyle:s}=e,i=[],r=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=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=s(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:r,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function f(e){var t,o,s;const i=e.length,r=e[0],a=e[i-1];return{n:i,min:r,q1:null!==(t=n.quantile(e,.25))&&void 0!==t?t:r,median:null!==(o=n.quantile(e,.5))&&void 0!==o?o:(r+a)/2,q3:null!==(s=n.quantile(e,.75))&&void 0!==s?s:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}const p={bar:function(e,t){const{scales:n,columns:o,config:s,getR:i,getStack:r,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],h="vertical"===c,d="horizontal"===c,g=s.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=r?r(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,s=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const f=a(c.pieces[0],r?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(h){const n=l(0>t?s:o+t),r=0>t?l(s+t)-l(s):l(o)-l(o+t);u.push(m(e.x,n,e.width,Math.abs(r),f,p,i)),0>t?s+=t:o+=t}else if(d){const n=l(0>t?s+t:o),r=0>t?l(s)-l(s+t):l(o+t)-l(o);u.push(m(n,e.x,Math.abs(r),e.width,f,p,i)),0>t?s+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:s,getGroup:i,resolvePieceStyle:r}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,h=[],d=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";d.has(e)||(d.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;h.length>o;o++){const i=n.get(h[o])||[];for(const n of i){const i=s(n),l=r(n,e.name);if(u){const s=e.x+o*t,r=a(0),u=a(i);c.push(m(s,Math.min(r,u),t,Math.abs(r-u),l,n,h[o]))}else{const s=e.x+o*t,r=a(0),u=a(i);c.push(m(Math.min(r,u),s,Math.abs(u-r),t,l,n,h[o]))}}}}return c},point:function(e,t){var n,o;const{scales:s,columns:i,getR:r,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=s,h=[],d="vertical"===u,m="radial"===u,g=a.length>0,f=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const s=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:r(t),u=g&&a[s]||c,y=l(t,e.name),v=y.r||5;let b,x;if(m){const t=p+(e.pctStart+e.pct/2)*f,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else d?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);h.push({type:"point",x:b,y:x,r:v,style:y,datum:t})}return h},swarm:function(e,t){const{scales:n,columns:o,getR:s,resolvePieceStyle:i}=e,{r:r,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=s(o),u=i(o,e.name),h=u.r||4,d=(7919*n%100/100-.5)*t*.8,m=c?e.middle+d:r(a),g=c?r(a):e.middle+d;l.push({type:"point",x:m,y:g,r:h,style:u,datum:o})}}return l},pie:g,donut:g,boxplot:function(e,t){var o,s,i,r,a;const{scales:l,columns:c,config:u,getR:h,resolveSummaryStyle:d}=e,{r:m,projection:g}=l,f=[],p="vertical"===g,y=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(o=n.quantile(t,.25))&&void 0!==o?o:l,g=null!==(s=n.quantile(t,.5))&&void 0!==s?s:(l+c)/2,v=null!==(i=n.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(r=t.find(e=>e>=x))&&void 0!==r?r:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,E=d(e.pieceData[0],e.name),M=[];if(y)for(const t of e.pieceData){const n=h(t);if(x>n||n>w){const o=p?e.middle:m(n),s=p?m(n):e.middle;M.push({px:o,py:s,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:m(k),q1Pos:m(u),medianPos:m(g),q3Pos:m(v),maxPos:m(A),stats:{min:k,q1:u,median:g,q3:v,max:A},style:E,datum:e.pieceData,category:e.name,outliers:M}),y)for(const e of M)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var o,s,i;const{scales:r,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:h,projection:d}=r,m=[],g="vertical"===d,p=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],a=t[t.length-1],l=(a-r)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/l),p-1)]++;const v=Math.max(...d,1),b=e.width/2*.9;let x="";if(g){for(let t=0;p>t;t++){const n=h(r+(t+.5)*l),o=d[t]/v*b;x+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=p-1;t>=0;t--){const n=h(r+(t+.5)*l);x+=` L ${e.middle-d[t]/v*b} ${n}`}x+=" Z"}else{for(let t=0;p>t;t++){const n=h(r+(t+.5)*l),o=d[t]/v*b;x+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=p-1;t>=0;t--)x+=` L ${h(r+(t+.5)*l)} ${e.middle+d[t]/v*b}`;x+=" Z"}const w=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=n.quantile(t,.25))&&void 0!==o?o:r,c=null!==(s=n.quantile(t,.5))&&void 0!==s?s:(r+a)/2,u=null!==(i=n.quantile(t,.75))&&void 0!==i?i:a;k={q1Pos:h(l),medianPos:h(c),q3Pos:h(u),centerPos:e.middle,isVertical:g}}const A=g?{x:e.x,y:Math.min(h(a),h(r)),width:e.width,height:Math.abs(h(a)-h(r))}:{x:Math.min(h(r),h(a)),y:e.x,width:Math.abs(h(a)-h(r)),height:e.width};m.push({type:"violin",pathString:x,translateX:0,translateY:0,bounds:A,iqrLine:k,stats:f(t),style:w,datum:e.pieceData,category:e.name})}return m},histogram:function(e,t){const{scales:n,columns:o,config:s,getR:i,resolveSummaryStyle:r}=e,{r:a}=n,l=[],c=s.bins||25,u=s.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,s=Array(c).fill(0);for(const e of t)s[Math.min(Math.floor((e-n)/o),c-1)]++;const h=t.length,d=Math.max(...s,1),g=r(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===s[t])continue;const i=(u?s[t]/h:s[t]/d)*e.width*.9,r=a(n+t*o),c=a(n+(t+1)*o);l.push(m(Math.min(r,c),e.x+e.width-i,Math.abs(c-r),i,g,{bin:t,count:s[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:s,config:i,getR:r,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],h=i.bins||20,d="horizontal"===c,m=i.amplitude||1.5;for(const e of Object.values(s)){const t=e.pieceData.map(e=>r(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],s=t[t.length-1],i=(s-o)/h||1,c=Array(h).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),h-1)]++;const g=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*m;let v="";if(d){const t=e.x+e.width;v=`M ${l(o)} ${t}`;for(let e=0;h>e;e++)v+=` L ${l(o+(e+.5)*i)} ${t-c[e]/g*y}`;v+=` L ${l(s)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(o)}`;for(let e=0;h>e;e++){const n=l(o+(e+.5)*i);v+=` L ${t+c[e]/g*y} ${n}`}v+=` L ${t} ${l(s)} Z`}const b=d?{x:Math.min(l(o),l(s)),y:e.x,width:Math.abs(l(s)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(s),l(o)),width:e.width,height:Math.abs(l(s)-l(o))};u.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:b,stats:f(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:s,resolvePieceStyle:i}=e,{r:r,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=s(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=r(Math.min(o,a)),s=r(Math.max(o,a));l.push(m(n,e.x,s-n,e.width,u,t,e.name))}else{const n=r(Math.max(o,a)),s=r(Math.min(o,a));l.push(m(e.x,n,e.width,s-n,u,t,e.name))}}return l}};class y{constructor(e){this.rExtent=new u,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new c(e.windowSize),this.getO=d(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>h(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new u)):(this.getR=h(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=d(e.stackBy),this.getGroup=d(e.groupBy),this.getColor=d(e.colorAccessor),this.getConnector=d(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new c(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),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 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.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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=o.toArray(),i=n.projection||"vertical",r=n.oExtent||this.resolveCategories(s),a=this.computeValueDomain(s,r),l="horizontal"===i,c=null!=n.barPadding?n.barPadding/("vertical"===i?e.width:e.height):.1;let u,h;if("radial"===i){u=t.scaleBand().domain(r).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,s=n.innerRadius||0;h=t.scaleLinear().domain(a).range([s,o])}else l?(u=t.scaleBand().domain(r).range([0,e.height]).padding(c),h=t.scaleLinear().domain(a).range([0,e.width])):(u=t.scaleBand().domain(r).range([0,e.width]).padding(c),h=t.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:h,projection:i},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((s,i)=>{const r=this.rExtents[i];r.dirty&&r.recalculate(o,s);let[a,c]=r.extent;a===1/0&&(a=0,c=1);const u=c-a,h=u>0?u*(n.extentPadding||.05):1;return a-=h,c+=h,a>0&&(a=0),l?t.scaleLinear().domain([a,c]).range([0,e.width]):t.scaleLinear().domain([a,c]).range([e.height,0])}):[];let d=s;this.rAccessors.length>1&&(d=s.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(d,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const s=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let r=0,a=0;if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),s=this.getR(o);0>s?n.set(e,(n.get(e)||0)+s):t.set(e,(t.get(e)||0)+s)}for(const e of t.values())e>a&&(a=e);for(const e of n.values())r>e&&(r=e)}else if("bar"===s){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>a&&(a=e),r>e&&(r=e)}else if("clusterbar"===s)for(const t of e){const e=this.getR(t);e>a&&(a=e),r>e&&(r=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(r=e),t!==-1/0&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(r=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-r,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(r-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(a+=c),"bar"!==s&&"clusterbar"!==s||(r>0&&(r=0),0>a&&(a=0)),[r,a]}buildColumns(e,t,n,o,s){var i;const r={},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?s.height:s.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let h=0,d=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),s=l>0?o/l:0;let c,m;u?(c=d,m=u.get(e)||n.bandwidth(),d+=m+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,m=n.bandwidth()),r[e]={name:e,x:c,y:0,width:m,middle:c+m/2,padding:n.padding()*n.step(),pieceData:t,pct:s,pctStart:h},h+=s}return r}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=p[this.config.chartType];let s=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:s,getO:i}=e;if(!s||!n)return[];const r=[],{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=s(t);if(!n)continue;let o,r;"point"===e.type?(o=e.x,r=e.y):(o=e.x+e.w/2,r=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:r,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],s=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};r.push({type:"connector",x1:o.x,y1:o.y,x2:s.x,y2:s.y,style:i,datum:o.datum,group:e})}}return r}(n,s);s=[...e,...s]}return s}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):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:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],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){var n,o,s;const i=this.config.decay;if(!i||1>=t)return 1;const r=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return r+(1-a/(t-1))*(1-r);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return r+Math.pow(.5,a/e)*(1-r)}case"step":return(null!==(s=i.stepThreshold)&&void 0!==s?s:.5*t)>a?1:r;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const s=t.length;if(1>=s)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);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 r=this.computeDecayOpacity(e,s),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*r})}}applyPulse(e,t){var n,o,s;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),r=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!==(s=this.config.pulse.glowRadius)&&void 0!==s?s:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=c.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=i-n;r>o&&(t._pulseIntensity=1-o/r,t._pulseColor=a,t._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}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const s=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(s,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,s;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let r=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e];let a=null;if("point"===i.type?a="p:"+e:"rect"===i.type&&(a=`r:${i.group||""}:${null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===i.type?l.x===i.x&&l.y===i.y||(i._targetX=i.x,i._targetY=i.y,i.x=l.x,i.y=l.y,r=!0):"rect"===i.type&&(l.x===i.x&&l.y===i.y&&l.w===i.w&&l.h===i.h||(i._targetX=i.x,i._targetY=i.y,i._targetW=i.w,i._targetH=i.h,i.x=l.x,i.y=l.y,i.w=null!==(o=l.w)&&void 0!==o?o:i.w,i.h=null!==(s=l.h)&&void 0!==s?s:i.h,r=!0)))}r&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const s=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),i="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?s:1-Math.pow(1-s,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.prevPositionMap.get("p:0");if(!t)continue;e.x=t.x+(e._targetX-t.x)*i,e.y=t.y+(e._targetY-t.y)*i}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,s=this.prevPositionMap.get(t);if(!s)continue;e.x=s.x+(e._targetX-s.x)*i,e.y=s.y+(e._targetY-s.y)*i,void 0!==s.w&&(e.w=s.w+(e._targetW-s.w)*i,e.h=s.h+(e._targetH-s.h)*i)}if(s>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function v(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function b(e,t,n){const o=t-e.x,s=n-e.y,i=Math.sqrt(o*o+s*s);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function x(e,t,n){const o=t-e.cx,s=n-e.cy,i=Math.sqrt(o*o+s*s);if(e.innerRadius>i||i>e.outerRadius)return null;let r=Math.atan2(s,o);0>r&&(r+=2*Math.PI);let a=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>a&&(a+=2*Math.PI),0>l&&(l+=2*Math.PI),!(a>l?r>=a||l>=r:r>=a&&l>=r))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 w(e,t,n){const o=e.columnWidth/2,s=e.stats?Object.assign(Object.assign({},e.stats),{n:Array.isArray(e.datum)?e.datum.length:0,mean:(e.stats.q1+e.stats.median+e.stats.q3)/3}):void 0;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:s}}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:s}}return null}function k(e,t,n){if(!e.bounds)return null;const{x:o,y:s,width:i,height:r}=e.bounds;return o>t||t>o+i||s>n||n>s+r?null:{datum:e.datum,x:o+i/2,y:s+r/2,distance:0,category:e.category,stats:e.stats}}const A={fill:e=>r.createElement("rect",{style:e,width:20,height:20}),line:e=>r.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function E(e,t,n,o){let s;return s="function"==typeof n?n(e):(0,A[n])(o(e,t)),s}function M(e){const{legendGroups:t,customClickBehavior:n,title:o="Legend",width:s=100,height:i=20,orientation:a="vertical"}=e,l="vertical"===a?(({legendGroups:e,width:t,customClickBehavior:n})=>{let o=30;const s=[];return e.forEach((e,i)=>{o+=5,s.push(r.createElement("line",{key:"legend-top-line legend-symbol-"+i,stroke:"gray",x1:0,y1:o,x2:t,y2:o})),o+=10,e.label&&(o+=20,s.push(r.createElement("text",{key:"legend-text-"+i,y:o,className:"legend-group-label"},e.label)),o+=10),s.push(r.createElement("g",{key:"legend-group-"+i,className:"legend-item",transform:`translate(0,${o})`},((e,t)=>{const{type:n="fill",styleFn:o,items:s}=e,i=[];let a=0;return s.forEach((e,s)=>{const l=E(e,s,n,o);i.push(r.createElement("g",{key:"legend-item-"+s,transform:`translate(0,${a})`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},l,r.createElement("text",{y:15,x:30},e.label))),a+=25}),i})(e,n))),o+=25*e.items.length+10}),s})({legendGroups:t,width:s,customClickBehavior:n}):(({legendGroups:e,title:t,height:n,customClickBehavior:o})=>{let s=0;const i=[],a=!1===t?10:40;return e.forEach((t,l)=>{t.label&&(i.push(r.createElement("text",{key:"legend-text-"+l,transform:`translate(${s},${a}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),s+=20);const c=((e,t)=>{const{type:n="fill",styleFn:o,items:s}=e,i=[];let a=0;return s.forEach((e,s)=>{const l=E(e,s,n,o);i.push(r.createElement("g",{key:"legend-item-"+s,transform:`translate(${a},0)`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},l,r.createElement("text",{y:15,x:25},e.label))),a+=35,a+=8*e.label.length}),{items:i,offset:a}})(t,o);i.push(r.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${s},${a})`},c.items)),s+=c.offset+5,e[l+1]&&i.push(r.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:s,y1:a-10,x2:s,y2:n+a+10})),s+=15}),r.createElement("g",null,!1!==t&&r.createElement("line",{x1:0,x2:s+10,y1:a-10,y2:a-10,stroke:"gray",className:"title-neatline"}),i)})({legendGroups:t,title:o,height:i,customClickBehavior:n});return r.createElement("g",null,void 0!==o&&r.createElement("text",{className:"legend-title",y:20,x:"horizontal"===a?0:s/2,textAnchor:"horizontal"===a?"start":"middle"},o),l)}function S(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),s=e.split(/\s+/),i=[];let r="";for(const e of s)r&&r.length+1+e.length>o?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function O(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 j(e){const{x:t=0,y:n=0,dx:o,dy:s,nx:i,ny:a,note:l,connector:c,subject:u,type:h,color:d,className:m,disable:g,events:f={},"data-testid":p}=e,y=new Set(Array.isArray(g)?g:[]);let v=o||0,b=s||0;null!=i&&(v=i-t),null!=a&&(b=a-n);const x="string"==typeof h?h:"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 r.createElement("g",Object.assign({className:("annotation "+(m||"")).trim(),transform:`translate(${t},${n})`,"data-testid":p},f),!y.has("connector")&&function(e,t,n,o,s,i){const a=[];let l=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==i?void 0:i.radius)){if("callout-rect"===s&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const s=n/2,i=o/2,r=e-s,a=t-i;if(0!==r||0!==a){const e=Math.abs(r),t=Math.abs(a),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;l=s+r*d,c=i+a*d}}}else if("bracket"===s&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);l=Math.cos(o)*n,c=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(t-c,2))>.5&&(a.push(r.createElement("line",{key:"connector-line",x1:l,y1:c,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,s=16/180*Math.PI,i=Math.atan2(t-c,e-l);a.push(r.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+n*Math.cos(i+s)},${c+n*Math.sin(i+s)}L${l+n*Math.cos(i-s)},${c+n*Math.sin(i-s)}Z`,fill:o||"currentColor",stroke:"none"}))}return r.createElement("g",{className:"annotation-connector"},a)}(v,b,c,d,x,u),!y.has("subject")&&function(e,t,n,o,s){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(r.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(r.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=s||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(r.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(r.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(r.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(r.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(r.createElement("path",{key:"bracket-path",d:O((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return r.createElement("g",{className:"annotation-subject"},a)}(x,u,d,t,n),!y.has("note")&&function(e,t,n,o){if(!e)return r.createElement("g",{className:"annotation-note"});const{label:s,title:i,orientation:a,align:l,wrap:c=120,noWrap:u}=e;if(!s&&!i)return r.createElement("g",{className:"annotation-note"});let h=a;h||(h=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=l;d&&"dynamic"!==d||(d="topBottom"===h?0>t?"right":"left":0>n?"bottom":"top");let m="start";"topBottom"===h?"right"===d?m="end":"middle"===d&&(m="middle"):m=0>t?"end":"start";const g=16,f=i?u?[i]:S(i,c):[],p=s?u?[s]:S(s,c):[],y="leftRight"===h?"end"===m?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(r.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:m,fontWeight:"bold"},f.map((e,t)=>r.createElement("tspan",{key:t,x:y,dy:0===t?0:g},e)))),v=f.length*g),p.length>0&&b.push(r.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:m,y:v},p.map((e,t)=>r.createElement("tspan",{key:t,x:y,dy:0===t?0:g},e))));let x=null;if((i||s)&&(0!==t||0!==n))if("topBottom"===h){const e=Math.min(c,120);let t=0,n=e;"end"===m?(t=-e,n=0):"middle"===m&&(t=-e/2,n=e/2),x=r.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+p.length)*g+(p.length>0?g:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=r.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,f.length+p.length-1)*g;let k=0;return"topBottom"===h?k=0>n?-(w+2):18:"leftRight"===h&&(k="middle"===d?-(w+g+(p.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),r.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},r.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,d))}function L(e){var t,n;const{noteData:o}=e,{screenCoordinates:s}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&s){const e=o.nx||s[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||s[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),l=s.map((t,n)=>{const s=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return r.createElement(j,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},s,{type:i}))});return r.createElement("g",null,l)}const l=o.note||{title:"none",label:o.label};return r.createElement(j,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${o.i}`,events:a},o,{type:i}))}function P(e,t){var n,o,s;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(s=t.scales)||void 0===s?void 0:s.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function C(e,t){var n,o,s;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(s=t.scales)||void 0===s?void 0:s.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function H(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function N(e){return Math.round(100*e)/100+""}function B(t){const{width:n,height:s,totalWidth:i,totalHeight:a,margin:l,scales:c,showAxes:u,oLabel:h,rLabel:d,oFormat:m,rFormat:g,showGrid:f,title:p,legend:y,foregroundGraphics:v,annotations:b,svgAnnotationRules:x,annotationFrame:w,xAccessor:k,yAccessor:A,annotationData:E,children:S}=t,O="radial"===(null==c?void 0:c.projection),j="horizontal"===(null==c?void 0:c.projection),B=e.useMemo(()=>u&&c&&!O?c.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=c.o(e))&&void 0!==t?t:0)+c.o.bandwidth()/2,label:m?m(e):e}}):[],[u,c,m,O]),_=e.useMemo(()=>u&&c&&!O?c.r.ticks(5).map(e=>({value:e,pixel:c.r(e),label:(g||N)(e)})):[],[u,c,g,O]),$=e.useMemo(()=>{if(!b||0===b.length)return null;const e=function(e,t,n){var s,i,a,l,c,u,h,d,m,g,f,p,y,v,b,x,w,k,A,E,M,S,O,j,N,B,_,$,D,R,z,W,T,I,q,G,F,V,X;switch(e.type){case"label":{let o=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,s=t.y}else o=P(e,n),s=C(e,n);return null==o||null==s?null:H(o,s,n)?r.createElement(L,{key:"ann-"+t,noteData:{x:o,y:s,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{let o=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,s=t.y}else o=P(e,n),s=C(e,n);return null==o||null==s?null:H(o,s,n)?r.createElement(L,{key:"ann-"+t,noteData:{x:o,y:s,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=P(e,n);if(null==o)return null;const s=e.color||"#f97316";return r.createElement("g",{key:"ann-"+t},r.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:s,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&r.createElement("text",{x:o+4,y:12,fill:s,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=C(e,n);if(null==o)return null;const s=e.color||"#f97316";return r.createElement("g",{key:"ann-"+t},r.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:s,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&r.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:s,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const s=(e.coordinates||[]).map(e=>({x:P(Object.assign(Object.assign({},e),{type:"point"}),n),y:C(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>s.length)return null;const i=o.packEnclose(s),a=e.padding||10;return r.createElement("g",{key:"ann-"+t},r.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&r.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:P(Object.assign(Object.assign({},e),{type:"point"}),n),y:C(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),l=Math.min(...i)-s,c=Math.max(...i)+s,u=Math.min(...a)-s,h=Math.max(...a)+s;return r.createElement("g",{key:"ann-"+t},r.createElement("rect",{x:l,y:u,width:c-l,height:h-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&r.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],s="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return r.createElement("g",{key:"ann-"+t},s.map((t,o)=>{const s=P(t,n),a=C(t,n);return null==s||null==a?null:r.createElement("circle",Object.assign({key:o,cx:s,cy:a,r:e.r||6},i))}))}case"bracket":{const o=P(e,n),s=C(e,n);return r.createElement(L,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=s?s:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const o=n.data||[];if(2>o.length)return null;const d=n.xAccessor||"x",m=n.yAccessor||"y",g=o.map(e=>[e[d],e[m]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>g.length)return null;const f=null!==(i=null===(s=n.scales)||void 0===s?void 0:s.x)&&void 0!==i?i:null===(a=n.scales)||void 0===a?void 0:a.time,p=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!f||!p)return null;const y=e.method||"linear";let v;if("loess"===y)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]),s=o.map(e=>e[0]),i=o.map(e=>e[1]),r=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=s[e],o=s.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(r-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,h=0,d=0,m=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*s[e],d+=t*i[e],m+=t*s[e]*s[e],g+=t*s[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const f=u*m-h*h;if(1e-12>Math.abs(f))a.push([t,d/u]);else{const e=(u*g-h*d)/f;a.push([t,(d-e*h)/u+e*t])}}return a}(g,null!==(h=e.bandwidth)&&void 0!==h?h:.3);else{let t;try{const n=require("regression");t="polynomial"===y?n.polynomial(g,{order:e.order||2}):n.linear(g)}catch(e){return null}v=t.points}const b=v.map(([e,t])=>`${f(e)},${p(t)}`).join(" "),x=e.color||"#6366f1";return r.createElement("g",{key:"ann-"+t},r.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&r.createElement("text",{x:f(v[v.length-1][0])+4,y:p(v[v.length-1][1])-4,fill:x,fontSize:11},e.label))}case"band":{const o=null!==(m=null===(d=n.scales)||void 0===d?void 0:d.y)&&void 0!==m?m:null===(g=n.scales)||void 0===g?void 0:g.value,s=null!==(f=null==o?void 0:o(e.y0))&&void 0!==f?f:0,i=null!==(p=null==o?void 0:o(e.y1))&&void 0!==p?p:n.height||0;return r.createElement("g",{key:"ann-"+t},r.createElement("rect",{x:0,y:Math.min(s,i),width:n.width||0,height:Math.abs(i-s),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&r.createElement("text",{x:(n.width||0)-4,y:Math.min(s,i)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const s=n.xAccessor||"x",i=null!==(v=null===(y=n.scales)||void 0===y?void 0:y.x)&&void 0!==v?v:null===(b=n.scales)||void 0===b?void 0:b.time,a=null!==(w=null===(x=n.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(k=n.scales)||void 0===k?void 0:k.value;if(!i||!a)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const d=h.map(e=>`${i(e[s])},${a(e[l])}`).join(" L"),m=h.slice().reverse().map(e=>`${i(e[s])},${a(e[c])}`).join(" L"),g=e.fill||"#6366f1";return r.createElement("g",{key:"ann-"+t},r.createElement("path",{d:`M${d} L${m} Z`,fill:g,fillOpacity:null!==(A=e.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),e.label&&h.length>0&&r.createElement("text",{x:i(h[h.length-1][s])+4,y:a(h[h.length-1][l])-4,fill:g,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const s=n.yAccessor||"y",i=null!==(M=null===(E=n.scales)||void 0===E?void 0:E.x)&&void 0!==M?M:null===(S=n.scales)||void 0===S?void 0:S.time,a=null!==(j=null===(O=n.scales)||void 0===O?void 0:O.y)&&void 0!==j?j:null===(N=n.scales)||void 0===N?void 0:N.value;if(!i||!a)return null;const l=o.map(e=>e[s]).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,h=Math.sqrt(u),d=null!==(B=e.threshold)&&void 0!==B?B:2,m=c-d*h,g=!1!==e.showBand,f=e.fill||"#6366f1",p=null!==(_=e.fillOpacity)&&void 0!==_?_:.1,y=e.anomalyColor||"#ef4444",v=null!==($=e.anomalyRadius)&&void 0!==$?$:6,b=a(c+d*h),x=a(m),w=o.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>d*h});return r.createElement("g",{key:"ann-"+t},g&&r.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:f,fillOpacity:p}),w.map((e,t)=>{const o=P(e,n),s=C(e,n);return null==o||null==s?null:r.createElement("circle",{key:t,cx:o,cy:s,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5})}),e.label&&r.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const s=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(R=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==R?R:null===(z=n.scales)||void 0===z?void 0:z.time,l=null!==(T=null===(W=n.scales)||void 0===W?void 0:W.y)&&void 0!==T?T:null===(I=n.scales)||void 0===I?void 0:I.value;if(!a||!l)return null;const c=o.map(e=>[e[s],e[i]]).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"===(e.method||"linear"))try{const t=require("regression").polynomial(c,{order:e.order||2}).equation;u=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}catch(e){return null}else{const e=c.length;let t=0,n=0,o=0,s=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,s+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const r=(e*s-t*n)/i,a=(n-r*t)/e;u=e=>a+r*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),m=Math.sqrt(d/Math.max(h-2,1)),g=c.reduce((e,t)=>e+t[0],0)/h,f=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),p=null!==(q=e.confidence)&&void 0!==q?q:.95,y=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,v=null!==(G=e.steps)&&void 0!==G?G:5,b=c[h-1][0],x=(b-c[0][0])/Math.max(h-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const k=[];for(const e of w){const t=u(e),n=m*Math.sqrt(1+1/h+(f>0?Math.pow(e-g,2)/f:0))*y;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,E=k.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),M=`${a(b)},${l(u(b))}`,S=e.strokeColor||"#6366f1";return r.createElement("g",{key:"ann-"+t},r.createElement("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:null!==(F=e.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),r.createElement("polyline",{points:`${M} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(V=e.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=e.strokeDasharray)&&void 0!==X?X:"6,3"}),e.label&&k.length>0&&r.createElement("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}default:return null}},t={scales:c?{x:c.r,y:c.r,time:c.r,value:c.r}:null,timeAxis:"x",xAccessor:k,yAccessor:A,width:n,height:s,data:E,frameType:"ordinal"};return b.map((n,o)=>{if(x){const s=x(n,o,t);return null!=s?s:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[b,x,n,s,w,k,A,E]);return u||p||y||v||$&&$.length>0||f||S?r.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},r.createElement("g",{transform:`translate(${l.left},${l.top})`},f&&c&&!O&&r.createElement("g",{className:"ordinal-grid"},_.map((e,t)=>r.createElement("line",{key:"grid-"+t,x1:j?e.pixel:0,y1:j?0:e.pixel,x2:j?e.pixel:n,y2:j?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),u&&c&&!O&&r.createElement("g",{className:"ordinal-axes"},j?r.createElement(r.Fragment,null,r.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.map((e,t)=>r.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},r.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),r.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&r.createElement("text",{x:15-l.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${s/2})`,style:{userSelect:"none"}},h),r.createElement("line",{x1:0,y1:s,x2:n,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>r.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${s})`},r.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),r.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),d&&r.createElement("text",{x:n/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},d)):r.createElement(r.Fragment,null,r.createElement("line",{x1:0,y1:s,x2:n,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.map((e,t)=>r.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${s})`},r.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),r.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&r.createElement("text",{x:n/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},h),r.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>r.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},r.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),r.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),d&&r.createElement("text",{x:15-l.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${s/2})`,style:{userSelect:"none"}},d))),$,v,S),p&&r.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof p?p:null),y&&r.createElement("g",{transform:`translate(${i-l.right+10}, ${l.top})`},"object"==typeof(D=y)&&null!==D&&!r.isValidElement(D)&&"legendGroups"in D?r.createElement(M,{legendGroups:y.legendGroups,title:"",width:100}):y)):null;var D}const _=(e,t,n,o)=>{const s=t.filter(e=>"rect"===e.type);for(const t of s)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?$(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function $(e,t){const n=t.style.icon,o=t.style.iconPadding||2,s=Math.min(t.w,t.w)-o;if(0>=s)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=s+o,r=t.x+(t.w-s)/2;for(let o=t.y+t.h-s;o>=t.y-s;o-=i)e.drawImage(n,r,o,s,s)}else{const i=s+o,r=t.y+(t.h-s)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,r,s,s)}e.restore()}const D=(e,t,n,o)=>{var s,i;const r=t.filter(e=>"point"===e.type);for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(s=t.style.opacity)&&void 0!==s?s:t.style.fillOpacity;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(i=t._pulseGlowRadius)&&void 0!==i?i:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.x,t.y,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},R=(e,t,n,o)=>{const s=t.filter(e=>"wedge"===e.type);for(const t of s)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(),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),null!=t.style.fillOpacity&&(e.globalAlpha=t.style.fillOpacity),e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1},z=(e,t,n,o)=>{var s,i;const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(s=t.style.fillOpacity)&&void 0!==s?s:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},W=(e,t,n,o)=>{var s,i,r;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!==(s=n.fillOpacity)&&void 0!==s?s: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=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(r=n.style.opacity)&&void 0!==r?r:.5,e.stroke(),e.globalAlpha=1}},T=e=>[W,...e],I={bar:T([_]),clusterbar:T([_]),point:T([D]),swarm:T([D]),pie:[R],donut:[R],boxplot:T([(e,t,n,o)=>{var s,i;const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(s=t.style.fillOpacity)&&void 0!==s?s: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=r,o){const o=Math.min(t.q1Pos,t.q3Pos),s=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,s),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,s)}else{const o=Math.min(t.q1Pos,t.q3Pos),s=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,s,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,s,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()}},D]),violin:T([z]),histogram:T([_]),ridgeline:T([z]),timeline:T([_])},q={top:50,right:40,bottom:60,left:70},G={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 F({hover:e}){var t,n,o,s;const i=e.data||{},a=e.stats,l=e.category;if(Array.isArray(i)){const e=l||(null===(t=i[0])||void 0===t?void 0:t.category)||"";if(a)return r.createElement("div",{className:"semiotic-tooltip",style:G},e&&r.createElement("div",{style:{fontWeight:"bold"}},e+""),r.createElement("div",null,"n = ",a.n),r.createElement("div",null,"Min: ",a.min.toLocaleString()),r.createElement("div",null,"Q1: ",a.q1.toLocaleString()),r.createElement("div",null,"Median: ",a.median.toLocaleString()),r.createElement("div",null,"Q3: ",a.q3.toLocaleString()),r.createElement("div",null,"Max: ",a.max.toLocaleString()),r.createElement("div",{style:{opacity:.8}},"Mean: ",a.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=i.length;return r.createElement("div",{className:"semiotic-tooltip",style:G},e&&r.createElement("div",{style:{fontWeight:"bold"}},e+""),r.createElement("div",null,n," items"))}if(null!=i.bin&&null!=i.count){const e=i.range||[];return r.createElement("div",{className:"semiotic-tooltip",style:G},i.category&&r.createElement("div",{style:{fontWeight:"bold"}},i.category+""),r.createElement("div",null,"Count: ",i.count),2===e.length&&r.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const c=i.category||i.name||i.group||i.__rName||"",u=null!==(s=null!==(o=null!==(n=i.value)&&void 0!==n?n:i.__rValue)&&void 0!==o?o:i.pct)&&void 0!==s?s:"";if(!c&&""===u){const e=Object.entries(i).filter(([e])=>!e.startsWith("_")&&"data"!==e);return r.createElement("div",{className:"semiotic-tooltip",style:G},e.map(([e,t])=>r.createElement("div",{key:e},r.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return r.createElement("div",{className:"semiotic-tooltip",style:G},c&&r.createElement("div",{style:{fontWeight:"bold"}},c+""),""!==u&&r.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const V=e.forwardRef(function(t,n){var o;const{chartType:s,runtimeMode:i,data:a,oAccessor:c="category",rAccessor:u="value",colorAccessor:h,stackBy:d,groupBy:m,multiAxis:g,timeAccessor:f,valueAccessor:p,categoryAccessor:A,projection:E="vertical",size:M=[600,400],responsiveWidth:S,responsiveHeight:O,margin:j,barPadding:L,innerRadius:P,normalize:C,startAngle:H,dynamicColumnWidth:N,bins:_,showOutliers:$,showIQR:D,amplitude:R,connectorAccessor:z,connectorStyle:W,rExtent:T,oExtent:G,extentPadding:V=.05,oSort:X,windowMode:Y="sliding",windowSize:Q=200,pieceStyle:Z,summaryStyle:U,colorScheme:J,barColors:K,showAxes:ee=!0,oLabel:te,rLabel:ne,oFormat:oe,rFormat:se,enableHover:ie=!0,hoverAnnotation:re,tooltipContent:ae,customHoverBehavior:le,annotations:ce,svgAnnotationRules:ue,showGrid:he=!1,legend:de,backgroundGraphics:me,foregroundGraphics:ge,title:fe,className:pe,background:ye,centerContent:ve,decay:be,pulse:xe,transition:we,staleness:ke}=t,[Ae,Ee]=function(t,n,o){const s=e.useRef(null),[i,r]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;r(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[s,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(M,S,O),Me=e.useMemo(()=>Object.assign(Object.assign({},q),j),[j]),Se=Ee[0]-Me.left-Me.right,Oe=Ee[1]-Me.top-Me.bottom,je=e.useRef(null),Le=e.useRef(!0),Pe=e.useRef(0),Ce=e.useRef(null),He=e.useRef(()=>{}),[Ne,Be]=e.useState(null),[_e,$e]=e.useState(null),[De,Re]=e.useState(0),[ze,We]=e.useState(!1),Te=ie||re,Ie="streaming"===i,qe=e.useMemo(()=>({chartType:s,runtimeMode:Ie?"streaming":"bounded",windowSize:Q,windowMode:Y,extentPadding:V,projection:E,oAccessor:Ie?void 0:c,rAccessor:Ie?void 0:u,colorAccessor:h,stackBy:d,groupBy:m,multiAxis:g,timeAccessor:Ie?f:void 0,valueAccessor:Ie?p||("string"==typeof u||"function"==typeof u?u:void 0):void 0,categoryAccessor:Ie?A||c:void 0,rExtent:T,oExtent:G,barPadding:L,innerRadius:P,normalize:C,startAngle:H,dynamicColumnWidth:N,bins:_,showOutliers:$,showIQR:D,amplitude:R,connectorAccessor:z,connectorStyle:W,oSort:X,pieceStyle:Z,summaryStyle:U,colorScheme:J,barColors:K,decay:be,pulse:xe,transition:we,staleness:ke}),[s,Q,Y,V,E,c,u,h,d,m,g,f,p,A,T,G,L,P,C,H,N,_,$,D,R,z,W,X,Z,U,J,K,be,xe,we,ke,Ie]),Ge=e.useRef(null);Ge.current||(Ge.current=new y(qe));const Fe=e.useCallback(()=>{Pe.current||(Pe.current=requestAnimationFrame(()=>He.current()))},[]);e.useEffect(()=>{var e;null===(e=Ge.current)||void 0===e||e.updateConfig(qe),Le.current=!0,Fe()},[qe,Fe]);const Ve=e.useRef(null);Ve.current||(Ve.current=new l(e=>{const t=Ge.current;t&&t.ingest(e)&&(Le.current=!0,Fe())}));const Xe=e.useCallback(e=>{var t;null===(t=Ve.current)||void 0===t||t.push(e)},[]),Ye=e.useCallback(e=>{var t;null===(t=Ve.current)||void 0===t||t.pushMany(e)},[]),Qe=e.useCallback(()=>{var e,t;null===(e=Ve.current)||void 0===e||e.clear(),null===(t=Ge.current)||void 0===t||t.clear(),Le.current=!0,Fe()},[Fe]);e.useImperativeHandle(n,()=>({push:Xe,pushMany:Ye,clear:Qe,getData:()=>{var e,t;return null!==(t=null===(e=Ge.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ge.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Xe,Ye,Qe]),e.useEffect(()=>{var e;a&&(null===(e=Ve.current)||void 0===e||e.setBoundedData(a))},[a]);const Ze=e.useRef(()=>{}),Ue=e.useRef(()=>{});Ze.current=e=>{if(!Te)return;const t=je.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Me.left,s=e.clientY-n.top-Me.top;if(0>o||o>Se||0>s||s>Oe)return void(Ce.current&&(Ce.current=null,Be(null),le&&le(null),Fe()));const i=Ge.current;if(!i||0===i.scene.length)return;const r="radial"===E,a=function(e,t,n,o=30){let s=null;for(const i of e){let e=null;switch(i.type){case"rect":e=v(i,t,n);break;case"point":e=b(i,t,n);break;case"wedge":e=x(i,t,n);break;case"boxplot":e=w(i,t,n);break;case"violin":e=k(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(i.scene,r?o-Se/2:o,r?s-Oe/2:s);if(!a)return void(Ce.current&&(Ce.current=null,Be(null),le&&le(null),Fe()));const l=Object.assign(Object.assign({data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y},a.stats&&{stats:a.stats}),a.category&&{category:a.category});Ce.current=l,Be(l),le&&(le(l),Le.current=!0),Fe()},Ue.current=()=>{Ce.current&&(Ce.current=null,Be(null),le&&(le(null),Le.current=!0),Fe())},e.useCallback(e=>Ze.current(e),[]);const Je=e.useCallback(()=>Ue.current(),[]),Ke=e.useRef(-1),et=e.useCallback(e=>{const t=Ge.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=Ke.current,s=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===s)return;if(e.preventDefault(),0>s)return Ke.current=-1,Ce.current=null,Be(null),le&&le(null),void Fe();const i=0>o?0:s;Ke.current=i;const r={data:(a=n[i]).datum,x:a.x,y:a.y,time:a.x,value:a.y};var a;Ce.current=r,Be(r),le&&le(r),Fe()},[le,Fe]),tt=e.useCallback(e=>{Ke.current=-1,Ze.current(e)},[]);He.current=()=>{var e,t;Pe.current=0;const n=je.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Ge.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(r),l=Le.current;l&&!a&&(i.computeScene({width:Se,height:Oe}),Le.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=Ee[0]*c,n.height=Ee[1]*c,n.style.width=Ee[0]+"px",n.style.height=Ee[1]+"px",o.scale(c,c),o.clearRect(0,0,Ee[0],Ee[1]);const u=null!==(e=null==ke?void 0:ke.threshold)&&void 0!==e?e:5e3,h=ke&&i.lastIngestTime>0&&r-i.lastIngestTime>u;h&&(o.globalAlpha=null!==(t=null==ke?void 0:ke.dimOpacity)&&void 0!==t?t:.5);const d=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",m=ye||(d&&"transparent"!==d?d:null);m&&(o.fillStyle=m,o.fillRect(0,0,Ee[0],Ee[1]));const g="radial"===E;g?(o.save(),o.translate(Me.left+Se/2,Me.top+Oe/2)):o.translate(Me.left,Me.top);const f=I[s]||[],p={width:Se,height:Oe};for(const e of f)e(o,i.scene,i.scales,p);g&&o.restore(),h&&(o.globalAlpha=1),l&&i.scales&&($e(i.scales),Re(e=>e+1)),(null==ke?void 0:ke.showBadge)&&We(!!h),(a||i.hasActivePulses)&&(Pe.current=requestAnimationFrame(()=>He.current()))},e.useEffect(()=>(Fe(),()=>{Pe.current&&(cancelAnimationFrame(Pe.current),Pe.current=0)}),[Fe]),e.useEffect(()=>{Le.current=!0,Fe()},[s,Se,Oe,ee,ye,Fe]),e.useEffect(()=>{if(!ke)return;const e=setInterval(()=>{var e;const t=Ge.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ke.threshold)&&void 0!==e?e:5e3,s=n-t.lastIngestTime>o;s!==ze&&(We(s),Le.current=!0,Fe())},1e3);return()=>clearInterval(e)},[ke,ze,Fe]);const nt=Te&&Ne?ae?ae(Ne):r.createElement(F,{hover:Ne}):null,ot="radial"===E,st=Ne?ot?Ne.x+Se/2:Ne.x:0,it=Ne?ot?Ne.y+Oe/2:Ne.y:0,rt=nt?r.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Me.left+st,top:Me.top+it,transform:`translate(${st>.7*Se?"calc(-100% - 12px)":"12px"}, ${.3*Oe>it?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},nt):null;return r.createElement("div",{ref:Ae,className:"stream-ordinal-frame"+(pe?" "+pe:""),role:"img","aria-label":"string"==typeof fe?fe:"Ordinal chart",tabIndex:0,style:{position:"relative",width:S?"100%":Ee[0],height:O?"100%":Ee[1]},onMouseMove:Te?tt:void 0,onMouseLeave:Te?Je:void 0,onKeyDown:et},me&&r.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ee[0],height:Ee[1],pointerEvents:"none"}},r.createElement("g",{transform:`translate(${Me.left},${Me.top})`},me)),r.createElement("canvas",{ref:je,style:{position:"absolute",top:0,left:0,width:Ee[0],height:Ee[1]}}),r.createElement(B,{width:Se,height:Oe,totalWidth:Ee[0],totalHeight:Ee[1],margin:Me,scales:_e,showAxes:ee,oLabel:te,rLabel:ne,oFormat:oe,rFormat:se,showGrid:he,title:fe,legend:de,foregroundGraphics:ge,annotations:ce,svgAnnotationRules:ue,annotationFrame:De,xAccessor:"string"==typeof c?c:void 0,yAccessor:"string"==typeof u?u:void 0,annotationData:null===(o=Ge.current)||void 0===o?void 0:o.getData()}),ve&&"radial"===E&&r.createElement("div",{style:{position:"absolute",left:Me.left+Se/2,top:Me.top+Oe/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ve),(null==ke?void 0:ke.showBadge)&&r.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ke.badgePosition?{top:4,left:4}:"bottom-left"===ke.badgePosition?{bottom:4,left:4}:"bottom-right"===ke.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ze?"#dc3545":"#28a745",color:"white"})},ze?"STALE":"LIVE"),rt)});V.displayName="StreamOrdinalFrame";const X={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},Y=s.schemeCategory10;function Q(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Y[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+""))%Y.length]}function Z(e,n,o="category10"){const s=Array.from(new Set(e.map(e=>e[n]))),i=s.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(s).range(o).unknown("#999");const r=X[o]||X.category10;if(i&&"function"==typeof r)return e=>r(Number(e)/Math.max(...s.map(Number)));{const e=Array.isArray(r)?r:Y;return t.scaleOrdinal().domain(s).range(e).unknown("#999")}}const U=e.createContext(null);function J(e,t,n){return t?o=>{var s;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!==(s=null==n?void 0:n.unselectedOpacity)&&void 0!==s?s:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function K(t){const n=e.createContext(null),o=ee(t);return[function({children:o}){const s=e.useMemo(()=>ee(t),[]);return r.createElement(n.Provider,{value:s,children:o})},t=>{var s;const i=null!==(s=e.useContext(n))&&void 0!==s?s:o;return function(t,n){const[o,s]=e.useState(n);return e.useLayoutEffect(()=>t(()=>s(n)),[t]),o}(i.subscribe,()=>t(i.getState()))}]}function ee(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 te(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,s]=o.range;t.push(t=>{const o=t[n];return o>=e&&s>=o})}return e=>t.every(t=>t(e))}function ne(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[oe,se]=K(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),s=ne(o,t),i=new Map(s.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},s),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const s=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),s.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:s}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),s=ne(o,t);return o.set(t,Object.assign(Object.assign({},s),{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}})}}));function ie(t){const n=e.useId(),o=t.clientId||n,{name:s}=t,i=se(e=>e.selections.get(s)),r=se(e=>e.setClause),a=se(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,s]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(te(s));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:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};r(s,{clientId:o,type:"point",fields:t})},[o,s,r]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};r(s,{clientId:o,type:"interval",fields:t})},[o,s,r]),clear:e.useCallback(()=>{a(s,o)},[a,s,o]),clientId:o}}const[re,ae]=K(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}))}})),le="#007bff";function ce(t,n,o="category10"){const s=e.useContext(U);return e.useMemo(()=>{if(n&&"function"!=typeof n)return s&&Object.keys(s).length>0?e=>s[e]||Z(t,n,o)(e):Z(t,n,o)},[t,n,o,s])}function ue(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const s="function"==typeof(i=o)?i:e=>e[i];var i;return e.sort("asc"===n?(e,t)=>s(e)-s(t):(e,t)=>s(t)-s(e))},[t,n,o])}function he({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:s=!1,onObservation:i,chartType:r,chartId:a}){const l=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}:null}(n,o),c=ie({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:s,isActive:i,selectPoints:r,clear:a}=ie({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&r(t)},[o,r,a,n]),predicate:s,isActive:i}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),h=ae(e=>e.pushObservation),d=t?{isActive:c.isActive,predicate:c.predicate}:null,m=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(i||h){const n={timestamp:Date.now(),chartType:r||"unknown",chartId:a};if(e){let s=e.data||e.datum||e;Array.isArray(s)&&(s=s[0]);const r=Object.assign(Object.assign({},n),{type:"hover",datum:s||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(r),h&&h(r)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),h&&h(e)}}},[n,u,i,r,a,h]),g=e.useCallback(e=>{var t,n;if(i||h){const o={timestamp:Date.now(),chartType:r||"unknown",chartId:a};if(e){let s=e.data||e.datum||e;Array.isArray(s)&&(s=s[0]);const r=Object.assign(Object.assign({},o),{type:"click",datum:s||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(r),h&&h(r)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),h&&h(e)}}},[i,h,r,a]);return{activeSelectionHook:d,customHoverBehavior:m,customClickBehavior:g}}function de({data:t,colorBy:n,colorScale:o,showLegend:s,userMargin:i,defaults:r={top:50,bottom:60,left:70,right:40}}){const a=void 0!==s?s:!!n,l=e.useMemo(()=>{if(a&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:s,strokeWidth:i}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==s&&(t.stroke=s),void 0!==i&&(t.strokeWidth=i),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(s=>{const i=e.find("function"==typeof t?e=>t(e)===s:e=>e[t]===s),r=i?o(i,t,n):n?n(s):"#000000";return{label:s+"",color:r}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:Q})},[a,n,t,o]),c=e.useMemo(()=>{const e=Object.assign(Object.assign({},r),i);return l&&120>e.right&&(e.right=120),e},[r,i,l]);return{legend:l,margin:c}}const me={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 ge(e,t,n){var o,s,i,r,a,l;const c=me[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(s=t.height)&&void 0!==s?s:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(r=t.enableHover)&&void 0!==r?r:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const fe={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function pe(e,t){return"function"==typeof t?t(e):e[t]}function ye(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 ve(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||function(e={}){const{fields:t,title:n,format:o,style:s={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const l=[];if(n){const t=pe(e,n);a=ye(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,s,i;"string"==typeof t?(n=t,s=t,i=o):(n=t.label,s=t.accessor||t.key||"",i=t.format||o);const r=pe(e,s);l.push({label:n,value:ye(r,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=ye(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=ye(e[t[0]],o))}}const c=Object.assign(Object.assign({},fe),s);return r.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:c},a&&r.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((e,t)=>r.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&r.createElement("span",null,e.label,": "),e.value)))}}(e)))}function be(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function xe(e,t){return"function"==typeof t?t(e):e[t]}function we({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:s=!1}){return i=>{var a;const l=s?(null===(a=i.data)||void 0===a?void 0:a[0])||i.data||i:i.data||i,c=xe(l,e),u=xe(l,t),h=n?xe(l,n):void 0;return r.createElement("div",{className:"semiotic-tooltip",style:fe},r.createElement("div",{style:{fontWeight:"bold"}},be(c)),r.createElement("div",{style:{marginTop:4}},be(u)),null!=h&&r.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(d=n)?d:"value"),": ",be(h)));var d}}function ke({componentName:e,message:t,width:n,height:o}){return r.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,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"}},r.createElement("div",{style:{textAlign:"center",maxWidth:400}},r.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),r.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}class Ae extends r.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,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:r.createElement(ke,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Ee;const Me="undefined"!=typeof process&&"production"!==(null===(Ee=process.env)||void 0===Ee?void 0:Ee.NODE_ENV);function Se({componentName:e,width:t,height:n,children:o}){return r.createElement(Ae,{fallback:o=>r.createElement(ke,{componentName:e,message:o.message,width:t,height:n})},o)}function Oe(e,t,n,o){if(!Me)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const s=t[0];if(!s||"object"!=typeof s)return;if(o in s)return;const i=Object.keys(s).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function je(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||t[0]}function Le({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(!t||!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=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[s,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=je(i,t),o=n?` Try ${s}="${n}".`:"";return`${e}: ${s} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Pe(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",sort:m=!1,barPadding:g=5,tooltip:f,annotations:p,frameProps:y={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[];Oe("BarChart",P,"categoryAccessor",a),Oe("BarChart",P,"valueAccessor",l);const{activeSelectionHook:C,customHoverBehavior:H}=he({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),N=ue(P,m,l),B=ce(P,h,d),_=e.useMemo(()=>e=>{const t={};return t.fill=h?Q(e,h,B):le,t},[h,B]),$=e.useMemo(()=>J(_,C,v),[_,C,v]),{legend:D,margin:R}=de({data:N,colorBy:h,colorScale:B,showLegend:S,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>we({categoryAccessor:a,valueAccessor:l,groupAccessor:h&&h!==a?h:void 0,groupLabel:"string"==typeof h?h:"group"}),[a,l,h]),W=Le({componentName:"BarChart",data:P,accessors:{categoryAccessor:a,valueAccessor:l}});if(W)return r.createElement(ke,{componentName:"BarChart",message:W,width:k,height:A});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:N,oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:$,size:[k,A],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R,barPadding:g,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:u,showGrid:M,oSort:m},D&&{legend:D}),O&&{title:O}),i&&{className:i}),{tooltipContent:f?ve(f):z}),(b||x)&&{customHoverBehavior:H}),p&&p.length>0&&{annotations:p}),y);return r.createElement(Se,{componentName:"BarChart",width:k,height:A},r.createElement(V,Object.assign({},T)))}function Ce(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:h,colorBy:d,colorScheme:m="category10",normalize:g=!1,barPadding:f=5,tooltip:p,annotations:y,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=n.width,E=n.height,M=n.enableHover,S=n.showGrid,O=n.showLegend,j=n.title,L=n.categoryLabel,P=n.valueLabel,C=o||[],H=d||l,{activeSelectionHook:N,customHoverBehavior:B}=he({selection:b,linkedHover:x,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),_=ce(C,H,m),$=e.useMemo(()=>e=>H?{fill:Q(e,H,_)}:{fill:le},[H,_]),D=e.useMemo(()=>J($,N,b),[$,N,b]),{legend:R,margin:z}=de({data:C,colorBy:H,colorScale:_,showLegend:O,userMargin:s,defaults:n.marginDefaults}),W=e.useMemo(()=>we({categoryAccessor:l,valueAccessor:c,groupAccessor:a}),[l,a,c]),T=Le({componentName:"StackedBarChart",data:C,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}});if(T)return r.createElement(ke,{componentName:"StackedBarChart",message:T,width:A,height:E});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:C,oAccessor:a,rAccessor:c,stackBy:l,normalize:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:D,size:[A,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z,barPadding:f,enableHover:M,showAxes:n.showAxes,oLabel:L,rLabel:P,rFormat:h,showGrid:S},R&&{legend:R}),j&&{title:j}),i&&{className:i}),{tooltipContent:p?ve(p):W}),(x||w)&&{customHoverBehavior:B}),y&&y.length>0&&{annotations:y}),v);return r.createElement(Se,{componentName:"StackedBarChart",width:A,height:E},r.createElement(V,Object.assign({},I)))}function He(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:h,colorBy:d,colorScheme:m="category10",barPadding:g=5,tooltip:f,annotations:p,frameProps:y={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],C=d||l,{activeSelectionHook:H,customHoverBehavior:N}=he({selection:v,linkedHover:b,fallbackFields:C?["string"==typeof C?C:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),B=ce(P,C,m),_=e.useMemo(()=>e=>C?{fill:Q(e,C,B)}:{fill:le},[C,B]),$=e.useMemo(()=>J(_,H,v),[_,H,v]),{legend:D,margin:R}=de({data:P,colorBy:C,colorScale:B,showLegend:S,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>we({categoryAccessor:l,valueAccessor:c,groupAccessor:a}),[l,a,c]),W=Le({componentName:"GroupedBarChart",data:P,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}});if(W)return r.createElement(ke,{componentName:"GroupedBarChart",message:W,width:k,height:A});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:P,oAccessor:a,rAccessor:c,groupBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:$,size:[k,A],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R,barPadding:g,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:h,showGrid:M},D&&{legend:D}),O&&{title:O}),i&&{className:i}),{tooltipContent:f?ve(f):z}),(b||x)&&{customHoverBehavior:N}),p&&p.length>0&&{annotations:p}),y);return r.createElement(Se,{componentName:"GroupedBarChart",width:k,height:A},r.createElement(V,Object.assign({},T)))}function Ne(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",sizeBy:m,sizeRange:g=[3,8],pointRadius:f=4,pointOpacity:p=.7,categoryPadding:y=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:E}=t,M=n.width,S=n.height,O=n.enableHover,j=n.showGrid,L=n.showLegend,P=n.title,C=n.categoryLabel,H=n.valueLabel,N=o||[],{activeSelectionHook:B,customHoverBehavior:_}=he({selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:E}),$=ce(N,h,d),D=e.useMemo(()=>{if(!m)return;const e=N.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[N,m]),R=e.useMemo(()=>e=>{const t={fillOpacity:p};return t.fill=h?Q(e,h,$):le,t.r=m?function(e,t,n=[3,20],o){let s;if(s="function"==typeof t?t(e):e[t],!o)return s;const[i,r]=o,[a,l]=n;return r===i?(a+l)/2:a+(s-i)/(r-i)*(l-a)}(e,m,g,D):f,t},[h,$,m,g,D,f,p]),z=e.useMemo(()=>J(R,B,w),[R,B,w]),{legend:W,margin:T}=de({data:N,colorBy:h,colorScale:$,showLegend:L,userMargin:s,defaults:n.marginDefaults}),I=e.useMemo(()=>we({categoryAccessor:a,valueAccessor:l,groupAccessor:h||void 0}),[a,l,h]),q=Le({componentName:"SwarmPlot",data:N,accessors:{categoryAccessor:a,valueAccessor:l}});if(q)return r.createElement(ke,{componentName:"SwarmPlot",message:q,width:M,height:S});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:N,oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:z,size:[M,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:y,enableHover:O,showAxes:n.showAxes,oLabel:C,rLabel:H,rFormat:u,showGrid:j},W&&{legend:W}),P&&{title:P}),i&&{className:i}),{tooltipContent:v?ve(v):I}),(k||A)&&{customHoverBehavior:_}),b&&b.length>0&&{annotations:b}),x);return r.createElement(Se,{componentName:"SwarmPlot",width:M,height:S},r.createElement(V,Object.assign({},G)))}function Be(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",showOutliers:m=!0,categoryPadding:g=20,tooltip:f,annotations:p,frameProps:y={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],{activeSelectionHook:C,customHoverBehavior:H}=he({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),N=ce(P,h,d),B=e.useMemo(()=>e=>{const t=h?Q(e,h,N):le;return{fill:t,stroke:t,fillOpacity:.8}},[h,N]),_=e.useMemo(()=>J(B,C,v),[B,C,v]),{legend:$,margin:D}=de({data:P,colorBy:h,colorScale:N,showLegend:S,userMargin:s,defaults:n.marginDefaults}),R=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return r.createElement("div",{className:"semiotic-tooltip",style:fe},r.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&r.createElement(r.Fragment,null,null!=t.n&&r.createElement("div",null,"n = ",t.n),r.createElement("div",null,"Median: ",t.median.toLocaleString()),r.createElement("div",null,"Q1: ",t.q1.toLocaleString()),r.createElement("div",null,"Q3: ",t.q3.toLocaleString()),r.createElement("div",null,"Min: ",t.min.toLocaleString()),r.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),z=Le({componentName:"BoxPlot",data:P,accessors:{categoryAccessor:a,valueAccessor:l}});if(z)return r.createElement(ke,{componentName:"BoxPlot",message:z,width:k,height:A});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:P,oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:_,showOutliers:m,size:[k,A],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D,barPadding:g,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:u,showGrid:M},$&&{legend:$}),O&&{title:O}),i&&{className:i}),{tooltipContent:f?ve(f):R}),(b||x)&&{customHoverBehavior:H}),p&&p.length>0&&{annotations:p}),y);return r.createElement(Se,{componentName:"BoxPlot",width:k,height:A},r.createElement(V,Object.assign({},W)))}function _e(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:h,colorBy:d,colorScheme:m="category10",categoryPadding:g=20,tooltip:f,annotations:p,frameProps:y={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],{activeSelectionHook:C,customHoverBehavior:H}=he({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),N=ce(P,d,m),B=e.useMemo(()=>e=>{const t=d?Q(e,d,N):le;return{fill:t,stroke:t,fillOpacity:.8}},[d,N]),_=e.useMemo(()=>J(B,C,v),[B,C,v]),{legend:$,margin:D}=de({data:P,colorBy:d,colorScale:N,showLegend:S,userMargin:s,defaults:n.marginDefaults}),R=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,s=t.range;return r.createElement("div",{className:"semiotic-tooltip",style:fe},n&&r.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&r.createElement("div",null,"Count: ",o),s&&2===s.length&&r.createElement("div",{style:{opacity:.8}},Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)))},[]),z=Le({componentName:"Histogram",data:P,accessors:{categoryAccessor:a,valueAccessor:l}});if(z)return r.createElement(ke,{componentName:"Histogram",message:z,width:k,height:A});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:P,oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:_,bins:c,normalize:u,size:[k,A],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D,barPadding:g,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:h,showGrid:M},$&&{legend:$}),O&&{title:O}),i&&{className:i}),{tooltipContent:f?ve(f):R}),(b||x)&&{customHoverBehavior:H}),p&&p.length>0&&{annotations:p}),y);return r.createElement(Se,{componentName:"Histogram",width:k,height:A},r.createElement(V,Object.assign({},W)))}function $e(t){const n=ge(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:i,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,showIQR:h=!0,valueFormat:d,colorBy:m,colorScheme:g="category10",categoryPadding:f=20,tooltip:p,annotations:y,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=n.width,E=n.height,M=n.enableHover,S=n.showGrid,O=n.showLegend,j=n.title,L=n.categoryLabel,P=n.valueLabel,C=o||[],{activeSelectionHook:H,customHoverBehavior:N}=he({selection:b,linkedHover:x,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),B=ce(C,m,g),_=e.useMemo(()=>e=>{const t=m?Q(e,m,B):le;return{fill:t,stroke:t,fillOpacity:.6}},[m,B]),$=e.useMemo(()=>J(_,H,b),[_,H,b]),{legend:D,margin:R}=de({data:C,colorBy:m,colorScale:B,showLegend:O,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return r.createElement("div",{className:"semiotic-tooltip",style:fe},n&&r.createElement("div",{style:{fontWeight:"bold"}},n+""),r.createElement("div",null,"n = ",o.n),r.createElement("div",null,"Min: ",o.min.toLocaleString()),r.createElement("div",null,"Q1: ",o.q1.toLocaleString()),r.createElement("div",null,"Median: ",o.median.toLocaleString()),r.createElement("div",null,"Q3: ",o.q3.toLocaleString()),r.createElement("div",null,"Max: ",o.max.toLocaleString()),r.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const s=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof l?l(e):e[l];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),i=s.length,a=i>0?s[Math.floor(i/2)]:null;return r.createElement("div",{className:"semiotic-tooltip",style:fe},n&&r.createElement("div",{style:{fontWeight:"bold"}},n+""),i>0&&r.createElement("div",null,"n = ",i),null!=a&&r.createElement("div",null,"Median: ",a.toLocaleString()))},[l]),W=Le({componentName:"ViolinPlot",data:C,accessors:{categoryAccessor:a,valueAccessor:l}});if(W)return r.createElement(ke,{componentName:"ViolinPlot",message:W,width:A,height:E});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:C,oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:$,bins:u,showIQR:h,size:[A,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R,barPadding:f,enableHover:M,showAxes:n.showAxes,oLabel:L,rLabel:P,rFormat:d,showGrid:S},D&&{legend:D}),j&&{title:j}),i&&{className:i}),{tooltipContent:p?ve(p):z}),(x||w)&&{customHoverBehavior:N}),y&&y.length>0&&{annotations:y}),v);return r.createElement(Se,{componentName:"ViolinPlot",width:A,height:E},r.createElement(V,Object.assign({},T)))}function De(t){var n;const o=ge(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:s,margin:i,className:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",valueFormat:h,colorBy:d,colorScheme:m="category10",sort:g=!0,dotRadius:f=5,categoryPadding:p=10,tooltip:y,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A}=t,E=o.width,M=o.height,S=o.enableHover,O=o.showGrid,j=o.showLegend,L=o.title,P=o.categoryLabel,C=o.valueLabel,H=s||[],{activeSelectionHook:N,customHoverBehavior:B}=he({selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),_=ue(H,g,c),$=ce(H,d,m),D=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=d?Q(e,d,$):le,t},[d,$,f]),R=e.useMemo(()=>J(D,N,x),[D,N,x]),{legend:z,margin:W}=de({data:_,colorBy:d,colorScale:$,showLegend:j,userMargin:i,defaults:o.marginDefaults}),T=e.useMemo(()=>we({categoryAccessor:l,valueAccessor:c}),[l,c]),I=Le({componentName:"DotPlot",data:H,accessors:{categoryAccessor:l,valueAccessor:c}});if(I)return r.createElement(ke,{componentName:"DotPlot",message:I,width:E,height:M});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:_,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:R,size:[E,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W,barPadding:p,enableHover:S,showAxes:o.showAxes,oLabel:P,rLabel:C,rFormat:h,showGrid:O,oSort:g},z&&{legend:z}),L&&{title:L}),a&&{className:a}),{tooltipContent:y?ve(y):T}),(w||k)&&{customHoverBehavior:B}),v&&v.length>0&&{annotations:v}),b);return r.createElement(Se,{componentName:"DotPlot",width:E,height:M},r.createElement(V,Object.assign({},q)))}function Re(t){var n,o;const s=ge(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",colorBy:h,colorScheme:d="category10",startAngle:m=0,tooltip:g,annotations:f,frameProps:p={},selection:y,linkedHover:v,onObservation:b,chartId:x}=t,w=s.width,k=s.height,A=s.enableHover,E=s.showLegend,M=s.title,S=i||[],O=h||c,{activeSelectionHook:j,customHoverBehavior:L}=he({selection:y,linkedHover:v,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),P=ce(S,O,d),C=e.useMemo(()=>e=>O?{fill:Q(e,O,P)}:{fill:le},[O,P]),H=e.useMemo(()=>J(C,j,y),[C,j,y]),{legend:N,margin:B}=de({data:S,colorBy:O,colorScale:P,showLegend:E,userMargin:a,defaults:s.marginDefaults}),_=e.useMemo(()=>we({categoryAccessor:c,valueAccessor:u,groupAccessor:h&&h!==c?h:void 0,groupLabel:"string"==typeof h?h:"group",pieData:!0}),[c,u,h]),$=Le({componentName:"PieChart",data:S,accessors:{categoryAccessor:c,valueAccessor:u}});if($)return r.createElement(ke,{componentName:"PieChart",message:$,width:w,height:k});const D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:S,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:H,startAngle:m,size:[w,k],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:B,enableHover:A,showAxes:!1},N&&{legend:N}),M&&{title:M}),l&&{className:l}),{tooltipContent:g?ve(g):_}),(v||b)&&{customHoverBehavior:L}),f&&f.length>0&&{annotations:f}),p);return r.createElement(Se,{componentName:"PieChart",width:w,height:k},r.createElement(V,Object.assign({},D)))}function ze(t){var n,o;const s=ge(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),{data:i,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:h=60,centerContent:d,colorBy:m,colorScheme:g="category10",startAngle:f=0,tooltip:p,annotations:y,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=s.width,E=s.height,M=s.enableHover,S=s.showLegend,O=s.title,j=i||[],L=m||c,{activeSelectionHook:P,customHoverBehavior:C}=he({selection:b,linkedHover:x,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),H=ce(j,L,g),N=e.useMemo(()=>e=>L?{fill:Q(e,L,H)}:{fill:le},[L,H]),B=e.useMemo(()=>J(N,P,b),[N,P,b]),{legend:_,margin:$}=de({data:j,colorBy:L,colorScale:H,showLegend:S,userMargin:a,defaults:s.marginDefaults}),D=e.useMemo(()=>we({categoryAccessor:c,valueAccessor:u,groupAccessor:m&&m!==c?m:void 0,groupLabel:"string"==typeof m?m:"group",pieData:!0}),[c,u,m]),R=Le({componentName:"DonutChart",data:j,accessors:{categoryAccessor:c,valueAccessor:u}});if(R)return r.createElement(ke,{componentName:"DonutChart",message:R,width:A,height:E});const z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:j,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:B,innerRadius:h,startAngle:f,centerContent:d,size:[A,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$,enableHover:M,showAxes:!1},_&&{legend:_}),O&&{title:O}),l&&{className:l}),{tooltipContent:p?ve(p):D}),(x||w)&&{customHoverBehavior:C}),y&&y.length>0&&{annotations:y}),v);return r.createElement(Se,{componentName:"DonutChart",width:A,height:E},r.createElement(V,Object.assign({},z)))}Pe.displayName="BarChart",Ce.displayName="StackedBarChart",He.displayName="GroupedBarChart",Ne.displayName="SwarmPlot",Be.displayName="BoxPlot",_e.displayName="Histogram",$e.displayName="ViolinPlot",De.displayName="DotPlot",Re.displayName="PieChart",ze.displayName="DonutChart",exports.BarChart=Pe,exports.BoxPlot=Be,exports.DonutChart=ze,exports.DotPlot=De,exports.GroupedBarChart=He,exports.Histogram=_e,exports.PieChart=Re,exports.StackedBarChart=Ce,exports.StreamOrdinalFrame=V,exports.SwarmPlot=Ne,exports.ViolinPlot=$e;
1
+ "use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-array"),o=require("d3-hierarchy"),i=require("regression"),r=require("d3-shape"),s=require("d3-scale-chromatic");function a(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const c=l(e),u=a(i),d=5e3;class h{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}clearLastData(){this.lastBoundedData=null,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,d),bounded:!0,totalSize:e.length});let t=d;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+d,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)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class g{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}}}toArray(){const e=[];for(const t of this)e.push(t);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}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 m{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 f(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function p(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 v(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=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=i(e.pieceData[0],e.name);r.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return r}function b(e){var t,o,i;const r=e.length,s=e[0],a=e[r-1];return{n:r,min:s,q1:null!==(t=n.quantile(e,.25))&&void 0!==t?t:s,median:null!==(o=n.quantile(e,.5))&&void 0!==o?o:(s+a)/2,q3:null!==(i=n.quantile(e,.75))&&void 0!==i?i:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}const x={bar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=i.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=r(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const[r,c]of t){let t=c.total;g&&n>0&&(t/=n);const m=a(c.pieces[0],s?r:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?i:o+t),s=0>t?l(i+t)-l(i):l(o)-l(o+t);u.push(p(e.x,n,e.width,Math.abs(s),m,f,r)),0>t?i+=t:o+=t}else if(h){const n=l(0>t?i+t:o),s=0>t?l(i)-l(i+t):l(o+t)-l(o);u.push(p(n,e.x,Math.abs(s),e.width,m,f,r)),0>t?i+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:i,getGroup:r,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=r?r(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=r?r(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const r=n.get(d[o])||[];for(const n of r){const r=i(n),l=s(n,e.name);if(u){const i=e.x+o*t,s=a(0),u=a(r);c.push(p(i,Math.min(s,u),t,Math.abs(s-u),l,n,d[o]))}else{const i=e.x+o*t,s=a(0),u=a(r);c.push(p(Math.min(s,u),i,Math.abs(u-s),t,l,n,d[o]))}}}}return c},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,m=a.length>0,f=2*Math.PI,y=-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=m&&a[i]||c,p=l(t,e.name),v=p.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,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:p,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),m=c?s(a):e.middle+h;l.push({type:"point",x:g,y:m,r:d,style:u,datum:o})}}return l},pie:v,donut:v,boxplot:function(e,t){var o,i,r,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:m}=l,f=[],y="vertical"===m,p=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(o=n.quantile(t,.25))&&void 0!==o?o:l,m=null!==(i=n.quantile(t,.5))&&void 0!==i?i:(l+c)/2,v=null!==(r=n.quantile(t,.75))&&void 0!==r?r:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,E=h(e.pieceData[0],e.name),S=[];if(p)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=y?e.middle:g(n),i=y?g(n):e.middle;S.push({px:o,py:i,value:n,datum:t})}}if(f.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(m),q3Pos:g(v),maxPos:g(A),stats:{n:t.length,min:k,q1:u,median:m,q3:v,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:E,datum:e.pieceData,category:e.name,outliers:S}),p)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var o,i,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],m="vertical"===h,f=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/f||1,h=Array(f).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),f-1)]++;const p=Math.max(...h,1),v=e.width/2*.9;let x="";if(m){for(let t=0;f>t;t++){const n=d(s+(t+.5)*l),o=h[t]/p*v;x+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=f-1;t>=0;t--){const n=d(s+(t+.5)*l);x+=` L ${e.middle-h[t]/p*v} ${n}`}x+=" Z"}else{for(let t=0;f>t;t++){const n=d(s+(t+.5)*l),o=h[t]/p*v;x+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=f-1;t>=0;t--)x+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/p*v}`;x+=" Z"}const w=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=n.quantile(t,.25))&&void 0!==o?o:s,c=null!==(i=n.quantile(t,.5))&&void 0!==i?i:(s+a)/2,u=null!==(r=n.quantile(t,.75))&&void 0!==r?r:a;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:m}}const A=m?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};g.push({type:"violin",pathString:x,translateX:0,translateY:0,bounds:A,iqrLine:k,stats:b(t),style:w,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:i,getR:r,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=i.bins||25,u=i.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>r(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,i=Array(c).fill(0);for(const e of t)i[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...i,1),g=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===i[t])continue;const r=(u?i[t]/d:i[t]/h)*e.width*.9,s=a(n+t*o),c=a(n+(t+1)*o);l.push(p(Math.min(s,c),e.x+e.width-r,Math.abs(c-s),r,g,{bin:t,count:i[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},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)c[Math.min(Math.floor((e-o)/r),d-1)]++;const m=Math.max(...c,1),f=a(e.pieceData[0],e.name),y=e.width*g;let p="";if(h){const t=e.x+e.width;p=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)p+=` L ${l(o+(e+.5)*r)} ${t-c[e]/m*y}`;p+=` L ${l(i)} ${t} Z`}else{const t=e.x;p=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);p+=` L ${t+c[e]/m*y} ${n}`}p+=` 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:p,translateX:0,translateY:0,bounds:v,stats:b(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.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(p(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(p(e.x,n,e.width,i-n,u,t,e.name))}}return l}};class w{constructor(e){this.rExtent=new m,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new g(e.windowSize),this.getO=y(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>f(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new m)):(this.getR=f(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=y(e.stackBy),this.getGroup=y(e.groupBy),this.getColor=y(e.colorAccessor),this.getConnector=y(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new g(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),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 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.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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.toArray(),r=n.projection||"vertical",s=n.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c=null!=n.barPadding?n.barPadding/("vertical"===r?e.width:e.height):.1;let u,d;if("radial"===r){u=t.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=n.innerRadius||0;d=t.scaleLinear().domain(a).range([i,o])}else l?(u=t.scaleBand().domain(s).range([0,e.height]).padding(c),d=t.scaleLinear().domain(a).range([0,e.width])):(u=t.scaleBand().domain(s).range([0,e.width]).padding(c),d=t.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((i,r)=>{const s=this.rExtents[r];s.dirty&&s.recalculate(o,i);let[a,c]=s.extent;a===1/0&&(a=0,c=1);const u=c-a,d=u>0?u*(n.extentPadding||.05):1;return a-=d,c+=d,a>0&&(a=0),l?t.scaleLinear().domain([a,c]).range([0,e.width]):t.scaleLinear().domain([a,c]).range([e.height,0])}):[];let h=i;this.rAccessors.length>1&&(h=i.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,s,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const i=this.config.chartType,r=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===i||"donut"===i))return[0,1];let s=0,a=0;if("bar"===i&&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>a&&(a=e);for(const e of n.values())s>e&&(s=e)}else if("bar"===i){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>a&&(a=e),s>e&&(s=e)}else if("clusterbar"===i)for(const t of e){const e=this.getR(t);e>a&&(a=e),s>e&&(s=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(s=e),t!==-1/0&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-s,c=l>0?l*r:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(s-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(a+=c),"bar"!==i&&"clusterbar"!==i||(s>0&&(s=0),0>a&&(a=0)),[s,a]}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=x[this.config.chartType];let i=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:i,getO:r}=e;if(!i||!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=i(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:r(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],i=t[n+1],r="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:i.x,y2:i.y,style:r,datum:o.datum,group:e})}}return s}(n,i);i=[...e,...i]}return i}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):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:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],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){var n,o,i;const r=this.config.decay;if(!r||1>=t)return 1;const s=null!==(n=r.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(r.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=r.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(i=r.stepThreshold)&&void 0!==i?i:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],e);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=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);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;let o=0;for(let n=0;t.length>n;n++){const i=t[n],a=this.config.oAccessor;if(("function"==typeof a?a(i):i[a||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=r-l;if(s>c){const e=1-c/s;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,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}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const i=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const r=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const r=this.scene[e];let a=null;if("point"===r.type?a="p:"+e:"rect"===r.type&&(a=`r:${r.group||""}:${null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===r.type?l.x===r.x&&l.y===r.y||(r._targetX=r.x,r._targetY=r.y,r.x=l.x,r.y=l.y,s=!0):"rect"===r.type&&(l.x===r.x&&l.y===r.y&&l.w===r.w&&l.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=l.x,r.y=l.y,r.w=null!==(o=l.w)&&void 0!==o?o:r.w,r.h=null!==(i=l.h)&&void 0!==i?i:r.h,s=!0)))}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:r})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const i=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),r="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?i:1-Math.pow(1-i,3);for(let e=0;this.scene.length>e;e++){const t=this.scene[e];if("point"===t.type){if(void 0===t._targetX)continue;const n=this.prevPositionMap.get("p:"+e);if(!n)continue;t.x=n.x+(t._targetX-n.x)*r,t.y=n.y+(t._targetY-n.y)*r}else if("rect"===t.type){if(void 0===t._targetX)continue;const i=`r:${t.group||""}:${null!==(o=null===(n=t.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:e}`,s=this.prevPositionMap.get(i);if(!s)continue;t.x=s.x+(t._targetX-s.x)*r,t.y=s.y+(t._targetY-s.y)*r,void 0!==s.w&&(t.w=s.w+(t._targetW-s.w)*r,t.h=s.h+(t._targetH-s.h)*r)}}if(i>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=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}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function k(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function A(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 E(e,t,n){const o=t-e.x,i=n-e.y,r=Math.sqrt(o*o+i*i);return r>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:r}}function S(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=k(Math.atan2(i,o)),a=k(e.startAngle),l=k(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 M(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 O(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}}const L={fill:e=>c.createElement("rect",{style:e,width:20,height:20}),line:e=>c.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function C(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,L[n])(o(e,t)),i}function j(){return c.createElement("path",{d:"M2,6 L5,9 L10,3",fill:"none",stroke:"currentColor",strokeWidth:1.5,transform:"translate(-14, 5)"})}function P(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function H(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r,title:s="Legend",width:a=100,height:l=20,orientation:u="vertical"}=e,d="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r})=>{let s=30;const a=[];return e.forEach((e,l)=>{s+=5,a.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:0,y1:s,x2:t,y2:s})),s+=10,e.label&&(s+=20,a.push(c.createElement("text",{key:"legend-text-"+l,y:s,className:"legend-group-label"},e.label)),s+=10),a.push(c.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(0,${s})`},((e,t,n,o,i)=>{const{type:r="fill",styleFn:s,items:a}=e,l=[];let u=0;const d=!(!t&&!n);return a.forEach((e,a)=>{const h=C(e,a,r,s),g=P(e,o,i),m=i&&i.size>0&&i.has(e.label);l.push(c.createElement("g",{key:"legend-item-"+a,transform:`translate(0,${u})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,style:{cursor:d?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&c.createElement(j,null),h,c.createElement("text",{y:15,x:30},e.label))),u+=25}),l})(e,n,o,i,r))),s+=25*e.items.length+10}),a})({legendGroups:t,width:a,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r}):(({legendGroups:e,title:t,height:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s})=>{let a=0;const l=[],u=!1===t?10:40;return e.forEach((t,d)=>{t.label&&(l.push(c.createElement("text",{key:"legend-text-"+d,transform:`translate(${a},${u}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),a+=20);const h=((e,t,n,o,i)=>{const{type:r="fill",styleFn:s,items:a}=e,l=[];let u=0;const d=!(!t&&!n);return a.forEach((e,a)=>{const h=C(e,a,r,s),g=P(e,o,i),m=i&&i.size>0&&i.has(e.label);l.push(c.createElement("g",{key:"legend-item-"+a,transform:`translate(${u},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,style:{cursor:d?"pointer":"default",opacity:g,transition:"opacity 150ms ease",pointerEvents:"all"}},m&&c.createElement(j,null),h,c.createElement("text",{y:15,x:25},e.label))),u+=35,u+=8*e.label.length}),{items:l,offset:u}})(t,o,i,r,s);l.push(c.createElement("g",{key:"legend-group-"+d,className:"legend-item",transform:`translate(${a},${u})`},h.items)),a+=h.offset+5,e[d+1]&&l.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+d,stroke:"gray",x1:a,y1:u-10,x2:a,y2:n+u+10})),a+=15}),c.createElement("g",null,!1!==t&&c.createElement("line",{x1:0,x2:a+10,y1:u-10,y2:u-10,stroke:"gray",className:"title-neatline"}),l)})({legendGroups:t,title:s,height:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:r});return c.createElement("g",null,void 0!==s&&c.createElement("text",{className:"legend-title",y:20,x:"horizontal"===u?0:a/2,textAnchor:"horizontal"===u?"start":"middle"},s),d)}function B(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 N(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){const{x:t=0,y:n=0,dx:o,dy:i,nx:r,ny:s,note:a,connector:l,subject:u,type:d,color:h,className:g,disable:m,events:f={},"data-testid":y}=e,p=new Set(Array.isArray(m)?m:[]);let v=o||0,b=i||0;null!=r&&(v=r-t),null!=s&&(b=s-n);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 c.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!p.has("connector")&&function(e,t,n,o,i,r){const s=[];let a=0,l=0;if("callout-circle"!==i&&"label"!==i||!(null==r?void 0:r.radius)){if("callout-rect"===i&&r){const n=r.width||0,o=r.height||0;if(n>0||o>0){const i=n/2,r=o/2,s=e-i,c=t-r;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=i+s*h,l=r+c*h}}}else if("bracket"===i&&r){const e=r.width,t=r.height,n=r.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(r.radius||0)+(r.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(t-l,2))>.5&&(s.push(c.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,i=16/180*Math.PI,r=Math.atan2(t-l,e-a);s.push(c.createElement("path",{key:"connector-arrow",d:`M${a},${l}L${a+n*Math.cos(r+i)},${l+n*Math.sin(r+i)}L${a+n*Math.cos(r-i)},${l+n*Math.sin(r-i)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},s)}(v,b,l,h,x,u),!p.has("subject")&&function(e,t,n,o,i){var r;const s=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&s.push(c.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&s.push(c.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&s.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,r=i||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;s.push(c.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-r,x2:o,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-r;s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(c.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-r,x2:0,y2:(t.y2||0)-r,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(r=null==t?void 0:t.width)&&void 0!==r?r:null==t?void 0:t.height;void 0!==e&&s.push(c.createElement("path",{key:"bracket-path",d:N((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return c.createElement("g",{className:"annotation-subject"},s)}(x,u,h,t,n),!p.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:i,title:r,orientation:s,align:a,wrap:l=120,noWrap:u}=e;if(!i&&!r)return c.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const m=16,f=r?u?[r]:B(r,l):[],y=i?u?[i]:B(i,l):[],p="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},f.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e)))),v=f.length*m),y.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},y.map((e,t)=>c.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e))));let x=null;if((r||i)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*m+(y.length>0?m:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===d?k=0>n?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+m+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),c.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},c.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(a,v,b,h))}function $(e){var t,n;const{noteData:o}=e,{screenCoordinates:i}=o,r="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&i){const e=o.nx||i[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),s=o.ny||i[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),a=i.map((t,n)=>{const i=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:s});return c.createElement(_,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},i,{type:r}))});return c.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return c.createElement(_,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:r}))}function W(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 D(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 R(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function z(e){return Math.round(100*e)/100+""}function I(t){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:d,oLabel:h,rLabel:g,oFormat:m,rFormat:f,showGrid:y,title:p,legend:v,legendHoverBehavior:b,legendClickBehavior:x,legendHighlightedCategory:w,legendIsolatedCategories:k,foregroundGraphics:A,annotations:E,svgAnnotationRules:S,annotationFrame:M,xAccessor:O,yAccessor:L,annotationData:C,children:j}=t,P="radial"===(null==l?void 0:l.projection),B="horizontal"===(null==l?void 0:l.projection),N=e.useMemo(()=>d&&l&&!P?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:m?m(e):e}}):[],[d,l,m,P]),_=e.useMemo(()=>d&&l&&!P?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(f||z)(e)})):[],[d,l,f,P]),I=e.useMemo(()=>{if(!E||0===E.length)return null;const e=function(e,t,n){var i,r,s,a,l,d,h,g,m,f,y,p,v,b,x,w,k,A,E,S,M,O,L,C,j,P,H,B,N,_,z,I,T,q,F,G,V,X,Y,Q,Z,U,J,K;switch(e.type){case"label":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else o=W(e,n),i=D(e,n);return null==o||null==i?null:R(o,i,n)?c.createElement($,{key:"ann-"+t,noteData:{x:o,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else o=W(e,n),i=D(e,n);return null==o||null==i?null:R(o,i,n)?c.createElement($,{key:"ann-"+t,noteData:{x:o,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=W(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=D(e,n);if(null==o)return null;const i=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const i=(e.coordinates||[]).map(e=>({x:W(Object.assign(Object.assign({},e),{type:"point"}),n),y:D(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=o.packEnclose(i),s=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:W(Object.assign(Object.assign({},e),{type:"point"}),n),y:D(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=e.padding||10,r=o.map(e=>e.x),s=o.map(e=>e.y),a=Math.min(...r)-i,l=Math.max(...r)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:a,y:u,width:l-a,height:d-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:(a+l)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],i="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],r=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},i.map((t,o)=>{const i=W(t,n),s=D(t,n);return null==i||null==s?null:c.createElement("circle",Object.assign({key:o,cx:i,cy:s,r:e.r||6},r))}))}case"bracket":{const o=W(e,n),i=D(e,n);return c.createElement($,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=i?i:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const o=n.data||[];if(2>o.length)return null;const g=n.xAccessor||"x",m=n.yAccessor||"y",f=o.map(e=>[e[g],e[m]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const y=null!==(r=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(s=n.scales)||void 0===s?void 0:s.time,p=null!==(l=null===(a=n.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(d=n.scales)||void 0===d?void 0:d.value;if(!y||!p)return null;const v=e.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,m=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],m+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*m-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(f,null!==(h=e.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?u.default.polynomial(f,{order:e.order||2}):u.default.linear(f)).points;const x=b.map(([e,t])=>`${y(e)},${p(t)}`).join(" "),w=e.color||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:y(b[b.length-1][0])+4,y:p(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(m=null===(g=n.scales)||void 0===g?void 0:g.y)&&void 0!==m?m:null===(f=n.scales)||void 0===f?void 0:f.value,i=null!==(y=null==o?void 0:o(e.y0))&&void 0!==y?y:0,r=null!==(p=null==o?void 0:o(e.y1))&&void 0!==p?p:n.height||0;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:0,y:Math.min(i,r),width:n.width||0,height:Math.abs(r-i),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(i,r)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const i=n.xAccessor||"x",r=null!==(b=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==b?b:null===(x=n.scales)||void 0===x?void 0:x.time,s=null!==(k=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==k?k:null===(A=n.scales)||void 0===A?void 0:A.value;if(!r||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[a]&&null!=e[l]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=d.map(e=>`${r(e[i])},${s(e[a])}`).join(" L"),g=d.slice().reverse().map(e=>`${r(e[i])},${s(e[l])}`).join(" L"),m=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:`M${h} L${g} Z`,fill:m,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&c.createElement("text",{x:r(d[d.length-1][i])+4,y:s(d[d.length-1][a])-4,fill:m,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const i=n.yAccessor||"y",r=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(O=n.scales)||void 0===O?void 0:O.time,s=null!==(C=null===(L=n.scales)||void 0===L?void 0:L.y)&&void 0!==C?C:null===(j=n.scales)||void 0===j?void 0:j.value;if(!r||!s)return null;const a=o.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,d=Math.sqrt(u),h=null!==(P=e.threshold)&&void 0!==P?P:2,g=l-h*d,m=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(H=e.fillOpacity)&&void 0!==H?H:.1,p=e.anomalyColor||"#ef4444",v=null!==(B=e.anomalyRadius)&&void 0!==B?B:6,b=s(l+h*d),x=s(g),w=o.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},m&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),w.map((e,t)=>{const o=W(e,n),i=D(e,n);return null==o||null==i?null:c.createElement("circle",{key:t,cx:o,cy:i,r:v,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const i=n.xAccessor||"x",r=n.yAccessor||"y",s=null!==(_=null===(N=n.scales)||void 0===N?void 0:N.x)&&void 0!==_?_:null===(z=n.scales)||void 0===z?void 0:z.time,a=null!==(T=null===(I=n.scales)||void 0===I?void 0:I.y)&&void 0!==T?T:null===(q=n.scales)||void 0===q?void 0:q.value;if(!s||!a)return null;const l=o.map(e=>[e[i],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let d;if("polynomial"===(e.method||"linear")){const t=u.default.polynomial(l,{order:e.order||2}).equation;d=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,i=0;for(const[e,r]of l)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=l.length,g=l.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),m=Math.sqrt(g/Math.max(h-2,1)),f=l.reduce((e,t)=>e+t[0],0)/h,y=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),p=null!==(F=e.confidence)&&void 0!==F?F:.95,v=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=null!==(G=e.steps)&&void 0!==G?G:5,x=l[h-1][0],w=(x-l[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=d(e),n=m*Math.sqrt(1+1/h+(y>0?Math.pow(e-f,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const E=`M${A.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(x)},${a(d(x))}`,O=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:E,fill:e.fill||"#6366f1",fillOpacity:null!==(V=e.fillOpacity)&&void 0!==V?V:.15,stroke:"none"}),c.createElement("polyline",{points:`${M} ${S}`,fill:"none",stroke:O,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(Y=e.strokeDasharray)&&void 0!==Y?Y:"6,3"}),e.label&&A.length>0&&c.createElement("text",{x:s(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:O,fontSize:11},e.label))}case"widget":{let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,i=t.y}else null!=e.px&&null!=e.py?(o=e.px,i=e.py):(o=W(e,n),i=D(e,n));if(null==o||null==i)return null;if(!R(o,i,n))return null;const r=null!==(Q=e.dx)&&void 0!==Q?Q:0,s=null!==(Z=e.dy)&&void 0!==Z?Z:0,a=null!==(U=e.width)&&void 0!==U?U:32,l=null!==(J=e.height)&&void 0!==J?J:32,u=null!==(K=e.content)&&void 0!==K?K:c.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return c.createElement("foreignObject",{key:"ann-"+t,x:o+r-a/2,y:i+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},c.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const o=W(e,n),i=D(e,n);return null==o||null==i?null:c.createElement("text",{key:"ann-text-"+t,x:o+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t="horizontal"===(null==l?void 0:l.projection),r=(null==l?void 0:l.o)?e=>{var t;return(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2}:null,s={scales:l?{x:t?l.r:r||l.r,y:t&&r||l.r,time:l.r,value:l.r}:null,timeAxis:"x",xAccessor:O,yAccessor:L,width:n,height:i,data:C,frameType:"ordinal"};return E.map((t,n)=>{if(S){const o=S(t,n,s);return null!=o?o:e(t,n,s)}return e(t,n,s)}).filter(Boolean)},[E,S,n,i,M,O,L,C]);return d||p||v||A||I&&I.length>0||y||j?c.createElement("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&l&&!P&&c.createElement("g",{className:"ordinal-grid"},_.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:B?e.pixel:0,y1:B?0:e.pixel,x2:B?e.pixel:n,y2:B?i:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),d&&l&&!P&&c.createElement("g",{className:"ordinal-axes"},B?c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&c.createElement("text",{x:15-a.left,y:i/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-a.left}, ${i/2})`,style:{userSelect:"none"}},h),c.createElement("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${i})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),g&&c.createElement("text",{x:n/2,y:i+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},g)):c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${i})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&c.createElement("text",{x:n/2,y:i+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},h),c.createElement("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),_.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),g&&c.createElement("text",{x:15-a.left,y:i/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-a.left}, ${i/2})`,style:{userSelect:"none"}},g))),I,A,j),p&&c.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof p?p:null),v&&c.createElement("g",{transform:`translate(${r-a.right+10}, ${a.top})`},"object"==typeof(T=v)&&null!==T&&!c.isValidElement(T)&&"legendGroups"in T?c.createElement(H,{legendGroups:v.legendGroups,title:"",width:100,customHoverBehavior:b,customClickBehavior:x,highlightedCategory:w,isolatedCategories:k}):v)):null;var T}const T="undefined"==typeof window||"undefined"==typeof document,q=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?F(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function F(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.w)-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 G=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);for(const t of s){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;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(r=t._pulseGlowRadius)&&void 0!==r?r:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.x,t.y,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.globalAlpha=1}};function V(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()}const X=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s)V(e,t),e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(V(e,t),e.globalAlpha=.35*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill()),e.globalAlpha=1},Y=(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=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},Q=(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=n.style.stroke||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}},Z=e=>[Q,...e],U={bar:Z([q]),clusterbar:Z([q]),point:Z([G]),swarm:Z([G]),pie:[X],donut:[X],boxplot:Z([(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=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.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),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()}},G]),violin:Z([Y]),histogram:Z([q]),ridgeline:Z([Y]),timeline:Z([q])},J={top:50,right:40,bottom:60,left:70},K={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 ee({hover:e}){var t,n,o,i;const r=e.data||{},s=e.stats,a=e.category;if(Array.isArray(r)){const e=a||(null===(t=r[0])||void 0===t?void 0:t.category)||"";if(s)return c.createElement("div",{className:"semiotic-tooltip",style:K},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,"n = ",s.n),c.createElement("div",null,"Min: ",s.min.toLocaleString()),c.createElement("div",null,"Q1: ",s.q1.toLocaleString()),c.createElement("div",null,"Median: ",s.median.toLocaleString()),c.createElement("div",null,"Q3: ",s.q3.toLocaleString()),c.createElement("div",null,"Max: ",s.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=r.length;return c.createElement("div",{className:"semiotic-tooltip",style:K},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,n," items"))}if(null!=r.bin&&null!=r.count){const e=r.range||[];return c.createElement("div",{className:"semiotic-tooltip",style:K},r.category&&c.createElement("div",{style:{fontWeight:"bold"}},r.category+""),c.createElement("div",null,"Count: ",r.count),2===e.length&&c.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const l=r.category||r.name||r.group||r.__rName||"",u=null!==(i=null!==(o=null!==(n=r.value)&&void 0!==n?n:r.__rValue)&&void 0!==o?o:r.pct)&&void 0!==i?i:"";if(!l&&""===u){const e=Object.entries(r).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:K},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return c.createElement("div",{className:"semiotic-tooltip",style:K},l&&c.createElement("div",{style:{fontWeight:"bold"}},l+""),""!==u&&c.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const te=e.forwardRef(function(t,n){var o,i,s;const{chartType:a,runtimeMode:l,data:u,oAccessor:d="category",rAccessor:g="value",colorAccessor:m,stackBy:f,groupBy:y,multiAxis:p,timeAccessor:v,valueAccessor:b,categoryAccessor:x,projection:k="vertical",size:L=[600,400],responsiveWidth:C,responsiveHeight:j,margin:P,barPadding:H,innerRadius:B,normalize:N,startAngle:_,dynamicColumnWidth:$,bins:W,showOutliers:D,showIQR:R,amplitude:z,connectorAccessor:q,connectorStyle:F,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:Q="sliding",windowSize:Z=200,pieceStyle:K,summaryStyle:te,colorScheme:ne,barColors:oe,showAxes:ie=!0,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,enableHover:ce=!0,hoverAnnotation:ue,tooltipContent:de,customHoverBehavior:he,annotations:ge,svgAnnotationRules:me,showGrid:fe=!1,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,backgroundGraphics:we,foregroundGraphics:ke,title:Ae,className:Ee,background:Se,centerContent:Me,decay:Oe,pulse:Le,transition:Ce,staleness:je}=t,[Pe,He]=function(t,n,o){const i=e.useRef(null),[r,s]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)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;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:t[0],o&&r?r.h:t[1]]]}(L,C,j),Be=e.useMemo(()=>Object.assign(Object.assign({},J),P),[P]),Ne=He[0]-Be.left-Be.right,_e=He[1]-Be.top-Be.bottom,$e=e.useRef(null),We=e.useRef(!0),De=e.useRef(0),Re=e.useRef(null),ze=e.useRef(()=>{}),[Ie,Te]=e.useState(null),[qe,Fe]=e.useState(null),[Ge,Ve]=e.useState(0),[Xe,Ye]=e.useState(!1),Qe=ce||ue,Ze="streaming"===l,Ue=e.useMemo(()=>({chartType:a,runtimeMode:Ze?"streaming":"bounded",windowSize:Z,windowMode:Q,extentPadding:X,projection:k,oAccessor:Ze?void 0:d,rAccessor:Ze?void 0:g,colorAccessor:m,stackBy:f,groupBy:y,multiAxis:p,timeAccessor:Ze?v:void 0,valueAccessor:Ze?b||("string"==typeof g||"function"==typeof g?g:void 0):void 0,categoryAccessor:Ze?x||d:void 0,rExtent:G,oExtent:V,barPadding:H,innerRadius:B,normalize:N,startAngle:_,dynamicColumnWidth:$,bins:W,showOutliers:D,showIQR:R,amplitude:z,connectorAccessor:q,connectorStyle:F,oSort:Y,pieceStyle:K,summaryStyle:te,colorScheme:ne,barColors:oe,decay:Oe,pulse:Le,transition:Ce,staleness:je}),[a,Z,Q,X,k,d,g,m,f,y,p,v,b,x,G,V,H,B,N,_,$,W,D,R,z,q,F,Y,K,te,ne,oe,Oe,Le,Ce,je,Ze]),Je=e.useRef(null);Je.current||(Je.current=new w(Ue));const Ke=e.useCallback(()=>{De.current||(De.current=requestAnimationFrame(()=>ze.current()))},[]);e.useEffect(()=>{var e;null===(e=Je.current)||void 0===e||e.updateConfig(Ue),We.current=!0,Ke()},[Ue,Ke]);const et=e.useRef(null);et.current||(et.current=new h(e=>{const t=Je.current;t&&t.ingest(e)&&(We.current=!0,Ke())}));const tt=e.useCallback(e=>{var t;null===(t=et.current)||void 0===t||t.push(e)},[]),nt=e.useCallback(e=>{var t;null===(t=et.current)||void 0===t||t.pushMany(e)},[]),ot=e.useCallback(()=>{var e,t;null===(e=et.current)||void 0===e||e.clear(),null===(t=Je.current)||void 0===t||t.clear(),We.current=!0,Ke()},[Ke]);e.useImperativeHandle(n,()=>({push:tt,pushMany:nt,clear:ot,getData:()=>{var e,t;return null!==(t=null===(e=Je.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Je.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[tt,nt,ot]),e.useEffect(()=>{var e;u&&(null===(e=et.current)||void 0===e||e.setBoundedData(u))},[u]);const it=e.useRef(()=>{}),rt=e.useRef(()=>{});it.current=e=>{if(!Qe)return;const t=$e.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Be.left,i=e.clientY-n.top-Be.top;if(0>o||o>Ne||0>i||i>_e)return void(Re.current&&(Re.current=null,Te(null),he&&he(null),Ke()));const r=Je.current;if(!r||0===r.scene.length)return;const s="radial"===k,a=function(e,t,n,o=30){let i=null;for(const r of e){let e=null;switch(r.type){case"rect":e=A(r,t,n);break;case"point":e=E(r,t,n);break;case"wedge":e=S(r,t,n);break;case"boxplot":e=M(r,t,n);break;case"violin":e=O(r,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}(r.scene,s?o-Ne/2:o,s?i-_e/2:i);if(!a)return void(Re.current&&(Re.current=null,Te(null),he&&he(null),Ke()));const l=Object.assign(Object.assign({data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y},a.stats&&{stats:a.stats}),a.category&&{category:a.category});Re.current=l,Te(l),he&&(he(l),We.current=!0),Ke()},rt.current=()=>{Re.current&&(Re.current=null,Te(null),he&&(he(null),We.current=!0),Ke())},e.useCallback(e=>it.current(e),[]);const st=e.useCallback(()=>rt.current(),[]),at=e.useRef(-1),lt=e.useCallback(e=>{const t=Je.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=at.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return at.current=-1,Re.current=null,Te(null),he&&he(null),void Ke();const r=0>o?0:i;at.current=r;const s={data:(a=n[r]).datum,x:a.x,y:a.y,time:a.x,value:a.y};var a;Re.current=s,Te(s),he&&he(s),Ke()},[he,Ke]),ct=e.useCallback(e=>{at.current=-1,it.current(e)},[]);ze.current=()=>{var e,t;De.current=0;const n=$e.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Je.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(r),l=We.current;l&&!s&&(i.computeScene({width:Ne,height:_e}),We.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=He[0]*c,n.height=He[1]*c,n.style.width=He[0]+"px",n.style.height=He[1]+"px",o.scale(c,c),o.clearRect(0,0,He[0],He[1]);const u=null!==(e=null==je?void 0:je.threshold)&&void 0!==e?e:5e3,d=je&&i.lastIngestTime>0&&r-i.lastIngestTime>u;d&&(o.globalAlpha=null!==(t=null==je?void 0:je.dimOpacity)&&void 0!==t?t:.5);const h=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=Se||(h&&"transparent"!==h?h:null);g&&(o.fillStyle=g,o.fillRect(0,0,He[0],He[1]));const m="radial"===k;m?(o.save(),o.translate(Be.left+Ne/2,Be.top+_e/2)):o.translate(Be.left,Be.top);const f=U[a]||[],y={width:Ne,height:_e};for(const e of f)e(o,i.scene,i.scales,y);m&&o.restore(),d&&(o.globalAlpha=1),l&&i.scales&&(Fe(i.scales),Ve(e=>e+1)),(null==je?void 0:je.showBadge)&&Ye(!!d),(s||i.hasActivePulses)&&(De.current=requestAnimationFrame(()=>ze.current()))},e.useEffect(()=>(Ke(),()=>{De.current&&(cancelAnimationFrame(De.current),De.current=0)}),[Ke]),e.useEffect(()=>{We.current=!0,Ke()},[a,Ne,_e,ie,Se,Ke]),function(t,n,o,i,r,s){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(e)},[t,r,i])}(je,Je,We,Ke,Xe,Ye);const ut=Qe&&Ie?de?de(Ie):c.createElement(ee,{hover:Ie}):null,dt="radial"===k,ht=Ie?dt?Ie.x+Ne/2:Ie.x:0,gt=Ie?dt?Ie.y+_e/2:Ie.y:0,mt=ut?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Be.left+ht,top:Be.top+gt,transform:`translate(${ht>.7*Ne?"calc(-100% - 12px)":"12px"}, ${.3*_e>gt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},ut):null;if(T){const e=Je.current;e&&u&&(e.ingest({inserts:u,bounded:!0}),e.computeScene({width:Ne,height:_e}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(i=null==e?void 0:e.scales)&&void 0!==i?i:null,s="radial"===k,a=s?Be.left+Ne/2:Be.left,l=s?Be.top+_e/2:Be.top;return c.createElement("div",{className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"img","aria-label":"string"==typeof Ae?Ae:"Ordinal chart",style:{position:"relative",width:He[0],height:He[1]}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:He[0],height:He[1],style:{position:"absolute",left:0,top:0}},we&&c.createElement("g",{transform:`translate(${Be.left},${Be.top})`},we),c.createElement("g",{transform:`translate(${a},${l})`},Se&&c.createElement("rect",{x:0,y:0,width:Ne,height:_e,fill:Se}),t.map((e,t)=>function(e,t){var n,o,i,s,a;switch(e.type){case"rect":return c.createElement("rect",{key:"ord-rect-"+t,x:e.x,y:e.y,width:e.w,height:e.h,fill:e.style.fill||"#4e79a7",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"point":return c.createElement("circle",{key:"ord-point-"+t,cx:e.x,cy:e.y,r:e.r,fill:e.style.fill||"#4e79a7",opacity:null!==(n=e.style.opacity)&&void 0!==n?n:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"wedge":{const n=e,o=r.arc().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return c.createElement("path",{key:"ord-wedge-"+t,d:o,transform:`translate(${n.cx},${n.cy})`,fill:n.style.fill||"#4e79a7",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=e,r=n.columnWidth/2;return"vertical"===n.projection?c.createElement("g",{key:"ord-boxplot-"+t},c.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:n.x-r,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:n.style.fill||"#4e79a7",fillOpacity:null!==(o=n.style.fillOpacity)&&void 0!==o?o:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.x-r,y1:n.medianPos,x2:n.x+r,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:n.x-.5*r,y1:n.minPos,x2:n.x+.5*r,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.x-.5*r,y1:n.maxPos,x2:n.x+.5*r,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):c.createElement("g",{key:"ord-boxplot-"+t},c.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-r,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:n.style.fill||"#4e79a7",fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.medianPos,y1:n.y-r,x2:n.medianPos,y2:n.y+r,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:n.minPos,y1:n.y-.5*r,x2:n.minPos,y2:n.y+.5*r,stroke:n.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:n.maxPos,y1:n.y-.5*r,x2:n.maxPos,y2:n.y+.5*r,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=e,o=[c.createElement("path",{key:"ord-violin-path-"+t,d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:n.style.fill||"#4e79a7",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 e=n.bounds,i=e.x+e.width/2,r=e.y+e.height/2;e.height>e.width?o.push(c.createElement("line",{key:"ord-violin-iqr-"+t,x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:"ord-violin-med-"+t,cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(c.createElement("line",{key:"ord-violin-iqr-"+t,x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:"ord-violin-med-"+t,cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return c.createElement("g",{key:"ord-violin-"+t},o)}case"connector":return c.createElement("line",{key:"ord-conn-"+t,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(a=e.style.opacity)&&void 0!==a?a:.5});default:return null}}(e,t)).filter(Boolean))),c.createElement(I,{width:Ne,height:_e,totalWidth:He[0],totalHeight:He[1],margin:Be,scales:n,showAxes:ie,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,showGrid:fe,title:Ae,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,foregroundGraphics:ke,annotations:ge,svgAnnotationRules:me,annotationFrame:0,xAccessor:"string"==typeof d?d:void 0,yAccessor:"string"==typeof g?g:void 0,annotationData:null==e?void 0:e.getData()}),Me&&"radial"===k&&c.createElement("div",{style:{position:"absolute",left:Be.left+Ne/2,top:Be.top+_e/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Me))}return c.createElement("div",{ref:Pe,className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"img","aria-label":"string"==typeof Ae?Ae:"Ordinal chart",tabIndex:0,style:{position:"relative",width:C?"100%":He[0],height:j?"100%":He[1]},onMouseMove:Qe?ct:void 0,onMouseLeave:Qe?st:void 0,onKeyDown:lt},we&&c.createElement("svg",{style:{position:"absolute",top:0,left:0,width:He[0],height:He[1],pointerEvents:"none"}},c.createElement("g",{transform:`translate(${Be.left},${Be.top})`},we)),c.createElement("canvas",{ref:$e,style:{position:"absolute",top:0,left:0,width:He[0],height:He[1]}}),c.createElement(I,{width:Ne,height:_e,totalWidth:He[0],totalHeight:He[1],margin:Be,scales:qe,showAxes:ie,oLabel:re,rLabel:se,oFormat:ae,rFormat:le,showGrid:fe,title:Ae,legend:ye,legendHoverBehavior:pe,legendClickBehavior:ve,legendHighlightedCategory:be,legendIsolatedCategories:xe,foregroundGraphics:ke,annotations:ge,svgAnnotationRules:me,annotationFrame:Ge,xAccessor:"string"==typeof d?d:void 0,yAccessor:"string"==typeof g?g:void 0,annotationData:null===(s=Je.current)||void 0===s?void 0:s.getData()}),Me&&"radial"===k&&c.createElement("div",{style:{position:"absolute",left:Be.left+Ne/2,top:Be.top+_e/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Me),(null==je?void 0:je.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===je.badgePosition?{top:4,left:4}:"bottom-left"===je.badgePosition?{bottom:4,left:4}:"bottom-right"===je.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Xe?"#dc3545":"#28a745",color:"white"})},Xe?"STALE":"LIVE"),mt)});te.displayName="StreamOrdinalFrame";const ne={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},oe=s.schemeCategory10;function ie(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):oe[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+""))%oe.length]}function re(e,n,o="category10"){const i=Array.from(new Set(e.map(e=>e[n]))),r=i.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(i).range(o).unknown("#999");const s=ne[o]||ne.category10;if(r&&"function"==typeof s)return e=>s(Number(e)/Math.max(...i.map(Number)));{const e=Array.isArray(s)?s:oe;return t.scaleOrdinal().domain(i).range(e).unknown("#999")}}const se=e.createContext(null),ae="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function le(t){const n=e.createContext(null),o=ce(t);return[function({children:o}){const i=e.useMemo(()=>ce(t),[]);return c.createElement(n.Provider,{value:i,children:o})},t=>{var i;const r=null!==(i=e.useContext(n))&&void 0!==i?i:o;return function(t,n){const[o,i]=e.useState(n);return ae(()=>t(()=>i(n)),[t]),o}(r.subscribe,()=>t(r.getState()))}]}function ce(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 ue(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 de(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[he,ge]=le(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=de(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=de(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}})}})),[me,fe]=le(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}))}}));function ye(t){const n=e.useId(),o=t.clientId||n,{name:i}=t,r=ge(e=>e.selections.get(i)),s=ge(e=>e.setClause),a=ge(e=>e.clearClause),l=e.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:e.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ue(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:e.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}const pe=e.createContext(!1);function ve(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:.2;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}const be="#007bff";function xe(t,n,o="category10"){const i=e.useContext(se);return e.useMemo(()=>{if(n&&"function"!=typeof n)return i&&Object.keys(i).length>0?e=>i[e]||re(t,n,o)(e):re(t,n,o)},[t,n,o,i])}function we(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const i="function"==typeof(r=o)?r:e=>e[r];var r;return e.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[t,n,o])}function ke({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a}){const l=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}:null}(n,o),c=ye({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:i,isActive:r,selectPoints:s,clear:a}=ye({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=fe(e=>e.pushObservation),h=t?{isActive:c.isActive,predicate:c.predicate}:null,g=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(r||d){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),d&&d(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),d&&d(e)}}},[n,u,r,s,a,d]),m=e.useCallback(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const s=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),d&&d(s)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,s,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:m}}function Ae({data:t,colorBy:n,colorScale:o,showLegend:i,userMargin:r,defaults:s={top:50,bottom:60,left:70,right:40}}){const a=e.useContext(pe),l=void 0!==i?i:!a&&!!n,c=e.useMemo(()=>{if(l&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==i&&(t.stroke=i),void 0!==r&&(t.strokeWidth=r),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(i=>{const r=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=r?o(r,t,n):n?n(i):"#000000";return{label:i+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:ie})},[l,n,t,o]),u=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),r);return c&&120>e.right&&(e.right=120),e},[s,r,c]);return{legend:c,margin:u}}function Ee(t,n,o){const[i,r]=e.useState(null),[s,a]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&r(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&a(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=i?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===i}:"isolate"===t&&s.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return s.has(o)}}:null},[t,n,i,s]);return{highlightedCategory:"highlight"===t?i:null,isolatedCategories:"isolate"===t?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const Se={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 Me(e,t,n){var o,i,r,s,a,l;const c=Se[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(i=t.height)&&void 0!==i?i:c.height,showAxes:c.showAxes,showGrid:null!==(r=t.showGrid)&&void 0!==r?r:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const Oe={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Le(e,t){return"function"==typeof t?t(e):e[t]}function Ce(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 je(e={}){const{fields:t,title:n,format:o,style:i={},className:r=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Le(e,n);s=Ce(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,i,r;"string"==typeof t?(n=t,i=t,r=o):(n=t.label,i=t.accessor||t.key||"",r=t.format||o);const s=Le(e,i);a.push({label:n,value:Ce(s,r)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Ce(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Ce(e[t[0]],o))}}const l=Object.assign(Object.assign({},Oe),i);return c.createElement("div",{className:("semiotic-tooltip "+r).trim(),style:l},s&&c.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>c.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&c.createElement("span",null,e.label,": "),e.value)))}}function Pe(e){return!0===e?je():"function"==typeof e?e:!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?je(e):je())}function He(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Be(e,t){return"function"==typeof t?t(e):e[t]}function Ne({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:i=!1}){return r=>{var s;const a=i?(null===(s=r.data)||void 0===s?void 0:s[0])||r.data||r:r.data||r,l=Be(a,e),u=Be(a,t),d=n?Be(a,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold"}},He(l)),c.createElement("div",{style:{marginTop:4}},He(u)),null!=d&&c.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",He(d)));var h}}function _e({componentName:e,message:t,width:n,height:o}){return c.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,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"}},c.createElement("div",{style:{textAlign:"center",maxWidth:400}},c.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),c.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}class $e extends c.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,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:c.createElement(_e,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var We;const De="undefined"!=typeof process&&"production"!==(null===(We=process.env)||void 0===We?void 0:We.NODE_ENV);function Re({componentName:e,width:t,height:n,children:o}){return c.createElement($e,{fallback:o=>c.createElement(_e,{componentName:e,message:o.message,width:t,height:n})},o)}const ze={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"},Ie={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Te(e,t,n,o){return!1===o||e&&Array.isArray(e)&&e.length>0||e&&!Array.isArray(e)?null:c.createElement("div",{style:Object.assign(Object.assign({},ze),{width:t,height:n})},o||"No data available")}function qe(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),r=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+r)-r))/2);return c.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>c.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ie),{position:"absolute",top:s+n*(i+r),left:Math.floor(.1*t),width:30+Math.round(50*Math.random())+"%",height:i,opacity:.5+n%2*.2})})))}function Fe(e,t,n,o){if(!De)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 Ge(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 Ve(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=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Ge(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Xe({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(!t||!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=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(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=Ve(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Ye(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sort:g=!1,barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[];Fe("BarChart",_,"categoryAccessor",s),Fe("BarChart",_,"valueAccessor",a);const{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),D=we(_,g,a),R=xe(_,d,h),z=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of _){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[_,d]),I=Ee(E,d,z),T=e.useMemo(()=>I.legendSelectionHook?I.legendSelectionHook:$,[I.legendSelectionHook,$]),q=e.useMemo(()=>e=>{const t={};return t.fill=d?ie(e,d,R):be,t},[d,R]),F=e.useMemo(()=>ve(q,T,v),[q,T,v]),{legend:G,margin:V}=Ae({data:D,colorBy:d,colorScale:R,showLegend:C,userMargin:i,defaults:n.marginDefaults}),X=e.useMemo(()=>Ne({categoryAccessor:s,valueAccessor:a,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group"}),[s,a,d]),Y=Xe({componentName:"BarChart",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(Y)return c.createElement(_e,{componentName:"BarChart",message:Y,width:S,height:M});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:D,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",pieceStyle:F,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:u,showGrid:L,oSort:g},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||X}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"BarChart",width:S,height:M},c.createElement(te,Object.assign({},Q)))}function Qe(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",stackBy:a,valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",normalize:m=!1,barPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E,legendInteraction:S}=t,M=n.width,O=n.height,L=n.enableHover,C=n.showGrid,j=n.showLegend,P=n.title,H=n.categoryLabel,B=n.valueLabel,N=qe(A,M,O);if(N)return N;const _=Te(o,M,O,E);if(_)return _;const $=o||[],W=h||a,{activeSelectionHook:D,customHoverBehavior:R}=ke({selection:b,linkedHover:x,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),z=xe($,W,g),I=e.useMemo(()=>{if(!W)return[];const e=new Set;for(const t of $){const n="function"==typeof W?W(t):t[W];null!=n&&e.add(n+"")}return Array.from(e)},[$,W]),T=Ee(S,W,I),q=e.useMemo(()=>T.legendSelectionHook?T.legendSelectionHook:D,[T.legendSelectionHook,D]),F=e.useMemo(()=>e=>W?{fill:ie(e,W,z)}:{fill:be},[W,z]),G=e.useMemo(()=>ve(F,q,b),[F,q,b]),{legend:V,margin:X}=Ae({data:$,colorBy:W,colorScale:z,showLegend:j,userMargin:i,defaults:n.marginDefaults}),Y=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l,groupAccessor:s}),[a,s,l]),Q=Xe({componentName:"StackedBarChart",data:$,accessors:{categoryAccessor:s,valueAccessor:l},requiredProps:{stackBy:a}});if(Q)return c.createElement(_e,{componentName:"StackedBarChart",message:Q,width:M,height:O});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:$,oAccessor:s,rAccessor:l,stackBy:a,normalize:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:G,size:[M,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,barPadding:f,enableHover:L,showAxes:n.showAxes,oLabel:H,rLabel:B,rFormat:d,showGrid:C},V&&{legend:V}),S&&"none"!==S&&{legendHoverBehavior:T.onLegendHover,legendClickBehavior:T.onLegendClick,legendHighlightedCategory:T.highlightedCategory,legendIsolatedCategories:T.isolatedCategories}),P&&{title:P}),r&&{className:r}),{tooltipContent:Pe(y)||Y}),(x||w)&&{customHoverBehavior:R}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"StackedBarChart",width:M,height:O},c.createElement(te,Object.assign({},Z)))}function Ze(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",groupBy:a,valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[],$=h||a,{activeSelectionHook:W,customHoverBehavior:D}=ke({selection:v,linkedHover:b,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),R=xe(_,$,g),z=e.useMemo(()=>{if(!$)return[];const e=new Set;for(const t of _){const n="function"==typeof $?$(t):t[$];null!=n&&e.add(n+"")}return Array.from(e)},[_,$]),I=Ee(E,$,z),T=e.useMemo(()=>I.legendSelectionHook?I.legendSelectionHook:W,[I.legendSelectionHook,W]),q=e.useMemo(()=>e=>$?{fill:ie(e,$,R)}:{fill:be},[$,R]),F=e.useMemo(()=>ve(q,T,v),[q,T,v]),{legend:G,margin:V}=Ae({data:_,colorBy:$,colorScale:R,showLegend:C,userMargin:i,defaults:n.marginDefaults}),X=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l,groupAccessor:s}),[a,s,l]),Y=Xe({componentName:"GroupedBarChart",data:_,accessors:{categoryAccessor:s,valueAccessor:l},requiredProps:{groupBy:a}});if(Y)return c.createElement(_e,{componentName:"GroupedBarChart",message:Y,width:S,height:M});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:_,oAccessor:s,rAccessor:l,groupBy:a,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:F,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:d,showGrid:L},G&&{legend:G}),E&&"none"!==E&&{legendHoverBehavior:I.onLegendHover,legendClickBehavior:I.onLegendClick,legendHighlightedCategory:I.highlightedCategory,legendIsolatedCategories:I.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||X}),(b||x)&&{customHoverBehavior:D}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"GroupedBarChart",width:S,height:M},c.createElement(te,Object.assign({},Q)))}function Ue(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sizeBy:g,sizeRange:m=[3,8],pointRadius:f=4,pointOpacity:y=.7,categoryPadding:p=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:E,loading:S,emptyContent:M,legendInteraction:O}=t,L=n.width,C=n.height,j=n.enableHover,P=n.showGrid,H=n.showLegend,B=n.title,N=n.categoryLabel,_=n.valueLabel,$=qe(S,L,C);if($)return $;const W=Te(o,L,C,M);if(W)return W;const D=o||[],{activeSelectionHook:R,customHoverBehavior:z}=ke({selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:E}),I=xe(D,d,h),T=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of D){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[D,d]),q=Ee(O,d,T),F=e.useMemo(()=>q.legendSelectionHook?q.legendSelectionHook:R,[q.legendSelectionHook,R]),G=e.useMemo(()=>{if(!g)return;const e=D.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[D,g]),V=e.useMemo(()=>e=>{const t={fillOpacity:y};return t.fill=d?ie(e,d,I):be,t.r=g?function(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):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,g,m,G):f,t},[d,I,g,m,G,f,y]),X=e.useMemo(()=>ve(V,F,w),[V,F,w]),{legend:Y,margin:Q}=Ae({data:D,colorBy:d,colorScale:I,showLegend:H,userMargin:i,defaults:n.marginDefaults}),Z=e.useMemo(()=>Ne({categoryAccessor:s,valueAccessor:a,groupAccessor:d||void 0}),[s,a,d]),U=Xe({componentName:"SwarmPlot",data:D,accessors:{categoryAccessor:s,valueAccessor:a}});if(U)return c.createElement(_e,{componentName:"SwarmPlot",message:U,width:L,height:C});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:D,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",pieceStyle:X,size:[L,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:p,enableHover:j,showAxes:n.showAxes,oLabel:N,rLabel:_,rFormat:u,showGrid:P},Y&&{legend:Y}),O&&"none"!==O&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),B&&{title:B}),r&&{className:r}),{tooltipContent:Pe(v)||Z}),(k||A)&&{customHoverBehavior:z}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Re,{componentName:"SwarmPlot",width:L,height:C},c.createElement(te,Object.assign({},J)))}function Je(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",showOutliers:g=!0,categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A,legendInteraction:E}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(k,S,M);if(B)return B;const N=Te(o,S,M,A);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),D=xe(_,d,h),R=e.useMemo(()=>{if(!d)return[];const e=new Set;for(const t of _){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[_,d]),z=Ee(E,d,R),I=e.useMemo(()=>z.legendSelectionHook?z.legendSelectionHook:$,[z.legendSelectionHook,$]),T=e.useMemo(()=>e=>{const t=d?ie(e,d,D):be;return{fill:t,stroke:t,fillOpacity:.8}},[d,D]),q=e.useMemo(()=>ve(T,I,v),[T,I,v]),{legend:F,margin:G}=Ae({data:_,colorBy:d,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),V=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&c.createElement(c.Fragment,null,null!=t.n&&c.createElement("div",null,"n = ",t.n),c.createElement("div",null,"Median: ",t.median.toLocaleString()),c.createElement("div",null,"Q1: ",t.q1.toLocaleString()),c.createElement("div",null,"Q3: ",t.q3.toLocaleString()),c.createElement("div",null,"Min: ",t.min.toLocaleString()),c.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),X=Xe({componentName:"BoxPlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(X)return c.createElement(_e,{componentName:"BoxPlot",message:X,width:S,height:M});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:q,showOutliers:g,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,barPadding:m,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:u,showGrid:L},F&&{legend:F}),E&&"none"!==E&&{legendHoverBehavior:z.onLegendHover,legendClickBehavior:z.onLegendClick,legendHighlightedCategory:z.highlightedCategory,legendIsolatedCategories:z.isolatedCategories}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(f)||V}),(b||x)&&{customHoverBehavior:W}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"BoxPlot",width:S,height:M},c.createElement(te,Object.assign({},Y)))}function Ke(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",bins:l=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:g="category10",categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w,loading:k,emptyContent:A}=t,E=n.width,S=n.height,M=n.enableHover,O=n.showGrid,L=n.showLegend,C=n.title,j=n.categoryLabel,P=n.valueLabel,H=qe(k,E,S);if(H)return H;const B=Te(o,E,S,A);if(B)return B;const N=o||[],{activeSelectionHook:_,customHoverBehavior:$}=ke({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),W=xe(N,h,g),D=e.useMemo(()=>e=>{const t=h?ie(e,h,W):be;return{fill:t,stroke:t,fillOpacity:.8}},[h,W]),R=e.useMemo(()=>ve(D,_,v),[D,_,v]),{legend:z,margin:I}=Ae({data:N,colorBy:h,colorScale:W,showLegend:L,userMargin:i,defaults:n.marginDefaults}),T=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,i=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),i&&2===i.length&&c.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),q=Xe({componentName:"Histogram",data:N,accessors:{categoryAccessor:s,valueAccessor:a}});if(q)return c.createElement(_e,{componentName:"Histogram",message:q,width:E,height:S});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:N,oAccessor:s,rAccessor:a,projection:"horizontal",summaryStyle:R,bins:l,normalize:u,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I,barPadding:m,enableHover:M,showAxes:n.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:O},z&&{legend:z}),C&&{title:C}),r&&{className:r}),{tooltipContent:Pe(f)||T}),(b||x)&&{customHoverBehavior:$}),y&&y.length>0&&{annotations:y}),p);return c.createElement(Re,{componentName:"Histogram",width:E,height:S},c.createElement(te,Object.assign({},F)))}function et(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="vertical",bins:u=25,showIQR:d=!0,valueFormat:h,colorBy:g,colorScheme:m="category10",categoryPadding:f=20,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(A,S,M);if(B)return B;const N=Te(o,S,M,E);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),D=xe(_,g,m),R=e.useMemo(()=>e=>{const t=g?ie(e,g,D):be;return{fill:t,stroke:t,fillOpacity:.6}},[g,D]),z=e.useMemo(()=>ve(R,$,b),[R,$,b]),{legend:I,margin:T}=Ae({data:_,colorBy:g,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),q=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof a?a(e):e[a];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),r=i.length,s=r>0?i[Math.floor(r/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),r>0&&c.createElement("div",null,"n = ",r),null!=s&&c.createElement("div",null,"Median: ",s.toLocaleString()))},[a]),F=Xe({componentName:"ViolinPlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(F)return c.createElement(_e,{componentName:"ViolinPlot",message:F,width:S,height:M});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:z,bins:u,showIQR:d,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:h,showGrid:L},I&&{legend:I}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"ViolinPlot",width:S,height:M},c.createElement(te,Object.assign({},G)))}function tt(t){var n;const o=Me(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:i,margin:r,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:g="category10",sort:m=!0,dotRadius:f=5,categoryPadding:y=10,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A,loading:E,emptyContent:S,legendInteraction:M}=t,O=o.width,L=o.height,C=o.enableHover,j=o.showGrid,P=o.showLegend,H=o.title,B=o.categoryLabel,N=o.valueLabel,_=qe(E,O,L);if(_)return _;const $=Te(i,O,L,S);if($)return $;const W=i||[],{activeSelectionHook:D,customHoverBehavior:R}=ke({selection:x,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),z=we(W,m,l),I=xe(W,h,g),T=e.useMemo(()=>{if(!h)return[];const e=new Set;for(const t of W){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[W,h]),q=Ee(M,h,T),F=e.useMemo(()=>q.legendSelectionHook?q.legendSelectionHook:D,[q.legendSelectionHook,D]),G=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=h?ie(e,h,I):be,t},[h,I,f]),V=e.useMemo(()=>ve(G,F,x),[G,F,x]),{legend:X,margin:Y}=Ae({data:z,colorBy:h,colorScale:I,showLegend:P,userMargin:r,defaults:o.marginDefaults}),Q=e.useMemo(()=>Ne({categoryAccessor:a,valueAccessor:l}),[a,l]),Z=Xe({componentName:"DotPlot",data:W,accessors:{categoryAccessor:a,valueAccessor:l}});if(Z)return c.createElement(_e,{componentName:"DotPlot",message:Z,width:O,height:L});const U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:z,oAccessor:a,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:V,size:[O,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:y,enableHover:C,showAxes:o.showAxes,oLabel:B,rLabel:N,rFormat:d,showGrid:j,oSort:m},X&&{legend:X}),M&&"none"!==M&&{legendHoverBehavior:q.onLegendHover,legendClickBehavior:q.onLegendClick,legendHighlightedCategory:q.highlightedCategory,legendIsolatedCategories:q.isolatedCategories}),H&&{title:H}),s&&{className:s}),{tooltipContent:Pe(p)||Q}),(w||k)&&{customHoverBehavior:R}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Re,{componentName:"DotPlot",width:O,height:L},c.createElement(te,Object.assign({},U)))}function nt(t){var n,o;const i=Me(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),{data:r,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",colorBy:d,colorScheme:h="category10",startAngle:g=0,tooltip:m,annotations:f,frameProps:y={},selection:p,linkedHover:v,onObservation:b,chartId:x,loading:w,emptyContent:k,legendInteraction:A}=t,E=i.width,S=i.height,M=i.enableHover,O=i.showLegend,L=i.title,C=qe(w,E,S);if(C)return C;const j=Te(r,E,S,k);if(j)return j;const P=r||[],H=d||l,{activeSelectionHook:B,customHoverBehavior:N}=ke({selection:p,linkedHover:v,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),_=xe(P,H,h),$=e.useMemo(()=>{if(!H)return[];const e=new Set;for(const t of P){const n="function"==typeof H?H(t):t[H];null!=n&&e.add(n+"")}return Array.from(e)},[P,H]),W=Ee(A,H,$),D=e.useMemo(()=>W.legendSelectionHook?W.legendSelectionHook:B,[W.legendSelectionHook,B]),R=e.useMemo(()=>e=>H?{fill:ie(e,H,_)}:{fill:be},[H,_]),z=e.useMemo(()=>ve(R,D,p),[R,D,p]),{legend:I,margin:T}=Ae({data:P,colorBy:H,colorScale:_,showLegend:O,userMargin:s,defaults:i.marginDefaults}),q=e.useMemo(()=>Ne({categoryAccessor:l,valueAccessor:u,groupAccessor:d&&d!==l?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[l,u,d]),F=Xe({componentName:"PieChart",data:P,accessors:{categoryAccessor:l,valueAccessor:u}});if(F)return c.createElement(_e,{componentName:"PieChart",message:F,width:E,height:S});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:P,oAccessor:l,rAccessor:u,projection:"radial",pieceStyle:z,startAngle:g,size:[E,S],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,enableHover:M,showAxes:!1},I&&{legend:I}),A&&"none"!==A&&{legendHoverBehavior:W.onLegendHover,legendClickBehavior:W.onLegendClick,legendHighlightedCategory:W.highlightedCategory,legendIsolatedCategories:W.isolatedCategories}),L&&{title:L}),a&&{className:a}),{tooltipContent:Pe(m)||q}),(v||b)&&{customHoverBehavior:N}),f&&f.length>0&&{annotations:f}),y);return c.createElement(Re,{componentName:"PieChart",width:E,height:S},c.createElement(te,Object.assign({},G)))}function ot(t){var n,o;const i=Me(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),{data:r,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",innerRadius:d=60,centerContent:h,colorBy:g,colorScheme:m="category10",startAngle:f=0,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E,legendInteraction:S}=t,M=i.width,O=i.height,L=i.enableHover,C=i.showLegend,j=i.title,P=qe(A,M,O);if(P)return P;const H=Te(r,M,O,E);if(H)return H;const B=r||[],N=g||l,{activeSelectionHook:_,customHoverBehavior:$}=ke({selection:b,linkedHover:x,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),W=xe(B,N,m),D=e.useMemo(()=>{if(!N)return[];const e=new Set;for(const t of B){const n="function"==typeof N?N(t):t[N];null!=n&&e.add(n+"")}return Array.from(e)},[B,N]),R=Ee(S,N,D),z=e.useMemo(()=>R.legendSelectionHook?R.legendSelectionHook:_,[R.legendSelectionHook,_]),I=e.useMemo(()=>e=>N?{fill:ie(e,N,W)}:{fill:be},[N,W]),T=e.useMemo(()=>ve(I,z,b),[I,z,b]),{legend:q,margin:F}=Ae({data:B,colorBy:N,colorScale:W,showLegend:C,userMargin:s,defaults:i.marginDefaults}),G=e.useMemo(()=>Ne({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[l,u,g]),V=Xe({componentName:"DonutChart",data:B,accessors:{categoryAccessor:l,valueAccessor:u}});if(V)return c.createElement(_e,{componentName:"DonutChart",message:V,width:M,height:O});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:B,oAccessor:l,rAccessor:u,projection:"radial",pieceStyle:T,innerRadius:d,startAngle:f,centerContent:h,size:[M,O],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:L,showAxes:!1},q&&{legend:q}),S&&"none"!==S&&{legendHoverBehavior:R.onLegendHover,legendClickBehavior:R.onLegendClick,legendHighlightedCategory:R.highlightedCategory,legendIsolatedCategories:R.isolatedCategories}),j&&{title:j}),a&&{className:a}),{tooltipContent:Pe(y)||G}),(x||w)&&{customHoverBehavior:$}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"DonutChart",width:M,height:O},c.createElement(te,Object.assign({},X)))}function it(t){const n=Me(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:i,className:r,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:m="category10",categoryPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:A,emptyContent:E}=t,S=n.width,M=n.height,O=n.enableHover,L=n.showGrid,C=n.showLegend,j=n.title,P=n.categoryLabel,H=n.valueLabel,B=qe(A,S,M);if(B)return B;const N=Te(o,S,M,E);if(N)return N;const _=o||[],{activeSelectionHook:$,customHoverBehavior:W}=ke({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k}),D=xe(_,g,m),R=e.useMemo(()=>e=>{const t=g?ie(e,g,D):be;return{fill:t,stroke:t,fillOpacity:.5}},[g,D]),z=e.useMemo(()=>ve(R,$,b),[R,$,b]),{legend:I,margin:T}=Ae({data:_,colorBy:g,colorScale:D,showLegend:C,userMargin:i,defaults:n.marginDefaults}),q=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;return o?c.createElement("div",{className:"semiotic-tooltip",style:Oe},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):c.createElement("div",{className:"semiotic-tooltip",style:Oe},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),F=Xe({componentName:"RidgelinePlot",data:_,accessors:{categoryAccessor:s,valueAccessor:a}});if(F)return c.createElement(_e,{componentName:"RidgelinePlot",message:F,width:S,height:M});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:_,oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:z,bins:u,size:[S,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T,barPadding:f,enableHover:O,showAxes:n.showAxes,oLabel:P,rLabel:H,rFormat:h,showGrid:L,oSort:!1,amplitude:d},I&&{legend:I}),j&&{title:j}),r&&{className:r}),{tooltipContent:Pe(y)||q}),(x||w)&&{customHoverBehavior:W}),p&&p.length>0&&{annotations:p}),v);return c.createElement(Re,{componentName:"RidgelinePlot",width:S,height:M},c.createElement(te,Object.assign({},G)))}Ye.displayName="BarChart",Qe.displayName="StackedBarChart",Ze.displayName="GroupedBarChart",Ue.displayName="SwarmPlot",Je.displayName="BoxPlot",Ke.displayName="Histogram",et.displayName="ViolinPlot",tt.displayName="DotPlot",nt.displayName="PieChart",ot.displayName="DonutChart",it.displayName="RidgelinePlot",exports.BarChart=Ye,exports.BoxPlot=Je,exports.DonutChart=ot,exports.DotPlot=tt,exports.GroupedBarChart=Ze,exports.Histogram=Ke,exports.PieChart=nt,exports.RidgelinePlot=it,exports.StackedBarChart=Qe,exports.StreamOrdinalFrame=te,exports.SwarmPlot=Ue,exports.ViolinPlot=et;